NetPacket::IGMP(3)
π NetPacket::IGMP β bestie's guide to IGMP packets π
okay so this is NetPacket::IGMP, a Perl module living in the NetPacket::IGMP(3) man page, and it's literally here to help you assemble and disassemble IGMP (Internet Group Management Protocol) packets. group chat but for routers, no cap π«Ά
β¨ VERSION β¨
version 1.8.0 β that's the one, that's the era we're in π
πΈ SYNOPSIS πΈ
the vibe check, in code:
use NetPacket::IGMP;
$igmp_obj = NetPacket::IGMP->decode($raw_pkt);
$igmp_pkt = NetPacket::IGMP->encode(params...); # Not implemented
$igmp_data = NetPacket::IGMP::strip($raw_pkt);
π yes bestie, that # Not implemented comment is real and it's staying. we'll get to it.
π¦ DESCRIPTION π¦
NetPacket::IGMP hands you a whole little set of routines for assembling and disassembling packets using IGMP (Internet Group Management Protocol). it's giving packet whisperer, fr fr β¨
π Methods π
NetPacket::IGMP->decode([RAW PACKET])β decode the raw packet data you hand it and get back an object stuffed with instance data. and listen: this method will quite happily decode garbage input. like, it does not care. it's not gonna stop you. it is the responsibility of the programmer to make sure valid packet data is actually passed to this method. so likeβ¦ pls be responsible πNetPacket::IGMP->encode(param => value)β returns an IGMP packet encoded with the instance data you specified. Not implemented. that's it, that's the whole thing π
π§ Functions π§
NetPacket::IGMP::strip([RAW PACKET])β returns the encapsulated data (aka the payload) contained in the IGMP packet. plot twist: this function returnsundef, because there is no encapsulated data in an IGMP packet. it's empty on purpose, main character energy of a function that gives you nothing π
π Instance data π
the instance data on the NetPacket::IGMP object is made up of these fields:
versionβ the IGMP version of this packet.typeβ the message type for this packet.lenβ the length (including length of header) in bytes for this packet.subtypeβ the message subtype for this packet.cksumβ the checksum for this packet.group_addrβ the group address specified in this packet.dataβ the encapsulated data (payload) for this packet.
π Exports π
defaultβ none. we start with nothing, we build from there π«ΆexportableβIGMP_VERSION_RFC998IGMP_VERSION_RFC1112IGMP_HOST_MQUERYIGMP_HOST_MREPORTIGMP_IP_NO_HOSTSIGMP_IP_ALL_HOSTSIGMP_IP_ALL_ROUTERStagsβ these tags group together related exportable items::stripβ import the strip functionigmp_strip.:versionsβIGMP_VERSION_RFC998IGMP_VERSION_RFC1112:msgtypesβIGMP_HOST_MQUERYIGMP_HOST_MREPORT:group_addrsβIGMP_IP_NO_HOSTSIGMP_IP_ALL_HOSTSIGMP_IP_ALL_ROUTERS:ALLβ all the above exportable items. the everything bagel π₯―
β EXAMPLE β
the following script dumps UDP frames by IP address and UDP port to standard output. iconic behaviour honestly π
#!/usr/bin/perl -w
use strict;
use Net::PcapUtils;
use NetPacket::Ethernet qw(:strip);
use NetPacket::IP;
use NetPacket::IGMP;
sub process_pkt {
my($arg, $hdr, $pkt) = @_;
my $ip_obj = NetPacket::IP->decode(eth_strip($pkt));
my $igmp_obj = NetPacket::IGMP->decode($ip_obj->{data});
print("$ip_obj->{src_ip} -> $ip_obj->{dest_ip} ",
"$igmp_obj->{type}/$igmp_obj->{subtype} ",
"$igmp_obj->{group_addr}\n");
}
Net::PcapUtils::loop(\&process_pkt, FILTER => 'igmp');
π₯ TODO π₯
Implement encode() function
bestie. the encode function. it's on the list. it's been on the list. π
πΈ COPYRIGHT πΈ
Copyright (c) 2001 Tim Potter.
Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of the participants in the CRC for Advanced Computational Systems ('ACSys').
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
β οΈ yes that no-warranty line is doing a lot of heavy lifting, and yes it means what it says.
π AUTHOR π
Tim Potter <tpot@samba.org>
and that's the whole page, bestie π«Ά this was NetPacket::IGMP(3), shipped as part of perl v5.42.0, dated 2026-02-05 β ty for coming to my TED talk, go decode something cute πβ¨π
π¦ where this page comes from
- fedora 43: perl-NetPacket 1.8.0-1.fc43 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- fedora 44: perl-NetPacket 1.8.0-1.fc44 Β· Artistic-2.0 AND (GPL-1.0-or-later OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms