Make it configurable
This commit is contained in:
parent
fc983d033c
commit
ec568e59e1
1 changed files with 9 additions and 4 deletions
13
igmp.pl
13
igmp.pl
|
@ -10,9 +10,10 @@ use Net::Write::Layer qw/:constants/;
|
||||||
use Net::Write::Layer3;
|
use Net::Write::Layer3;
|
||||||
use Sys::HostIP;
|
use Sys::HostIP;
|
||||||
|
|
||||||
my $src_ip = Sys::HostIP->new()->ip;
|
my $hdmi_dev = 0+$ARGV[0];
|
||||||
|
my $multicast_addr = sprintf("239.255.42.%d", 42+$hdmi_dev);
|
||||||
|
|
||||||
#socket my $raw_socket, AF_INET, SOCK_RAW, IPPROTO_RAW or die "Couldn't open socket $!";
|
my $src_ip = Sys::HostIP->new()->ip;
|
||||||
|
|
||||||
my $ipv4 = Net::Frame::Layer::IPv4->new(
|
my $ipv4 = Net::Frame::Layer::IPv4->new(
|
||||||
src => $src_ip,
|
src => $src_ip,
|
||||||
|
@ -26,7 +27,7 @@ my $report = Net::Frame::Layer::IGMP::v3Report->new(
|
||||||
type => NF_IGMP_REPORTv3TYPE_CHANGEEXCLUDE,
|
type => NF_IGMP_REPORTv3TYPE_CHANGEEXCLUDE,
|
||||||
auxDataLen => 0,
|
auxDataLen => 0,
|
||||||
numSources => 0,
|
numSources => 0,
|
||||||
multicastAddress => '239.255.42.44',
|
multicastAddress => $multicast_addr,
|
||||||
sourceAddress => [],
|
sourceAddress => [],
|
||||||
auxData => '',
|
auxData => '',
|
||||||
);
|
);
|
||||||
|
@ -55,9 +56,13 @@ my $writer = Net::Write::Layer3->new(
|
||||||
protocol => NW_IPPROTO_RAW,
|
protocol => NW_IPPROTO_RAW,
|
||||||
family => NW_AF_INET,
|
family => NW_AF_INET,
|
||||||
);
|
);
|
||||||
$writer->open();
|
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
print "Sending multicast join\n";
|
||||||
|
$writer->open();
|
||||||
$osimple->send($writer);
|
$osimple->send($writer);
|
||||||
$writer->close();
|
$writer->close();
|
||||||
|
sleep 60;
|
||||||
|
}
|
||||||
|
|
||||||
#print Dumper(unpack("H*", $osimple->pack));
|
#print Dumper(unpack("H*", $osimple->pack));
|
||||||
|
|
Loading…
Add table
Reference in a new issue