---
name: "Net::Frame::Layer::ICMPv6"
section: "3pm"
platform: "linux"
package: "libnet-frame-layer-icmpv6-perl"
version: "1.11-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Net::Frame::Layer::ICMPv6"
---

# Net::Frame::Layer::ICMPv6(3pm)

Internet Control Message Protocol v6 layer object

## NAME

Net::Frame::Layer::ICMPv6 - Internet Control Message Protocol v6 layer object

## SYNOPSIS

```
   use Net::Frame::Simple;
   use Net::Frame::Layer::ICMPv6 qw(:consts);
   my $icmp = Net::Frame::Layer::ICMPv6->new(
      type     => NF_ICMPv6_TYPE_ECHO_REQUEST,
      code     => NF_ICMPv6_CODE_ZERO,
      checksum => 0,
   );
   # Build an ICMPv6 echo-request
   use Net::Frame::Layer::ICMPv6::Echo;
   my $echo = Net::Frame::Layer::ICMPv6::Echo->new(payload => 'echo');
   my $echoReq = Net::Frame::Simple->new(layers => [ $icmp, $echo ]);
   print $echoReq->print."\n";
   # Build an ICMPv6 neighbor-solicitation
   use Net::Frame::Layer::ICMPv6::NeighborSolicitation;
   my $solicit = Net::Frame::Layer::ICMPv6::NeighborSolicitation->new(
      targetAddress => $targetIpv6Address,
   );
   $icmp->type(NF_ICMPv6_TYPE_NEIGHBORSOLICITATION);
   my $nsReq = Net::Frame::Simple->new(layers => [ $icmp, $solicit ]);
   print $nsReq->print."\n";
   #
   # Read a raw layer
   #
   my $layer = Net::Frame::Layer::ICMPv6->new(raw => $raw);
   print $layer->print."\n";
   print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
      if $layer->payload;
```

## DESCRIPTION

This modules implements the encoding and decoding of the ICMPv6 layer.

RFC: http://www.rfc-editor.org/rfc/rfc4861.txt

RFC: http://www.rfc-editor.org/rfc/rfc4389.txt

RFC: http://www.rfc-editor.org/rfc/rfc4191.txt

RFC: http://www.rfc-editor.org/rfc/rfc3775.txt

RFC: http://www.rfc-editor.org/rfc/rfc2463.txt

RFC: http://www.rfc-editor.org/rfc/rfc2461.txt

RFC: http://www.rfc-editor.org/rfc/rfc2460.txt

See also **Net::Frame::Layer** for other attributes and methods.

## ATTRIBUTES

- **type**

  - **code**

  Type and code fields. See **CONSTANTS**.

- **checksum**

  The checksum of ICMPv6 header.

The following are inherited attributes. See **Net::Frame::Layer** for more information.

- **raw**

  - **payload**

  - **nextLayer**

  ## METHODS

- **new**

  - **new** (hash)

  Object constructor. You can pass attributes that will overwrite default ones. See **SYNOPSIS** for default values.

- **computeChecksums**

  Computes the ICMPv6 checksum.

- **getKey**

  - **getKeyReverse**

  These two methods are basically used to increase the speed when using **recv** method from **Net::Frame::Simple**. Usually, you write them when you need to write **match** method.

- **match** (Net::Frame::Layer::ICMPv6 object)

  This method is mostly used internally. You pass a **Net::Frame::Layer::ICMPv6** layer as a parameter, and it returns true if this is a response corresponding for the request, or returns false if not.

The following are inherited methods. Some of them may be overridden in this layer, and some others may not be meaningful in this layer. See **Net::Frame::Layer** for more information.

- **layer**

  - **computeLengths**

  - **computeChecksums**

  - **pack**

  - **unpack**

  - **encapsulate**

  - **getLength**

  - **getPayloadLength**

  - **print**

  - **dump**

  ## CONSTANTS

Load them: use Net::Frame::Layer::ICMPv6 qw(:consts);

Various types and codes for ICMPv6 header.

- **NF\_ICMPv6\_CODE\_ZERO**

  - **NF\_ICMPv6\_TYPE\_DESTUNREACH**

  - **NF\_ICMPv6\_CODE\_NOROUTE**

  - **NF\_ICMPv6\_CODE\_ADMINPROHIBITED**

  - **NF\_ICMPv6\_CODE\_NOTASSIGNED**

  - **NF\_ICMPv6\_CODE\_ADDRESSUNREACH**

  - **NF\_ICMPv6\_CODE\_PORTUNREACH**

  - **NF\_ICMPv6\_CODE\_FAILPOLICY**

  - **NF\_ICMPv6\_CODE\_REJECTROUTE**

  - **NF\_ICMPv6\_TYPE\_TOOBIG**

  - **NF\_ICMPv6\_TYPE\_TIMEEXCEED**

  - **NF\_ICMPv6\_CODE\_HOPLIMITEXCEED**

  - **NF\_ICMPv6\_CODE\_FRAGREASSEMBLYEXCEEDED**

  - **NF\_ICMPv6\_TYPE\_PARAMETERPROBLEM**

  - **NF\_ICMPv6\_CODE\_ERRONEOUSHERDERFIELD**

  - **NF\_ICMPv6\_CODE\_UNKNOWNNEXTHEADER**

  - **NF\_ICMPv6\_CODE\_UNKNOWNOPTION**

  - **NF\_ICMPv6\_TYPE\_ECHO\_REQUEST**

  - **NF\_ICMPv6\_TYPE\_ECHO\_REPLY**

  - **NF\_ICMPv6\_TYPE\_MLDQUERY**

  - **NF\_ICMPv6\_TYPE\_MLDREPORTv1**

  - **NF\_ICMPv6\_TYPE\_MLDDONE**

  - **NF\_ICMPv6\_TYPE\_ROUTERSOLICITATION**

  - **NF\_ICMPv6\_TYPE\_ROUTERADVERTISEMENT**

  - **NF\_ICMPv6\_TYPE\_NEIGHBORSOLICITATION**

  - **NF\_ICMPv6\_TYPE\_NEIGHBORADVERTISEMENT**

  - **NF\_ICMPv6\_TYPE\_MLDREPORTv2**

  - **NF\_ICMPv6\_OPTION\_SOURCELINKLAYERADDRESS**

  - **NF\_ICMPv6\_OPTION\_TARGETLINKLAYERADDRESS**

  - **NF\_ICMPv6\_OPTION\_PREFIXINFORMATION**

  - **NF\_ICMPv6\_OPTION\_REDIRECTEDHEADER**

  - **NF\_ICMPv6\_OPTION\_MTU**

  Various flags for some ICMPv6 messages.

- **NF\_ICMPv6\_FLAG\_ROUTER**

  - **NF\_ICMPv6\_FLAG\_SOLICITED**

  - **NF\_ICMPv6\_FLAG\_OVERRIDE**

  - **NF\_ICMPv6\_FLAG\_MANAGEDADDRESSCONFIGURATION**

  - **NF\_ICMPv6\_FLAG\_OTHERCONFIGURATION**

  - **NF\_ICMPv6\_FLAG\_MOBILEIPv6HOMEAGENT**

  - **NF\_ICMPv6\_FLAG\_ROUTERSELECTIONPREFHIGH**

  - **NF\_ICMPv6\_FLAG\_ROUTERSELECTIONPREFMEDIUM**

  - **NF\_ICMPv6\_FLAG\_ROUTERSELECTIONPREFLOW**

  - **NF\_ICMPv6\_FLAG\_ROUTERSELECTIONPREFRESERVED**

  - **NF\_ICMPv6\_FLAG\_NEIGHBORDISCOVERYPROXY**

  ## SEE ALSO

Net::Frame::Layer

## AUTHOR

Patrice \<GomoR\> Auffret

## COPYRIGHT AND LICENSE

Copyright (c) 2006-2019, Patrice \<GomoR\> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.
