.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "NetPacket::IPv6 3pm" .TH NetPacket::IPv6 3pm "2019-01-05" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" NetPacket::IPv6 \- Assemble and disassemble IPv6 (Internet Protocol version 6) packets. .SH "VERSION" .IX Header "VERSION" version 1.7.0 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use NetPacket::IPv6; \& \& $ip_obj = NetPacket::IPv6\->decode($raw_pkt); \& $ip_pkt = NetPacket::IPv6\->encode($ip_obj); \& $ip_data = NetPacket::IPv6::strip($raw_pkt); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`NetPacket::IPv6\*(C'\fR provides a set of routines for assembling and disassembling packets using IPv6 (Internet Protocol version 6). .SS "Methods" .IX Subsection "Methods" .ie n .IP """NetPacket::IPv6\->decode([RAW PACKET])""" 4 .el .IP "\f(CWNetPacket::IPv6\->decode([RAW PACKET])\fR" 4 .IX Item "NetPacket::IPv6->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. .ie n .IP """NetPacket::IPv6\->encode()""" 4 .el .IP "\f(CWNetPacket::IPv6\->encode()\fR" 4 .IX Item "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. .ie n .IP """NetPacket::IPv6\->pseudo_header([PACKET LENGTH], [PROTOCOL])""" 4 .el .IP "\f(CWNetPacket::IPv6\->pseudo_header([PACKET LENGTH], [PROTOCOL])\fR" 4 .IX Item "NetPacket::IPv6->pseudo_header([PACKET LENGTH], [PROTOCOL])" Return an IPv6 \*(L"pseudo-header\*(R" suitable for computing checksums for certain upper-level protocols. .SS "Functions" .IX Subsection "Functions" .ie n .IP """NetPacket::IPv6::strip([RAW PACKET])""" 4 .el .IP "\f(CWNetPacket::IPv6::strip([RAW PACKET])\fR" 4 .IX Item "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 \&\f(CW\*(C`NetPacket::*\*(C'\fR modules. .Sp This function is equivalent to creating an object using the \&\f(CW\*(C`decode()\*(C'\fR constructor and returning the \f(CW\*(C`data\*(C'\fR field of that object. .ie n .IP """NetPacket::IPv6::ipv6_extheader([TYPE])""" 4 .el .IP "\f(CWNetPacket::IPv6::ipv6_extheader([TYPE])\fR" 4 .IX Item "NetPacket::IPv6::ipv6_extheader([TYPE])" Return whether the \s-1IP\s0 protocol type is an IPv6 extension header. .SS "Instance data" .IX Subsection "Instance data" The instance data for the \f(CW\*(C`NetPacket::IPv6\*(C'\fR object consists of the following fields. .IP "ver" 4 .IX Item "ver" The \s-1IP\s0 version number of this packet. .IP "traffic_class" 4 .IX Item "traffic_class" The traffic class of this packet, equivalent to the type-of-service field for IPv4. .IP "flow_label" 4 .IX Item "flow_label" The flow label of this packet. .IP "len" 4 .IX Item "len" The payload length (including any extension headers) in bytes for this packet. .IP "proto" 4 .IX Item "proto" The \s-1IP\s0 protocol number for this packet. .IP "hop_limit" 4 .IX Item "hop_limit" The hop limit for this packet, equivalent to the time-to-live field for IPv4. .IP "src_ip" 4 .IX Item "src_ip" The source \s-1IP\s0 address for this packet in colon-separated hextet notation. .IP "dest_ip" 4 .IX Item "dest_ip" The destination \s-1IP\s0 address for this packet in colon-separated hextet notation. .IP "extheaders" 4 .IX Item "extheaders" Array of any extension headers for this packet, as a hashref containing the fields described below. An \s-1ESP\s0 (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 of 50 (\f(CW\*(C`IPv6_EXTHEADER_ESP\*(C'\fR). .IP "data" 4 .IX Item "data" The encapsulated data (payload) for this IPv6 packet. .PP Extension headers may contain the following fields. .IP "type" 4 .IX Item "type" The extension header type number. .IP "len" 4 .IX Item "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.) .IP "data" 4 .IX Item "data" The remaining contents of the extension header following the next-header and length bytes. .SS "Exports" .IX Subsection "Exports" .IP "default" 4 .IX Item "default" none .IP "tags" 4 .IX Item "tags" The following tags group together related exportable items. .RS 4 .ie n .IP """:protos""" 4 .el .IP "\f(CW:protos\fR" 4 .IX Item ":protos" .PD 0 .ie n .IP """:tos""" 4 .el .IP "\f(CW:tos\fR" 4 .IX Item ":tos" .ie n .IP """:misc""" 4 .el .IP "\f(CW:misc\fR" 4 .IX Item ":misc" .PD Re-exported from NetPacket::IP for convenience. .ie n .IP """:extheaders""" 4 .el .IP "\f(CW:extheaders\fR" 4 .IX Item ":extheaders" IPv6_EXTHEADER_HOPBYHOP IPv6_EXTHEADER_ROUTING IPv6_EXTHEADER_FRAGMENT IPv6_EXTHEADER_ESP IPv6_EXTHEADER_AUTH IPv6_EXTHEADER_NONEXT IPv6_EXTHEADER_DESTOPT IPv6_EXTHEADER_MOBILITY IPv6_EXTHEADER_HOSTIDENT IPv6_EXTHEADER_SHIM6 IPv6_EXTHEADER_TESTING1 IPv6_EXTHEADER_TESTING2 .ie n .IP """:versions""" 4 .el .IP "\f(CW:versions\fR" 4 .IX Item ":versions" IP_VERSION_IPv6 .ie n .IP """:strip""" 4 .el .IP "\f(CW:strip\fR" 4 .IX Item ":strip" Import the strip function \f(CW\*(C`ipv6_strip\*(C'\fR. .ie n .IP """:ALL""" 4 .el .IP "\f(CW:ALL\fR" 4 .IX Item ":ALL" All the above exportable items. .RE .RS 4 .RE .SH "EXAMPLE" .IX Header "EXAMPLE" The following script dumps IPv6 frames by \s-1IP\s0 address and protocol to standard output. .PP .Vb 1 \& #!/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}\en"); \& } \& \& Net::PcapUtils::loop(\e&process_pkt, FILTER => \*(Aqip6\*(Aq); .Ve .SH "TODO" .IX Header "TODO" .IP "More specific keys for well-defined extension headers." 4 .IX Item "More specific keys for well-defined extension headers." .PD 0 .IP "Parse routing extension headers to correctly compute upper-level checksums." 4 .IX Item "Parse routing extension headers to correctly compute upper-level checksums." .PD .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2018 Dan Book. .PP This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. .PP 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. .SH "AUTHOR" .IX Header "AUTHOR" Dan Book