NAME
NetPacket::ICMPv6 - Assemble and disassemble ICMPv6 (Internet Control Message Protocol for IPv6) packets.
VERSION
version 1.7.2
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);
DESCRIPTION
NetPacket::ICMPv6
provides a set of routines for assembling and disassembling packets using ICMPv6 (Internet Control Message Protocol for IPv6).
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.
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.
Functions
NetPacket::ICMPv6::strip([RAW PACKET])
-
Return the encapsulated data (or payload) contained in the ICMPv6 packet.
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.
Exports
- default
-
none
- 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
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 following tags group together related exportable items.
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');
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.
AUTHOR
Dan Book <dbook@cpan.org>