NetPacket::IPv6(3)
π NetPacket::IPv6 π
okay bestie, welcome to the manual page for NetPacket::IPv6 β it's a User Contributed Perl Documentation page and it's literally all about assembling and disassembling IPv6 (Internet Protocol version 6) packets. no cap. π¦
β¨ NAME β¨
NetPacket::IPv6 β Assemble and disassemble IPv6 (Internet Protocol version 6) packets. periodt. π
πΈ VERSION πΈ
version 1.8.0 β she's serving 1.8.0 and she knows it. π
π SYNOPSIS π
here's the whole vibe, three lines, immaculate:
use NetPacket::IPv6;
$ip_obj = NetPacket::IPv6->decode($raw_pkt);
$ip_pkt = NetPacket::IPv6->encode($ip_obj);
$ip_data = NetPacket::IPv6::strip($raw_pkt);
likeβ¦ look at her. main character energy fr fr. β¨
π¦ DESCRIPTION π¦
NetPacket::IPv6 provides a set of routines for assembling and disassembling packets using IPv6 (Internet Protocol version 6). that's it, that's the whole job, and she does it flawlessly. π
π Methods π
NetPacket::IPv6->decode([RAW PACKET])β Decode the raw packet data given and return an object containing instance data. ngl this method will quite happily decode garbage input β she does not judge, she does not check, she just decodes. it is the responsibility of the programmer to ensure valid packet data is passed to this method. so like, that's on you bestie. πNetPacket::IPv6->encode()β Return an IPv6 packet encoded with the instance data specified. This will infer the total length of the packet automatically from the payload length and length of any extension headers. she's doing the math for you, she's so thoughtful. π§NetPacket::IPv6->pseudo_header([PACKET LENGTH], [PROTOCOL])β Return an IPv6"pseudo-header"suitable for computing checksums for certain upper-level protocols. it's giving β¨checksum supportβ¨.
π Functions π
NetPacket::IPv6::strip([RAW PACKET])β Return the encapsulated data (or payload) contained in the IPv6 packet. This data is suitable to be used as input for other"NetPacket::*"modules.
This function is equivalent to creating an object using the decode() constructor and returning the "data" field of that object. iykyk. π
NetPacket::IPv6::ipv6_extheader([TYPE])β Return whether the IP protocol type is an IPv6 extension header. yes or no, simple as that. π
π Instance data π
The instance data for the "NetPacket::IPv6" object consists of the following fields. buckle up, there's a few:
verβ The IP version number of this packet.traffic_classβ The traffic class of this packet, equivalent to the type-of-service field for IPv4.flow_labelβ The flow label of this packet.lenβ The payload length (including any extension headers) in bytes for this packet.protoβ The IP protocol number for this packet.hop_limitβ The hop limit for this packet, equivalent to the time-to-live field for IPv4.src_ipβ The source IP address for this packet in colon-separated hextet notation.dest_ipβ The destination IP address for this packet in colon-separated hextet notation.extheadersβ Array of any extension headers for this packet, as a hashref containing the fields described below. An ESP (Encapsulating Security Payload) header will not be represented here; as it and any further extension headers and the payload data will be encrypted, it will be instead represented as the packet payload data itself, with a protocol number of50("IPv6_EXTHEADER_ESP"). π (she's encrypted, she's mysterious, we respect her privacy.)dataβ The encapsulated data (payload) for this IPv6 packet.
π Extension headers π
Extension headers may contain the following fields.
typeβ The extension header type number.lenβ The extension header length, in 8-byte units, minus the first 8-byte unit. (For Authentication extension headers, this length is in 4-byte units, minus the first two 4-byte units.) yes the math is a little cursed but that's just how the header said it. πdataβ The remaining contents of the extension header following the next-header and length bytes.
π Exports π
defaultβ none. we start empty, we stay humble. β¨tagsβ The following tags group together related exportable items.":protos"":tos"":misc"β Re-exported from NetPacket::IP for convenience.":extheaders"βIPv6_EXTHEADER_HOPBYHOPIPv6_EXTHEADER_ROUTINGIPv6_EXTHEADER_FRAGMENTIPv6_EXTHEADER_ESPIPv6_EXTHEADER_AUTHIPv6_EXTHEADER_NONEXTIPv6_EXTHEADER_DESTOPTIPv6_EXTHEADER_MOBILITYIPv6_EXTHEADER_HOSTIDENTIPv6_EXTHEADER_SHIM6IPv6_EXTHEADER_TESTING1IPv6_EXTHEADER_TESTING2":versions"βIP_VERSION_IPv6":strip"β Import the strip function"ipv6_strip".":ALL"β All the above exportable items. literally all of it, the whole buffet. π
β EXAMPLE β
The following script dumps IPv6 frames by IP address and protocol to standard output. it's cute, it's functional, it ate:
#!/usr/bin/perl -w
use strict;
use Net::PcapUtils;
use NetPacket::Ethernet qw(:strip);
use NetPacket::IPv6;
sub process_pkt {
my ($user, $hdr, $pkt) = @_;
my $ip_obj = NetPacket::IPv6->decode(eth_strip($pkt));
print("$ip_obj->{src_ip}:$ip_obj->{dest_ip} $ip_obj->{proto}\n");
}
Net::PcapUtils::loop(\&process_pkt, FILTER => 'ip6');
look at that FILTER => 'ip6'. obsessed. π₯
π TODO π
the to-do list, she's honest about it:
- More specific keys for well-defined extension headers.
- Parse routing extension headers to correctly compute upper-level checksums.
manifesting these get done bestie πβ¨
π«Ά COPYRIGHT π«Ά
Copyright (c) 2018 Dan Book.
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. so like, use her responsibly. π
πΈ AUTHOR πΈ
Dan Book <dbook@cpan.org>
and that's the whole page bestie!! this was NetPacket::IPv6 from perl v5.42.0, dated 2026-02-05, living at NetPacket::IPv6(3). go decode something. slay. π
β¨π
π¦ 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