NetPacket::ICMPv6(3)

NetPacket::ICMPv6 πŸ’–

okay so this is a User Contributed Perl Documentation page, section 3 β€” the library-functions girlies know what that means. it's the NetPacket::ICMPv6 page and it's about building and taking apart ICMPv6 packets. let's GO πŸ¦‹


✨ NAME ✨

NetPacket::ICMPv6 β€” Assemble and disassemble ICMPv6 (Internet Control Message Protocol for IPv6) packets.

πŸŽ€ VERSION πŸŽ€

version 1.8.0 β€” yes bestie she's got a version number, she's official πŸ’…

🌸 SYNOPSIS 🌸

use NetPacket::ICMPv6;

$icmpv6_obj = NetPacket::ICMPv6->decode($raw_pkt);
$icmpv6_pkt = NetPacket::ICMPv6->encode($ipv6_pkt);
$icmpv6_data = NetPacket::ICMPv6::strip($raw_pkt);

literally three lines and you're doing packet stuff. iconic. ✨

πŸ’œ DESCRIPTION πŸ’œ

NetPacket::ICMPv6 provides a set of routines for assembling and disassembling packets using ICMPv6 (Internet Control Message Protocol for IPv6).

so like, ICMPv6 is the vibe-check protocol of IPv6, and this module is your bestie that speaks it fluently 🫢

🧚 Methods 🧚

  • NetPacket::ICMPv6->decode([RAW PACKET]) β€” Decode the raw packet data given and return an object containing instance data. This method will quite happily decode garbage input. It is the responsibility of the programmer to ensure valid packet data is passed to this method.
bestie listen. she does NOT check your work. if you hand her garbage she will decode it and hand you back an object and not say a word 😭 the vibes check is YOUR job, not hers. no cap.
  • NetPacket::ICMPv6->encode($ipv6_obj) β€” Return an ICMPv6 packet encoded with the instance data specified. Needs parts of the IPv6 header contained in $ipv6_obj in order to calculate the ICMPv6 checksum.
so you can't just encode from nothing β€” she needs the IPv6 header bits from $ipv6_obj to do the checksum math. she's not being difficult, the checksum literally requires it πŸ’…

⭐ Functions ⭐

  • NetPacket::ICMPv6::strip([RAW PACKET]) β€” Return the encapsulated data (or payload) contained in the ICMPv6 packet.

peel off the ICMPv6 wrapper, get the payload inside. like unwrapping a present except the present is bytes 🎁

πŸ¦‹ Instance data πŸ¦‹

The instance data for the NetPacket::ICMPv6 object consists of the following fields.

  • type β€” The ICMPv6 message type of this packet.
  • code β€” The ICMPv6 message code of this packet.
  • cksum β€” The checksum for this packet.
  • data β€” The encapsulated data (payload) for this packet.

four fields, that's the whole anatomy. she's lowkey simple like that πŸ’–

πŸ‘‘ Exports πŸ‘‘

  • default β€” none

nope, nada, nothing auto-imports. you gotta ask for what you want, main character boundaries πŸ’…

  • exportable β€” ICMPv6 message types:
ICMPv6_UNREACH ICMPv6_TOOBIG ICMPv6_TIMXCEED ICMPv6_PARAMPROB
ICMPv6_PRIVATEERROR1 ICMPv6_PRIVATEERROR2 ICMPv6_EXPANSIONERROR
ICMPv6_ECHOREQ ICMPv6_ECHOREPLY ICMPv6_MULTICASTQUERY
ICMPv6_MULTICASTREPORT ICMPv6_MULTICASTDONE
ICMPv6_ROUTERSOLICIT ICMPv6_ROUTERADVERT
ICMPv6_NEIGHBORSOLICIT ICMPv6_NEIGHBORADVERT
ICMPv6_REDIRECT ICMPv6_ROUTERRENUMBER
ICMPv6_NODEINFOQUERY ICMPv6_NODEINFOREPLY
ICMPv6_INVNEIGHBORSOLICIT ICMPv6_INVNEIGHBORADVERT
ICMPv6_MULTICASTREPORTV2
ICMPv6_HOMEAGENTREQUEST ICMPv6_HOMEAGENTREPLY
ICMPv6_MOBILEPREFIXSOLICIT ICMPv6_MOBILEPREFIXADVERT
ICMPv6_CERTPATHSOLICIT ICMPv6_CERTPATHADVERT
ICMPv6_MULTICASTADVERT ICMPv6_MULTICASTSOLICIT
ICMPv6_MULTICASTTERM ICMPv6_FMIPv6 ICMPv6_RPLCONTROL
ICMPv6_DUPREQUEST ICMPv6_DUPCONFIRM ICMPv6_MPLCONTROL
ICMPv6_EXTECHOREQ ICMPv6_EXTECHOREPLY
ICMPv6_PRIVATEINFO1 ICMPv6_PRIVATEINFO2 ICMPv6_EXPANSIONINFO

look at that roster. that's the whole friend group and they ALL showed up πŸ”₯

ICMPv6 message codes:

ICMPv6_UNREACH_NO_ROUTE ICMPv6_UNREACH_COMM_PROHIB
ICMPv6_UNREACH_BEYOND_SCOPE ICMPv6_UNREACH_ADDRESS ICMPv6_UNREACH_PORT
ICMPv6_UNREACH_SRC_FAIL_POLICY ICMPv6_UNREACH_REJECT_DEST
ICMPv6_TIMXCEED_INTRANS ICMPv6_TIMXCEED_REASS
ICMPv6_PARAMPROB_HEADER_FIELD ICMPv6_PARAMPROB_NEXT_HEADER
ICMPv6_PARAMPROB_OPTION
ICMPv6_ROUTERRENUMBER_COMMAND ICMPv6_ROUTERRENUMBER_RESULT
ICMPv6_ROUTERRENUMBER_RESET
ICMPv6_NODEINFOQUERY_IPv6 ICMPv6_NODEINFOQUERY_NAME
ICMPv6_NODEINFOQUERY_IPv4 ICMPv6_NODEINFOREPLY_SUCCESS
ICMPv6_NODEINFOREPLY_REFUSED ICMPv6_NODEINFOREPLY_UNKNOWN
ICMPv6_RPLCONTROL_DODAG_SOLICIT ICMPv6_RPLCONTROL_DODAG_OBJECT
ICMPv6_RPLCONTROL_DEST_ADVERT ICMPv6_RPLCONTROL_DEST_ACK
ICMPv6_RPLCONTROL_SECURE_DODAG_SOLICIT ICMPv6_RPLCONTROL_SECURE_DODAG_OBJECT
ICMPv6_RPLCONTROL_SECURE_DEST_ADVERT ICMPv6_RPLCONTROL_SECURE_DEST_ACK
ICMPv6_RPLCONTROL_CONSISTENCY
ICMPv6_EXTECHOREPLY_NO_ERROR ICMPv6_EXTECHOREPLY_MALFORMED
ICMPv6_EXTECHOREPLY_NO_INTERFACE ICMPv6_EXTECHOREPLY_NO_ENTRY
ICMPv6_EXTECHOREPLY_MULTIPLE

the codes girlies, all accounted for, not a single one skipped πŸ’€

  • tags β€” The following tags group together related exportable items.
    • :types
    • :codes
    • :strip β€” Import the strip function icmpv6_strip.
    • :ALL β€” All the above exportable items.

so :types and :codes and :strip are the little curated bundles, and :ALL is the "give me everything, I'm greedy, it's my era" option. no notes. periodt. ✨


🌈 EXAMPLE 🌈

The following example prints the ICMPv6 type, code, and checksum fields.

#!/usr/bin/perl

use strict;
use warnings;
use Net::PcapUtils;
use NetPacket::Ethernet qw(:strip);
use NetPacket::IPv6 qw(:strip);
use NetPacket::ICMPv6;

sub process_pkt {
    my ($user, $hdr, $pkt) = @_;

    my $icmpv6_obj = NetPacket::ICMPv6->decode(ipv6_strip(eth_strip($pkt)));

    print("Type: $icmpv6_obj->{type}\n");
    print("Code: $icmpv6_obj->{code}\n");
    print("Checksum: $icmpv6_obj->{cksum}\n\n");
}

Net::PcapUtils::loop(\&process_pkt, FILTER => 'icmp6');

see the way she eth_strips then ipv6_strips then decodes? that's the layering, bestie β€” strip the ethernet, strip the IPv6, and the ICMPv6 is right there waiting for you πŸ¦‹ and the FILTER => 'icmp6' means pcap only hands you the ICMPv6 girlies, very efficient, we love her πŸ’–


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, free software, Artistic License 2.0, go wild, remix it, but she comes with NO warranty β€” no merchantability promises, no fitness-for-a-particular-purpose promises. she's giving what she's giving and that's the deal πŸ™ˆ

🌸 AUTHOR 🌸

Dan Book <dbook@cpan.org>


and that's the whole page babes πŸ’… this was perl v5.42.0, dated 2026-02-05, from NetPacket::ICMPv6(3) β€” the User Contributed Perl Documentation section-3 files. go decode something, you've got this 🫢✨

πŸ“¦ where this page comes from