1NetPacket::ICMPv6(3) User Contributed Perl Documentation NetPacket::ICMPv6(3)
2
3
4
6 NetPacket::ICMPv6 - Assemble and disassemble ICMPv6 (Internet Control
7 Message Protocol for IPv6) packets.
8
10 version 1.7.2
11
13 use NetPacket::ICMPv6;
14
15 $icmpv6_obj = NetPacket::ICMPv6->decode($raw_pkt);
16 $icmpv6_pkt = NetPacket::ICMPv6->encode($ipv6_pkt);
17 $icmpv6_data = NetPacket::ICMPv6::strip($raw_pkt);
18
20 "NetPacket::ICMPv6" provides a set of routines for assembling and
21 disassembling packets using ICMPv6 (Internet Control Message Protocol
22 for IPv6).
23
24 Methods
25 "NetPacket::ICMPv6->decode([RAW PACKET])"
26 Decode the raw packet data given and return an object containing
27 instance data. This method will quite happily decode garbage
28 input. It is the responsibility of the programmer to ensure valid
29 packet data is passed to this method.
30
31 "NetPacket::ICMPv6->encode($ipv6_obj)"
32 Return an ICMPv6 packet encoded with the instance data specified.
33 Needs parts of the IPv6 header contained in $ipv6_obj in order to
34 calculate the ICMPv6 checksum.
35
36 Functions
37 "NetPacket::ICMPv6::strip([RAW PACKET])"
38 Return the encapsulated data (or payload) contained in the ICMPv6
39 packet.
40
41 Instance data
42 The instance data for the "NetPacket::ICMPv6" object consists of the
43 following fields.
44
45 type
46 The ICMPv6 message type of this packet.
47
48 code
49 The ICMPv6 message code of this packet.
50
51 cksum
52 The checksum for this packet.
53
54 data
55 The encapsulated data (payload) for this packet.
56
57 Exports
58 default
59 none
60
61 exportable
62 ICMPv6 message types:
63
64 ICMPv6_UNREACH ICMPv6_TOOBIG ICMPv6_TIMXCEED ICMPv6_PARAMPROB
65 ICMPv6_PRIVATEERROR1 ICMPv6_PRIVATEERROR2 ICMPv6_EXPANSIONERROR
66 ICMPv6_ECHOREQ ICMPv6_ECHOREPLY ICMPv6_MULTICASTQUERY
67 ICMPv6_MULTICASTREPORT ICMPv6_MULTICASTDONE
68 ICMPv6_ROUTERSOLICIT ICMPv6_ROUTERADVERT
69 ICMPv6_NEIGHBORSOLICIT ICMPv6_NEIGHBORADVERT
70 ICMPv6_REDIRECT ICMPv6_ROUTERRENUMBER
71 ICMPv6_NODEINFOQUERY ICMPv6_NODEINFOREPLY
72 ICMPv6_INVNEIGHBORSOLICIT ICMPv6_INVNEIGHBORADVERT
73 ICMPv6_MULTICASTREPORTV2
74 ICMPv6_HOMEAGENTREQUEST ICMPv6_HOMEAGENTREPLY
75 ICMPv6_MOBILEPREFIXSOLICIT ICMPv6_MOBILEPREFIXADVERT
76 ICMPv6_CERTPATHSOLICIT ICMPv6_CERTPATHADVERT
77 ICMPv6_MULTICASTADVERT ICMPv6_MULTICASTSOLICIT
78 ICMPv6_MULTICASTTERM ICMPv6_FMIPv6 ICMPv6_RPLCONTROL
79 ICMPv6_DUPREQUEST ICMPv6_DUPCONFIRM ICMPv6_MPLCONTROL
80 ICMPv6_EXTECHOREQ ICMPv6_EXTECHOREPLY
81 ICMPv6_PRIVATEINFO1 ICMPv6_PRIVATEINFO2 ICMPv6_EXPANSIONINFO
82
83 ICMPv6 message codes:
84
85 ICMPv6_UNREACH_NO_ROUTE ICMPv6_UNREACH_COMM_PROHIB
86 ICMPv6_UNREACH_BEYOND_SCOPE ICMPv6_UNREACH_ADDRESS ICMPv6_UNREACH_PORT
87 ICMPv6_UNREACH_SRC_FAIL_POLICY ICMPv6_UNREACH_REJECT_DEST
88 ICMPv6_TIMXCEED_INTRANS ICMPv6_TIMXCEED_REASS
89 ICMPv6_PARAMPROB_HEADER_FIELD ICMPv6_PARAMPROB_NEXT_HEADER
90 ICMPv6_PARAMPROB_OPTION
91 ICMPv6_ROUTERRENUMBER_COMMAND ICMPv6_ROUTERRENUMBER_RESULT
92 ICMPv6_ROUTERRENUMBER_RESET
93 ICMPv6_NODEINFOQUERY_IPv6 ICMPv6_NODEINFOQUERY_NAME
94 ICMPv6_NODEINFOQUERY_IPv4 ICMPv6_NODEINFOREPLY_SUCCESS
95 ICMPv6_NODEINFOREPLY_REFUSED ICMPv6_NODEINFOREPLY_UNKNOWN
96 ICMPv6_RPLCONTROL_DODAG_SOLICIT ICMPv6_RPLCONTROL_DODAG_OBJECT
97 ICMPv6_RPLCONTROL_DEST_ADVERT ICMPv6_RPLCONTROL_DEST_ACK
98 ICMPv6_RPLCONTROL_SECURE_DODAG_SOLICIT ICMPv6_RPLCONTROL_SECURE_DODAG_OBJECT
99 ICMPv6_RPLCONTROL_SECURE_DEST_ADVERT ICMPv6_RPLCONTROL_SECURE_DEST_ACK
100 ICMPv6_RPLCONTROL_CONSISTENCY
101 ICMPv6_EXTECHOREPLY_NO_ERROR ICMPv6_EXTECHOREPLY_MALFORMED
102 ICMPv6_EXTECHOREPLY_NO_INTERFACE ICMPv6_EXTECHOREPLY_NO_ENTRY
103 ICMPv6_EXTECHOREPLY_MULTIPLE
104
105 tags
106 The following tags group together related exportable items.
107
108 ":types"
109 ":codes"
110 ":strip"
111 Import the strip function "icmpv6_strip".
112
113 ":ALL"
114 All the above exportable items.
115
117 The following example prints the ICMPv6 type, code, and checksum
118 fields.
119
120 #!/usr/bin/perl
121
122 use strict;
123 use warnings;
124 use Net::PcapUtils;
125 use NetPacket::Ethernet qw(:strip);
126 use NetPacket::IPv6 qw(:strip);
127 use NetPacket::ICMPv6;
128
129 sub process_pkt {
130 my ($user, $hdr, $pkt) = @_;
131
132 my $icmpv6_obj = NetPacket::ICMPv6->decode(ipv6_strip(eth_strip($pkt)));
133
134 print("Type: $icmpv6_obj->{type}\n");
135 print("Code: $icmpv6_obj->{code}\n");
136 print("Checksum: $icmpv6_obj->{cksum}\n\n");
137 }
138
139 Net::PcapUtils::loop(\&process_pkt, FILTER => 'icmp6');
140
142 Copyright (c) 2018 Dan Book.
143
144 This module is free software. You can redistribute it and/or modify it
145 under the terms of the Artistic License 2.0.
146
147 This program is distributed in the hope that it will be useful, but
148 without any warranty; without even the implied warranty of
149 merchantability or fitness for a particular purpose.
150
152 Dan Book <dbook@cpan.org>
153
154
155
156perl v5.34.0 2022-01-21 NetPacket::ICMPv6(3)