Skip to content

Commit

Permalink
Merge pull request #677 from waynieack/AlexaBridge.pm
Browse files Browse the repository at this point in the history
Fix for specifying a multicast interface
  • Loading branch information
hplato authored Mar 8, 2017
2 parents 67b4e36 + a223e46 commit 7a72ee1
Showing 1 changed file with 14 additions and 3 deletions.
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

0 comments on commit 7a72ee1

Please sign in to comment.