Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for specifying a multicast interface #677

Merged
merged 2 commits into from
Mar 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions lib/AlexaBridge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,20 @@ sub _constant {

sub _mcast_add {
my ( $sock, $addr ) = @_;
my $ip_mreq = inet_aton($addr) . INADDR_ANY;

setsockopt( $sock, getprotobyname('ip') || 0, _constant('IP_ADD_MEMBERSHIP'), $ip_mreq ) || warn "Unable to add IGMP membership: $!\n";
my $ip_mreq;
if (defined $::config_parms{'alexaHttpIp'}) {
$ip_mreq = inet_aton($::config_parms{'alexaHttpIp'});
} else {
$ip_mreq = inet_aton('0.0.0.0');
}
$ip_mreq = inet_aton( $addr ) . $ip_mreq;

setsockopt(
$sock,
getprotobyname('ip') || 0,
_constant('IP_ADD_MEMBERSHIP'),
$ip_mreq
) || warn "Unable to add IGMP membership: $!\n";
}

sub check_for_data {
Expand Down