ICMPv6 - Internet Control Message Protocol for IPv6

pcapkit.protocols.internet.icmpv6.protocol contains ICMPv6 only, which implements the extractor for Internet Control Message Protocol for IPv6 (ICMPv6) [*], whose structure is:

Octets

Bits

Name

Description

0

0

icmpv6.type

Type

1

8

icmpv6.code

Code

2

16

icmpv6.checksum

Checksum

4

32

icmpv6.data

Message Body

Added in version 1.6.0.

class pcapkit.protocols.internet.icmpv6.protocol.ICMPv6(file, length=None, /, *, version=None, layer=None, protocol=None, context=None)[source]

Bases: ICMP[ICMPv6, ICMPv6]

This class implements Internet Control Message Protocol for IPv6.

This class parses the following ICMPv6 message types, which are registered in the self.__type__ attribute:

Any other type is kept as its raw message body, see _read_data_type_none() and _make_data_type_none().

The Neighbor Discovery messages (RFC 4861 Section 4) end in options, whose parsers are registered in the self.__option__ attribute:

Any other option is kept as its raw data, see _read_opt_none() and _make_opt_none().

Changed in version 1.6.0: The checksum is computed when make() is given none, over the pseudo it is given or by the enclosing IPv6 layer, and verified by that layer under CHECKSUM_VERIFY (#2470).

Changed in version 1.7.0: Decodes Multicast Listener Discovery, MLDv1 (RFC 2710) and MLDv2 (RFC 9777).

Changed in version 1.9.0: Decodes Neighbor Discovery (RFC 4861) and its options.

Defaults

__type__: DefaultDict[Type | int, str | tuple[Callable[[ICMPv6Type, ICMPv6, int], ICMPv6], Callable[[Type, ICMPv6 | None, Any], ICMPv6Type]]]

Type code to method mapping. A str value names the methods _read_data_type_${name} and _make_data_type_${name}, falling back to _read_data_type_none / _make_data_type_none when they do not exist; any other value is a (parser, constructor) pair of callables.

__option__: DefaultDict[NDOption | int, str | tuple[Callable[[NDOption, OrderedMultiDict[NDOption, NDOption]], NDOption], Callable[[NDOption, NDOption | None, Any], NDOption]]]

Neighbor Discovery option type to method mapping. A str value names the methods _read_opt_${name} and _make_opt_${name}, falling back to _read_opt_none / _make_opt_none when they do not exist; any other value is a (parser, constructor) pair of callables.

Properties

property name: Literal['Internet Control Message Protocol for IPv6']

Name of current protocol.

property alias: Literal['ICMPv6']

Acronym of corresponding protocol.

property length: int

Header length of current protocol.

Methods

classmethod id()[source]

Index ID of the protocol.

Return type:

tuple[Literal['ICMPv6']]

Returns:

Index ID of the protocol.

read(length=None, *, __packet__=None, **kwargs)[source]

Read Internet Control Message Protocol for IPv6 (ICMPv6).

Structure of ICMPv6 header [RFC 4443]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                         Message Body                         +
|                                                               |
Parameters:
  • length (int | None) – Length of packet data.

  • __packet__ (dict[str, Any] | None) – Optional packet data, unused.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

ICMPv6

Returns:

Parsed packet data.

make(*, type=Type.Echo_Request, code=0, checksum=None, body=b'\x00\x00\x00\x00', pseudo=None, **kwargs)[source]

Make (construct) packet data.

Parameters:
  • type (Type | int) – ICMPv6 type.

  • code (int) – ICMPv6 code; meaning is entirely type-dependent.

  • checksum (bytes | None) – Checksum; if None and CHECKSUM_COMPUTE is on, computed over pseudo (RFC 4443 Section 2.3), or left to an IPv6 layer this message is the payload of; zero otherwise.

  • body (bytes | ICMPv6 | ICMPv6Type | dict[str, Any]) – Message body. bytes is parsed against type’s own schema; a dict or a ICMPv6 data model is handed to that type’s own constructor method (see __type__); any other ICMPv6Type is used as is.

  • pseudo (IP_Pseudo | None) – Pseudo-header of the enclosing IPv6 layer; its length is replaced by this message’s own.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

ICMPv6

Returns:

Constructed packet data.

Raises:

ProtocolError – If type is a name, a bool, or a member or code that does not fit in one octet; if body is bytes that do not parse as the message body of type, or is of none of the accepted types; or if checksum is not two octets.

classmethod register_type(code, meth)[source]

Register a message body parser.

Parameters:
Warns:

RegistryWarning – If a different entry is already registered for code; it is overwritten.

classmethod register_option(code, meth)[source]

Register a Neighbor Discovery option parser.

Parameters:
Warns:

RegistryWarning – If a different entry is already registered for code; it is overwritten.

Added in version 1.9.0.

Data Models

__length_hint__()[source]

Return an estimated length for the object.

Return type:

Literal[4]

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type:

TransType

Returns:

Numeral registry index of the protocol in IANA.

Utilities

classmethod _make_data(data)[source]

Create key-value pairs from data for protocol construction.

Parameters:

data (ICMPv6) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

_read_data_type_none(schema, *, header, length)[source]

Read ICMPv6 message of unknown type.

Parameters:
  • schema (Unknown) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

Unknown

Returns:

Parsed message data.

_read_data_type_destination_unreachable(schema, *, header, length)[source]

Read ICMPv6 Destination Unreachable message.

Structure of ICMPv6 Destination Unreachable message [RFC 4443]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             Unused                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    As much of invoking packet                |
|                   as will fit without the ICMPv6             |
|                   packet exceeding the minimum IPv6 MTU      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • schema (DestinationUnreachable) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

DestinationUnreachable

Returns:

Parsed message data.

_read_data_type_packet_too_big(schema, *, header, length)[source]

Read ICMPv6 Packet Too Big message.

Structure of ICMPv6 Packet Too Big message [RFC 4443]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             MTU                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    As much of invoking packet                |
|                   as will fit without the ICMPv6             |
|                   packet exceeding the minimum IPv6 MTU      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • schema (PacketTooBig) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

PacketTooBig

Returns:

Parsed message data.

_read_data_type_time_exceeded(schema, *, header, length)[source]

Read ICMPv6 Time Exceeded message.

Structure of ICMPv6 Time Exceeded message [RFC 4443] is identical to that of _read_data_type_destination_unreachable(), but for the type code.

Parameters:
  • schema (TimeExceeded) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

TimeExceeded

Returns:

Parsed message data.

_read_data_type_parameter_problem(schema, *, header, length)[source]

Read ICMPv6 Parameter Problem message.

Structure of ICMPv6 Parameter Problem message [RFC 4443]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Pointer                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    As much of invoking packet                |
|                   as will fit without the ICMPv6             |
|                   packet exceeding the minimum IPv6 MTU      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • schema (ParameterProblem) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

ParameterProblem

Returns:

Parsed message data.

_read_data_type_echo(schema, *, header, length)[source]

Read ICMPv6 Echo Request/Reply message.

Structure of ICMPv6 Echo Request/Reply message [RFC 4443]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Identifier          |        Sequence Number        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                             Data                              +
|                                                               |
Parameters:
  • schema (Echo) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

Echo

Returns:

Parsed message data.

_read_data_type_mld_query(schema, *, header, length)[source]

Read MLD Multicast Listener Query message.

Structure of MLDv2 Multicast Listener Query message [RFC 9777], whose first 24 octets are the whole of an MLDv1 Query [RFC 2710]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Type = 130   |      Code     |           Checksum            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Maximum Response Code      |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                       Multicast Address                       *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags |S| QRV |     QQIC      |     Number of Sources (N)     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                       Source Address [1..N]                   *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

A Query of 28 or more octets is MLDv2’s, and one of fewer MLDv1’s (RFC 9777 Section 8.1), see mldv2_query_present().

Parameters:
  • schema (MLDQuery) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Returns:

MLDv1’s or MLDv2’s.

Return type:

MLDv1 | MLDv2Query

_read_data_type_mldv1(schema, *, header, length)[source]

Read MLDv1 Multicast Listener Report/Done message.

Structure of MLDv1 message [RFC 2710]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Maximum Response Delay    |          Reserved             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                       Multicast Address                       +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • schema (MLDv1) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

MLDv1

Returns:

Parsed message data.

_read_data_type_router_solicitation(schema, *, header, length)[source]

Read Neighbor Discovery Router Solicitation message.

Structure of Router Solicitation message [RFC 4861 Section 4.1]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Reserved                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Options ...
+-+-+-+-+-+-+-+-+-+-+-+-
Parameters:
  • schema (RouterSolicitation) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

RouterSolicitation

Returns:

Parsed message data.

_read_data_type_router_advertisement(schema, *, header, length)[source]

Read Neighbor Discovery Router Advertisement message.

Structure of Router Advertisement message [RFC 4861 Section 4.2], its flags as IANA’s Router Advertisement Flags assigns them [RFC 5175 Section 3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cur Hop Limit |M|O|H|Prf|P|S|R|       Router Lifetime         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Reachable Time                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Retrans Timer                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Options ...
+-+-+-+-+-+-+-+-+-+-+-+-
Parameters:
  • schema (RouterAdvertisement) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

RouterAdvertisement

Returns:

Parsed message data.

_read_data_type_neighbor_solicitation(schema, *, header, length)[source]

Read Neighbor Discovery Neighbor Solicitation message.

Structure of Neighbor Solicitation message [RFC 4861 Section 4.3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Reserved                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                       Target Address                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Options ...
+-+-+-+-+-+-+-+-+-+-+-+-
Parameters:
  • schema (NeighborSolicitation) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

NeighborSolicitation

Returns:

Parsed message data.

_read_data_type_neighbor_advertisement(schema, *, header, length)[source]

Read Neighbor Discovery Neighbor Advertisement message.

Structure of Neighbor Advertisement message [RFC 4861 Section 4.4]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|R|S|O|                     Reserved                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                       Target Address                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Options ...
+-+-+-+-+-+-+-+-+-+-+-+-
Parameters:
  • schema (NeighborAdvertisement) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

NeighborAdvertisement

Returns:

Parsed message data.

_read_data_type_redirect(schema, *, header, length)[source]

Read Neighbor Discovery Redirect message.

Structure of Redirect message [RFC 4861 Section 4.5]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Code      |          Checksum             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Reserved                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                       Target Address                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                     Destination Address                       +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Options ...
+-+-+-+-+-+-+-+-+-+-+-+-
Parameters:
  • schema (Redirect) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

Redirect

Returns:

Parsed message data.

_read_data_type_mldv2_report(schema, *, header, length)[source]

Read MLDv2 Version 2 Multicast Listener Report message.

Structure of MLDv2 Report message [RFC 9777]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Type = 143   |    Reserved   |           Checksum            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Flags             |Nr of Mcast Address Records (M)|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                  Multicast Address Record [1..M]              .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Each record has the shape of an IGMPv3 group record (RFC 3376 Section 4.2.4), with IPv6 addresses:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Record Type  |  Aux Data Len |     Number of Sources (N)     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                       Multicast Address                       *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                       Source Address [1..N]                   *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                         Auxiliary Data                        .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • schema (MLDv2Report) – parsed message body schema

  • header (ICMPv6) – parsed ICMPv6 header schema

  • length (int) – total length of the current ICMPv6 message

Return type:

MLDv2Report

Returns:

Parsed message data.

_read_opt_none(schema, *, options)[source]

Read ND option of a type not decoded.

Structure of ND option [RFC 4861 Section 4.6]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |              ...              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                              ...                              ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

UnknownOption

Returns:

Parsed option data.

Read ND Source or Target Link-layer Address option.

Structure of Link-layer Address option [RFC 4861 Section 4.6.1]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |    Link-Layer Address ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

LinkLayerAddressOption

Returns:

Parsed option data.

_read_opt_prefix_information(schema, *, options)[source]

Read ND Prefix Information option.

Structure of Prefix Information option [RFC 4861 Section 4.6.2], its flags as IANA’s Prefix Information Option Flags assigns them [RFC 8425]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     | Prefix Length |L|A|R|P| Rsvd1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Valid Lifetime                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       Preferred Lifetime                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Reserved2                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                            Prefix                             +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

PrefixInformationOption

Returns:

Parsed option data.

_read_opt_redirected_header(schema, *, options)[source]

Read ND Redirected Header option.

Structure of Redirected Header option [RFC 4861 Section 4.6.3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |            Reserved           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Reserved                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
~                       IP header + data                        ~
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

RedirectedHeaderOption

Returns:

Parsed option data.

_read_opt_mtu(schema, *, options)[source]

Read ND MTU option.

Structure of MTU option [RFC 4861 Section 4.6.4]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              MTU                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

MTUOption

Returns:

Parsed option data.

_read_opt_advertisement_interval(schema, *, options)[source]

Read ND Advertisement Interval option.

Structure of Advertisement Interval option [RFC 6275 Section 7.3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Advertisement Interval                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

AdvertisementIntervalOption

Returns:

Parsed option data.

_read_opt_home_agent_information(schema, *, options)[source]

Read ND Home Agent Information option.

Structure of Home Agent Information option [RFC 6275 Section 7.4]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Home Agent Preference     |      Home Agent Lifetime      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

HomeAgentInformationOption

Returns:

Parsed option data.

_read_opt_nonce(schema, *, options)[source]

Read ND Nonce option.

Structure of Nonce option [RFC 3971 Section 5.3.2]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |  Nonce ...                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
|                                                               |
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

NonceOption

Returns:

Parsed option data.

_read_opt_route_information(schema, *, options)[source]

Read ND Route Information option.

Structure of Route Information option [RFC 4191 Section 2.3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     | Prefix Length |Resvd|Prf|Resvd|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Route Lifetime                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   Prefix (Variable Length)                    |
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

RouteInformationOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the Length is above 3, leaving more of the prefix than an IPv6 address holds.

_read_opt_rdnss(schema, *, options)[source]

Read ND Recursive DNS Server option.

Structure of RDNSS option [RFC 8106 Section 5.1]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Length    |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Lifetime                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
:            Addresses of IPv6 Recursive DNS Servers            :
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

RDNSSOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the Length is below 3 or even, the minimum and the parity the receiver checks (RFC 8106 Section 5.3.1).

_read_opt_ra_flags_extension(schema, *, options)[source]

Read ND RA Flags Extension option.

Structure of RA Flags Extension option [RFC 5175 Section 4]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |         Bit fields available ..
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
... for assignment                                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

RAFlagsExtensionOption

Returns:

Parsed option data.

_read_opt_dnssl(schema, *, options)[source]

Read ND DNS Search List option.

Structure of DNSSL option [RFC 8106 Section 5.2]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Length    |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           Lifetime                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
:                Domain Names of DNS Search List                :
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The names are read uncompressed, as RFC 1035 Section 3.1 lays them out, up to the first zero octet that starts none: the zero padding RFC 8106 Section 5.2 ends the field with.

Parameters:
Return type:

DNSSLOption

Returns:

Parsed option data.

Raises:

ProtocolError – If the Length is below 2, the minimum the receiver checks (RFC 8106 Section 5.3.1), or a name runs past the field, or holds a label type other than a plain label.

_read_opt_captive_portal(schema, *, options)[source]

Read ND Captive-Portal option.

Structure of Captive-Portal option [RFC 8910 Section 2.3]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |     Length    |              URI              .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The URI is the octets ahead of the first NUL, the NUL padding the rest, since RFC 8910 Section 2.3 does not have the URI NUL-terminated.

Parameters:
Return type:

CaptivePortalOption

Returns:

Parsed option data.

_read_opt_pref64(schema, *, options)[source]

Read ND PREF64 option.

Structure of PREF64 option [RFC 8781 Section 4]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     Scaled Lifetime     | PLC |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|              Highest 96 bits of the Prefix                    |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
Return type:

PREF64Option

Returns:

Parsed option data.

_make_data_type_none(type, message=None, *, data=b'', **kwargs)[source]

Make ICMPv6 message of unknown type.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (Unknown | None) – message data.

  • data (bytes) – raw message body as bytes.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

Unknown

Returns:

Constructed message body schema.

_make_data_type_destination_unreachable(type, message=None, *, unused=b'\x00\x00\x00\x00', data=b'', **kwargs)[source]

Make ICMPv6 Destination Unreachable message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (DestinationUnreachable | None) – message data.

  • unused (bytes) – the four unused octets.

  • data (bytes) – as much of the invoking packet as fits the minimum IPv6 MTU.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

DestinationUnreachable

Returns:

Constructed message body schema.

Raises:

ProtocolError – If unused is not four octets.

_make_data_type_packet_too_big(type, message=None, *, mtu=0, data=b'', **kwargs)[source]

Make ICMPv6 Packet Too Big message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (PacketTooBig | None) – message data.

  • mtu (int) – MTU of the link that could not forward the invoking packet.

  • data (bytes) – as much of the invoking packet as fits the minimum IPv6 MTU.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

PacketTooBig

Returns:

Constructed message body schema.

_make_data_type_time_exceeded(type, message=None, *, unused=b'\x00\x00\x00\x00', data=b'', **kwargs)[source]

Make ICMPv6 Time Exceeded message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (TimeExceeded | None) – message data.

  • unused (bytes) – the four unused octets.

  • data (bytes) – as much of the invoking packet as fits the minimum IPv6 MTU.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

TimeExceeded

Returns:

Constructed message body schema.

Raises:

ProtocolError – If unused is not four octets.

_make_data_type_parameter_problem(type, message=None, *, pointer=0, data=b'', **kwargs)[source]

Make ICMPv6 Parameter Problem message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (ParameterProblem | None) – message data.

  • pointer (int) – pointer to the octet offset within the invoking packet where the error was detected.

  • data (bytes) – as much of the invoking packet as fits the minimum IPv6 MTU.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

ParameterProblem

Returns:

Constructed message body schema.

_make_data_type_echo(type, message=None, *, id=0, seq=0, data=b'', **kwargs)[source]

Make ICMPv6 Echo Request/Reply message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (Echo | None) – message data.

  • id (int) – identifier.

  • seq (int) – sequence number.

  • data (bytes) – data, echoed back verbatim by a reply to the same identifier and sequence number.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

Echo

Returns:

Constructed message body schema.

_make_data_type_mld_query(type, message=None, *, version=None, max_resp_code=None, max_resp_delay=0, reserved=b'\x00\x00', multicast_address='::', flags=None, s_flag=None, qrv=None, qqic=None, qqi=None, num_sources=None, sources=None, data=b'', **kwargs)[source]

Make MLD Multicast Listener Query message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (MLDv1 | MLDv2Query | None) – message data, whose version picks the version built.

  • version (int | None) – MLD version, 1 (RFC 2710) or 2 (RFC 9777), which type 130 is shared by; no field picks it.

  • max_resp_code (int | None) – MLDv2’s Maximum Response Code, as on the wire; encoded from max_resp_delay when not given.

  • max_resp_delay (int) – Maximum Response Delay, in milliseconds; MLDv1’s field, or what MLDv2’s max_resp_code encodes.

  • reserved (bytes) – the two reserved octets.

  • multicast_address (IPv6Address | str | bytes | int) – multicast address queried, :: for a General Query.

  • flags (int | None) – MLDv2’s four flag bits, zero when not given.

  • s_flag (bool | None) – MLDv2’s Suppress Router-Side Processing flag, clear when not given.

  • qrv (int | None) – MLDv2’s Querier’s Robustness Variable, zero when not given.

  • qqic (int | None) – MLDv2’s Querier’s Query Interval Code, as on the wire; encoded from qqi when not given.

  • qqi (int | None) – MLDv2’s Querier’s Query Interval, in seconds.

  • num_sources (int | None) – MLDv2’s number of sources, the length of sources when not given; a count above it is written as given, as on a Query the capture cut inside its sources.

  • sources (Iterable[IPv6Address | str | bytes | int] | None) – MLDv2’s source addresses.

  • data (bytes) – octets past the fields of the version built; fewer than four for MLDv1, since a Query of 28 or more octets is MLDv2’s.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

MLDQuery

Returns:

Constructed message body schema.

Raises:

ProtocolError – If version is neither 1 nor 2; if an MLDv1 Query is given a field only MLDv2 takes, or four or more octets of data; if a field does not fit its width, or num_sources is below the length of sources; or if reserved is not two octets.

_make_data_type_mldv1(type, message=None, *, max_resp_delay=0, reserved=b'\x00\x00', multicast_address='::', data=b'', **kwargs)[source]

Make MLDv1 Multicast Listener Report/Done message.

Parameters:
  • type (Type) – ICMPv6 type.

  • message (MLDv1 | None) – message data.

  • max_resp_delay (int) – Maximum Response Delay, in milliseconds; zero on a conformant sender.

  • reserved (bytes) – the two reserved octets.

  • multicast_address (IPv6Address | str | bytes | int) – multicast address reported or left.

  • data (bytes) – octets past the 24 RFC 2710 Section 3 defines.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

MLDv1

Returns:

Constructed message body schema.

Raises:

ProtocolError – If max_resp_delay does not fit 16 bits, or reserved is not two octets.

_make_data_type_router_solicitation(type, message=None, *, reserved=b'\x00\x00\x00\x00', options=None, **kwargs)[source]

Make Neighbor Discovery Router Solicitation message.

Parameters:
Return type:

RouterSolicitation

Returns:

Constructed message body schema.

Raises:

ProtocolError – If reserved is not four octets, or an option is refused, see _make_nd_options().

_make_data_type_router_advertisement(type, message=None, *, cur_hop_limit=0, m_flag=False, o_flag=False, h_flag=False, prf=RouterPreference.Medium, p_flag=False, s_flag=False, reserved=0, router_lifetime=0, reachable_time=0, retrans_timer=0, options=None, **kwargs)[source]

Make Neighbor Discovery Router Advertisement message.

Parameters:
Return type:

RouterAdvertisement

Returns:

Constructed message body schema.

Raises:

ProtocolError – If a field does not fit its width, prf is a name, or an option is refused, see _make_nd_options().

_make_data_type_neighbor_solicitation(type, message=None, *, reserved=b'\x00\x00\x00\x00', target_address='::', options=None, **kwargs)[source]

Make Neighbor Discovery Neighbor Solicitation message.

Parameters:
Return type:

NeighborSolicitation

Returns:

Constructed message body schema.

Raises:

ProtocolError – If reserved is not four octets, or an option is refused, see _make_nd_options().

_make_data_type_neighbor_advertisement(type, message=None, *, r_flag=False, s_flag=False, o_flag=False, reserved=0, target_address='::', options=None, **kwargs)[source]

Make Neighbor Discovery Neighbor Advertisement message.

Parameters:
Return type:

NeighborAdvertisement

Returns:

Constructed message body schema.

Raises:

ProtocolError – If a flag or reserved does not fit its width, or an option is refused, see _make_nd_options().

_make_data_type_redirect(type, message=None, *, reserved=b'\x00\x00\x00\x00', target_address='::', destination_address='::', options=None, **kwargs)[source]

Make Neighbor Discovery Redirect message.

Parameters:
Return type:

Redirect

Returns:

Constructed message body schema.

Raises:

ProtocolError – If reserved is not four octets, or an option is refused, see _make_nd_options().

_make_data_type_mldv2_report(type, message=None, *, flags=0, num_records=None, records=None, data=b'', **kwargs)[source]

Make MLDv2 Version 2 Multicast Listener Report message.

Parameters:
Return type:

MLDv2Report

Returns:

Constructed message body schema.

Raises:

ProtocolError – If flags does not fit 16 bits, num_records is not an int from the length of records to 65535, or a record is refused, see _make_address_record().

_make_opt_none(type, option=None, *, data=b'\x00\x00\x00\x00\x00\x00', **kwargs)[source]

Make ND option of a type not decoded.

It also writes back an option of any type the capture cut before its Length, which _read_nd_options() reads as this one’s with the Length of zero the cut left: the rebuild is cut back to its type.

Parameters:
  • type (NDOption) – option type.

  • option (UnknownOption | None) – option data.

  • data (bytes) – option data, after the type and length.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

UnknownOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If data is not bytes, or the option it makes is no whole number of 8-octet units up to 255.

Make ND Source or Target Link-layer Address option.

Parameters:
Return type:

LinkLayerAddressOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If link_layer_address is not bytes, or the option it makes is no whole number of 8-octet units up to 255.

_make_opt_prefix_information(type, option=None, *, prefix_length=0, l_flag=False, a_flag=False, r_flag=False, p_flag=False, reserved1=0, valid_lifetime=0, preferred_lifetime=0, reserved2=b'\x00\x00\x00\x00', prefix='::', **kwargs)[source]

Make ND Prefix Information option.

Parameters:
  • type (NDOption) – option type.

  • option (PrefixInformationOption | None) – option data.

  • prefix_length (int) – prefix length, in bits.

  • l_flag (bool) – On-link flag.

  • a_flag (bool) – Autonomous Address Configuration flag.

  • r_flag (bool) – Router Address flag.

  • p_flag (bool) – DHCPv6-PD Preferred flag.

  • reserved1 (int) – the flags octet’s low-order 4 bits.

  • valid_lifetime (int) – valid lifetime, in seconds.

  • preferred_lifetime (int) – preferred lifetime, in seconds.

  • reserved2 (bytes) – the four Reserved2 octets.

  • prefix (IPv6Address | str | bytes | int) – prefix.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

PrefixInformationOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If a field does not fit its width, or reserved2 is not four octets.

_make_opt_redirected_header(type, option=None, *, reserved=b'\x00\x00\x00\x00\x00\x00', data=b'', **kwargs)[source]

Make ND Redirected Header option.

Parameters:
  • type (NDOption) – option type.

  • option (RedirectedHeaderOption | None) – option data.

  • reserved (bytes) – the six reserved octets.

  • data (bytes) – as much of the redirected packet, from its IP header, as fits.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

RedirectedHeaderOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not six octets, data is not bytes, or the option it makes is no whole number of 8-octet units up to 255.

_make_opt_mtu(type, option=None, *, reserved=b'\x00\x00', mtu=1280, **kwargs)[source]

Make ND MTU option.

Parameters:
  • type (NDOption) – option type.

  • option (MTUOption | None) – option data.

  • reserved (bytes) – the two reserved octets.

  • mtu (int) – recommended MTU of the link; the IPv6 minimum link MTU (RFC 8200 Section 5) when not given.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

MTUOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not two octets, or mtu does not fit 32 bits.

_make_opt_advertisement_interval(type, option=None, *, reserved=b'\x00\x00', interval=0, **kwargs)[source]

Make ND Advertisement Interval option.

Parameters:
  • type (NDOption) – option type.

  • option (AdvertisementIntervalOption | None) – option data.

  • reserved (bytes) – the two reserved octets.

  • interval (int) – largest time between unsolicited Router Advertisements, in milliseconds.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

AdvertisementIntervalOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not two octets, or interval does not fit 32 bits.

_make_opt_home_agent_information(type, option=None, *, reserved=b'\x00\x00', preference=0, lifetime=0, **kwargs)[source]

Make ND Home Agent Information option.

Parameters:
  • type (NDOption) – option type.

  • option (HomeAgentInformationOption | None) – option data.

  • reserved (bytes) – the two reserved octets.

  • preference (int) – home agent preference.

  • lifetime (int) – home agent lifetime, in seconds.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

HomeAgentInformationOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not two octets, or preference or lifetime does not fit 16 bits.

_make_opt_nonce(type, option=None, *, nonce=b'\x00\x00\x00\x00\x00\x00', **kwargs)[source]

Make ND Nonce option.

Parameters:
Return type:

NonceOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If nonce is not bytes, or the option it makes is no whole number of 8-octet units up to 255.

_make_opt_route_information(type, option=None, *, length=None, prefix_length=0, reserved1=0, prf=RouterPreference.Medium, reserved2=0, lifetime=0, prefix='::', **kwargs)[source]

Make ND Route Information option.

Parameters:
  • type (NDOption) – option type.

  • option (RouteInformationOption | None) – option data.

  • length (int | None) – option length, in octets: 8, 16 or 24, carrying 0, 8 or 16 octets of prefix; the shortest prefix_length allows (RFC 4191 Section 2.3) when not given.

  • prefix_length (int) – prefix length, in bits.

  • reserved1 (int) – the high-order 3 bits of the octet holding prf.

  • prf (RouterPreference | int) – Route Preference.

  • reserved2 (int) – the low-order 3 bits of the octet holding prf.

  • lifetime (int) – route lifetime, in seconds.

  • prefix (IPv6Address | str | bytes | int) – prefix.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

RouteInformationOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If a field does not fit its width, prf is a name, length is not 8, 16 or 24, or prefix has bits set past the octets length carries.

_make_opt_rdnss(type, option=None, *, reserved=b'\x00\x00', lifetime=0, addresses=('::',), **kwargs)[source]

Make ND Recursive DNS Server option.

Parameters:
Return type:

RDNSSOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not two octets, lifetime does not fit 32 bits, or there is no address, or so many the option is longer than 255 units of 8 octets.

_make_opt_ra_flags_extension(type, option=None, *, bits=b'\x00\x00\x00\x00\x00\x00', **kwargs)[source]

Make ND RA Flags Extension option.

Parameters:
Return type:

RAFlagsExtensionOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If bits is not bytes, or the option it makes is no whole number of 8-octet units up to 255.

_make_opt_dnssl(type, option=None, *, reserved=b'\x00\x00', lifetime=0, domain_names=(), padding=None, **kwargs)[source]

Make ND DNS Search List option.

Parameters:
  • type (NDOption) – option type.

  • option (DNSSLOption | None) – option data.

  • reserved (bytes) – the two reserved octets.

  • lifetime (int) – lifetime, in seconds.

  • domain_names (Iterable[str]) – domain names, in presentation form (RFC 1035 Section 5.1), each written uncompressed.

  • padding (bytes | None) – octets past the last name; the zeros that end the option on an 8-octet boundary (RFC 8106 Section 5.2) when not given.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

DNSSLOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If reserved is not two octets, lifetime does not fit 32 bits, a name is refused or is the root, whose zero octet would read as the padding, padding starts with a nonzero octet, which would read as a name, or the option is no whole number of 8-octet units from 2 (RFC 8106 Section 5.2) up to 255.

_make_opt_captive_portal(type, option=None, *, uri=b'', padding=None, **kwargs)[source]

Make ND Captive-Portal option.

Parameters:
Return type:

CaptivePortalOption

Returns:

Constructed option schema.

Raises:

ProtocolError – If uri is not bytes or holds a NUL, padding starts with an octet other than NUL, or the option is no whole number of 8-octet units up to 255.

_make_opt_pref64(type, option=None, *, scaled_lifetime=None, lifetime=0, plc=None, prefix_length=96, prefix='64:ff9b::', **kwargs)[source]

Make ND PREF64 option.

Parameters:
  • type (NDOption) – option type.

  • option (PREF64Option | None) – option data.

  • scaled_lifetime (int | None) – Scaled Lifetime, in units of 8 seconds, as on the wire; encoded from lifetime when not given.

  • lifetime (int) – lifetime, in seconds, a multiple of 8.

  • plc (int | None) – Prefix Length Code, as on the wire; encoded from prefix_length when not given.

  • prefix_length (int) – prefix length, in bits: 96, 64, 56, 48, 40 or 32.

  • prefix (IPv6Address | str | bytes | int) – NAT64 prefix; the Well-Known Prefix (RFC 6052 Section 2.1) when not given.

  • **kwargs (Any) – arbitrary keyword arguments.

Return type:

PREF64Option

Returns:

Constructed option schema.

Raises:

ProtocolError – If scaled_lifetime does not fit 13 bits, or plc 3; if lifetime is no multiple of 8, or prefix_length has no code; or if prefix has bits set past its 96 carried.

_make_address_record(record=None, *, record_type=RecordType.MODE_IS_INCLUDE, aux_data_len=None, num_sources=None, multicast_address='::', sources=None, aux_data=b'', **kwargs)[source]

Make an MLDv2 multicast address record (RFC 9777 Section 5.2).

Parameters:
Return type:

MulticastAddressRecord

Returns:

Constructed record schema.

Raises:

ProtocolError – If record_type is a name, a bool, or a member or code outside 0 to 255; if aux_data_len or num_sources does not fit its width, or num_sources is below the length of sources; or if aux_data_len is not given and aux_data is no whole number of 32-bit words.

_read_nd_options(options_schema)[source]

Read Neighbor Discovery options.

Structure of ND option [RFC 4861 Section 4.6]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |              ...              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                              ...                              ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Each option is read by the method __option__ names for its type, _read_opt_none() where it names none, or where the capture cut the option before its Length.

Parameters:

options_schema (list[NDOption]) – parsed option schemas

Return type:

OrderedMultiDict[NDOption, NDOption]

Returns:

Parsed options, by type, in the order read.

Raises:

ProtocolError – If an option read by a _read_opt_* method has fields that do not take exactly the octets its Length declares, a Length of zero among them (RFC 4861 Section 4.6); a parser registered as a callable is not checked. Or if the capture cut an option short and its parser refuses the zeros it lacks, or its maker does not write the octets captured back.

_make_nd_options(options)[source]

Make Neighbor Discovery options.

Parameters:

options (OrderedMultiDict[NDOption, NDOption] | List[NDOption | Tuple[NDOption | int, Dict[str, Any]] | bytes] | None) – options, as parsed data, keyed by type; or a list of (type, kwargs) pairs, option schemas, or raw octets of whole options. A type is an NDOption member or an int. Parsed data of an option the capture cut before its Length is written by _make_opt_none(), whatever its type.

Return type:

list[NDOption | bytes]

Returns:

Option schema list.

Raises:

ProtocolError – If an option’s type is a name, a bool or a code that does not fit one octet, or its maker refuses it.

_nd_option_maker(code)[source]

The maker __option__ names for an option type.

Parameters:

code (NDOption) – option type

Return type:

Callable[[NDOption, NDOption | None, Any], NDOption]

Returns:

The _make_opt_* method, _make_opt_none() where none is named, or the constructor of a registered pair.

_make_nd_length(octets, *, type)[source]

The Length of an option of octets octets.

Parameters:
  • octets (int) – the option’s size, type and length included

  • type (NDOption) – option type, for the error message

Return type:

int

Returns:

octets in units of 8 octets (RFC 4861 Section 4.6).

Raises:

ProtocolError – If octets is no whole number of 8-octet units, or more than 255 of them.

_verify_pseudo_checksum(pseudo)[source]

Verify the checksum over the pseudo-header of the enclosing IP layer.

That layer calls this once parsed, see verify_upper().

Parameters:

pseudo (IP_Pseudo | None) – Pseudo-header, or None if the IP layer gives none.

Header Schemas

class pcapkit.protocols.internet.icmpv6.schema.ICMPv6(type=NO_VALUE, code=NO_VALUE, checksum=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for ICMPv6 packet.

type: Type = <EnumField type>

ICMPv6 type.

code: int = <UInt8Field code>

ICMPv6 code.

checksum: bytes = <BytesField checksum>

Checksum.

data: ICMPv6Type = <SwitchField data>

Message body, selected by type.

class pcapkit.protocols.internet.icmpv6.schema.ICMPv6Type(*args, **kwargs)[source]

Bases: EnumSchema[Type]

Header schema for ICMPv6 type-specific message body.

class pcapkit.protocols.internet.icmpv6.schema.Unknown(data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 message of unknown type.

data: bytes = <BytesField data>

Message body.

class pcapkit.protocols.internet.icmpv6.schema.DestinationUnreachable(unused=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 Destination Unreachable message.

unused: bytes = <PaddingField unused>

Unused.

data: bytes = <BytesField data>

As much of the invoking packet as fits the minimum IPv6 MTU.

class pcapkit.protocols.internet.icmpv6.schema.PacketTooBig(mtu=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 Packet Too Big message.

mtu: int = <UInt32Field mtu>

MTU of the link that could not forward the invoking packet.

data: bytes = <BytesField data>

As much of the invoking packet as fits the minimum IPv6 MTU.

class pcapkit.protocols.internet.icmpv6.schema.TimeExceeded(unused=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 Time Exceeded message.

unused: bytes = <PaddingField unused>

Unused.

data: bytes = <BytesField data>

As much of the invoking packet as fits the minimum IPv6 MTU.

class pcapkit.protocols.internet.icmpv6.schema.ParameterProblem(pointer=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 Parameter Problem message.

pointer: int = <UInt32Field pointer>

Pointer.

data: bytes = <BytesField data>

As much of the invoking packet as fits the minimum IPv6 MTU.

class pcapkit.protocols.internet.icmpv6.schema.Echo(id=NO_VALUE, seq=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for ICMPv6 Echo Request/Reply message.

id: int = <UInt16Field id>

Identifier.

seq: int = <UInt16Field seq>

Sequence number.

data: bytes = <BytesField data>

Data.

class pcapkit.protocols.internet.icmpv6.schema.MLDQuery(max_resp_code=NO_VALUE, reserved=NO_VALUE, multicast_address=NO_VALUE, ext=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for an MLD Multicast Listener Query message.

Its first 20 octets are those of an MLDv1 Query (RFC 2710 Section 3); ext holds what an MLDv2 Query adds (RFC 9777 Section 5.1), see mldv2_query_present().

Added in version 1.7.0.

max_resp_code: int = <UInt16Field max_resp_code>

Maximum Response Delay of MLDv1, or Maximum Response Code of MLDv2.

reserved: bytes = <BytesField reserved>

Reserved.

multicast_address: IPv6Address = <IPv6AddressField multicast_address>

Multicast address.

ext: MLDv2QueryExtension | None = <ConditionalField ext>

Fields an MLDv2 Query adds, None on an MLDv1 Query.

data: bytes = <PayloadField data>

Octets past the 24 of an MLDv1 Query, what the message leaves; empty on an MLDv2 Query, whose ext holds them.

class pcapkit.protocols.internet.icmpv6.schema.MLDv2QueryExtension(flags=NO_VALUE, qqic=NO_VALUE, num_sources=NO_VALUE, sources=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for the fields an MLDv2 Query adds (RFC 9777 Section 5.1).

They follow the 24 octets of an MLDv1 Query (RFC 2710 Section 3).

Added in version 1.7.0.

flags: MLDv2QueryFlags = <BitField flags>

Flags, S Flag and QRV.

qqic: int = <UInt8Field qqic>

Querier’s Query Interval Code (RFC 9777 Section 5.1.9).

num_sources: int = <UInt16Field num_sources>

Number of source addresses.

sources: list[IPv6Address] = <ListField sources>

Source addresses (RFC 9777 Section 5.1.11).

data: bytes = <PayloadField data>

Additional data (RFC 9777 Section 5.1.12), empty for a conformant sender. What the message leaves, as a trailer takes it, so a cut ends in the field it falls in.

class pcapkit.protocols.internet.icmpv6.schema.MLDv1(max_resp_delay=NO_VALUE, reserved=NO_VALUE, multicast_address=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for an MLDv1 Multicast Listener Report or Done message (RFC 2710 Section 3).

Added in version 1.7.0.

max_resp_delay: int = <UInt16Field max_resp_delay>

Maximum Response Delay, zero but in a Query.

reserved: bytes = <BytesField reserved>

Reserved.

multicast_address: IPv6Address = <IPv6AddressField multicast_address>

Multicast address.

data: bytes = <PayloadField data>

Octets past the 24 RFC 2710 Section 3 defines, what the message leaves.

class pcapkit.protocols.internet.icmpv6.schema.MLDv2Report(flags=NO_VALUE, num_records=NO_VALUE, records=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for an MLDv2 Version 2 Multicast Listener Report message (RFC 9777 Section 5.2).

Note

records is read with the whole remaining length, since the count cannot size it in octets; post_process() keeps the first num_records and gives the rest to data, the message’s Additional Data (RFC 9777 Section 5.2.12). Where the data ends before the records counted, see mldv2_record_count().

Added in version 1.7.0.

flags: int = <UInt16Field flags>

Flags (RFC 9777 Section 5.2.3).

num_records: int = <UInt16Field num_records>

Number of multicast address records, as on the wire.

records: list[MulticastAddressRecord] = <ListField records>

Multicast address records.

data: bytes = <PayloadField data>

Additional data, empty for a conformant sender.

post_process(packet)[source]

Trim records to num_records and reclaim the rest as data.

Parameters:

packet (dict[str, Any]) – Unpacked data.

Return type:

Schema

Returns:

Revised schema.

A capture that ends past the records kept ends inside data, so the short read unpack() recorded on records is moved there.

class pcapkit.protocols.internet.icmpv6.schema.MulticastAddressRecord(record_type=NO_VALUE, aux_data_len=NO_VALUE, num_sources=NO_VALUE, multicast_address=NO_VALUE, sources=NO_VALUE, aux_data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for an MLDv2 multicast address record (RFC 9777 Section 5.2).

Added in version 1.7.0.

record_type: RecordType = <EnumField record_type>

Record type (RFC 9777 Section 5.2.13).

aux_data_len: int = <UInt8Field aux_data_len>

Auxiliary data length, in 32-bit words.

num_sources: int = <UInt16Field num_sources>

Number of source addresses.

multicast_address: IPv6Address = <IPv6AddressField multicast_address>

Multicast address.

sources: list[IPv6Address] = <ListField sources>

Source addresses (RFC 9777 Section 5.2.10).

aux_data: bytes = <BytesField aux_data>

Auxiliary data (RFC 9777 Section 5.2.11).

Neighbor Discovery Schemas

class pcapkit.protocols.internet.icmpv6.schema.RouterSolicitation(reserved=NO_VALUE, options=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for Router Solicitation messages (RFC 4861 Section 4.1).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

options: list[NDOption] = <NDOptionField options>

Options.

class pcapkit.protocols.internet.icmpv6.schema.RouterAdvertisement(cur_hop_limit=NO_VALUE, flags=NO_VALUE, router_lifetime=NO_VALUE, reachable_time=NO_VALUE, retrans_timer=NO_VALUE, options=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for Router Advertisement messages (RFC 4861 Section 4.2).

Added in version 1.9.0.

cur_hop_limit: int = <UInt8Field cur_hop_limit>

Current hop limit.

flags: RAFlags = <BitField flags>

Flags, as IANA’s Router Advertisement Flags assigns them.

router_lifetime: int = <UInt16Field router_lifetime>

Router lifetime, in seconds.

reachable_time: int = <UInt32Field reachable_time>

Reachable time, in milliseconds.

retrans_timer: int = <UInt32Field retrans_timer>

Retransmission timer, in milliseconds.

options: list[NDOption] = <NDOptionField options>

Options.

class pcapkit.protocols.internet.icmpv6.schema.NeighborSolicitation(reserved=NO_VALUE, target_address=NO_VALUE, options=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for Neighbor Solicitation messages (RFC 4861 Section 4.3).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

target_address: IPv6Address = <IPv6AddressField target_address>

Target address.

options: list[NDOption] = <NDOptionField options>

Options.

class pcapkit.protocols.internet.icmpv6.schema.NeighborAdvertisement(flags=NO_VALUE, target_address=NO_VALUE, options=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for Neighbor Advertisement messages (RFC 4861 Section 4.4).

Added in version 1.9.0.

flags: NAFlags = <BitField flags>

Router, Solicited and Override flags, and Reserved.

target_address: IPv6Address = <IPv6AddressField target_address>

Target address.

options: list[NDOption] = <NDOptionField options>

Options.

class pcapkit.protocols.internet.icmpv6.schema.Redirect(reserved=NO_VALUE, target_address=NO_VALUE, destination_address=NO_VALUE, options=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: ICMPv6Type

Header schema for Redirect messages (RFC 4861 Section 4.5).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

target_address: IPv6Address = <IPv6AddressField target_address>

Target address, the better first hop.

destination_address: IPv6Address = <IPv6AddressField destination_address>

Destination address, the one redirected.

options: list[NDOption] = <NDOptionField options>

Options.

class pcapkit.protocols.internet.icmpv6.schema.NDOption(*args, **kwargs)[source]

Bases: EnumSchema[NDOption]

Header schema for ICMPv6 Neighbor Discovery options (RFC 4861 Section 4.6).

Added in version 1.9.0.

type: NDOption = <EnumField type>

Option type.

length: int = <UInt8Field length>

Option length, in units of 8 octets, type and length included.

classmethod pre_unpack(packet)[source]

Prepare packet data for unpacking process.

Parameters:

packet (dict[str, Any]) – packet data

An option of a message parsed on its own, as frame_depth tells, is read with __data_end__: its octets end at most with the data, where the capture cut them (#2880), so a field past the cut does not warn.

class pcapkit.protocols.internet.icmpv6.schema.UnknownOption(type=NO_VALUE, length=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for an ND option of a type not decoded.

Added in version 1.9.0.

data: bytes = <BytesField data>

Option data.

class pcapkit.protocols.internet.icmpv6.schema.LinkLayerAddressOption(type=NO_VALUE, length=NO_VALUE, link_layer_address=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Source and Target Link-layer Address options (RFC 4861 Section 4.6.1).

Added in version 1.9.0.

Link-layer address, laid out as the link’s own specification gives.

class pcapkit.protocols.internet.icmpv6.schema.PrefixInformationOption(type=NO_VALUE, length=NO_VALUE, prefix_length=NO_VALUE, flags=NO_VALUE, valid_lifetime=NO_VALUE, preferred_lifetime=NO_VALUE, reserved2=NO_VALUE, prefix=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Prefix Information options (RFC 4861 Section 4.6.2).

Added in version 1.9.0.

prefix_length: int = <UInt8Field prefix_length>

Prefix length.

flags: PrefixInformationFlags = <BitField flags>

Flags, as IANA’s Prefix Information Option Flags assigns them.

valid_lifetime: int = <UInt32Field valid_lifetime>

Valid lifetime, in seconds.

preferred_lifetime: int = <UInt32Field preferred_lifetime>

Preferred lifetime, in seconds.

reserved2: bytes = <BytesField reserved2>

Reserved2.

prefix: IPv6Address = <IPv6AddressField prefix>

Prefix.

class pcapkit.protocols.internet.icmpv6.schema.RedirectedHeaderOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Redirected Header options (RFC 4861 Section 4.6.3).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

data: bytes = <BytesField data>

As much of the redirected packet as fits.

class pcapkit.protocols.internet.icmpv6.schema.MTUOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, mtu=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for MTU options (RFC 4861 Section 4.6.4).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

mtu: int = <UInt32Field mtu>

Recommended MTU of the link.

class pcapkit.protocols.internet.icmpv6.schema.AdvertisementIntervalOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, interval=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Advertisement Interval options (RFC 6275 Section 7.3).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

interval: int = <UInt32Field interval>

Advertisement interval, in milliseconds.

class pcapkit.protocols.internet.icmpv6.schema.HomeAgentInformationOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, preference=NO_VALUE, lifetime=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Home Agent Information options (RFC 6275 Section 7.4).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

preference: int = <UInt16Field preference>

Home agent preference.

lifetime: int = <UInt16Field lifetime>

Home agent lifetime, in seconds.

class pcapkit.protocols.internet.icmpv6.schema.NonceOption(type=NO_VALUE, length=NO_VALUE, nonce=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Nonce options (RFC 3971 Section 5.3.2).

Added in version 1.9.0.

nonce: bytes = <BytesField nonce>

Nonce.

class pcapkit.protocols.internet.icmpv6.schema.RouteInformationOption(type=NO_VALUE, length=NO_VALUE, prefix_length=NO_VALUE, flags=NO_VALUE, lifetime=NO_VALUE, prefix=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Route Information options (RFC 4191 Section 2.3).

Added in version 1.9.0.

prefix_length: int = <UInt8Field prefix_length>

Prefix length.

flags: RouteInformationFlags = <BitField flags>

Reserved, Route Preference and Reserved.

lifetime: int = <UInt32Field lifetime>

Route lifetime, in seconds.

prefix: bytes = <BytesField prefix>

Prefix, as many octets of it as the Length leaves.

class pcapkit.protocols.internet.icmpv6.schema.RDNSSOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, lifetime=NO_VALUE, addresses=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Recursive DNS Server options (RFC 8106 Section 5.1).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

lifetime: int = <UInt32Field lifetime>

Lifetime, in seconds.

addresses: list[IPv6Address] = <ListField addresses>

Addresses of the recursive DNS servers.

class pcapkit.protocols.internet.icmpv6.schema.RAFlagsExtensionOption(type=NO_VALUE, length=NO_VALUE, bits=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for RA Flags Extension options (RFC 5175 Section 4).

Added in version 1.9.0.

bits: bytes = <BytesField bits>

Bits 8 onwards of IANA’s Router Advertisement Flags.

class pcapkit.protocols.internet.icmpv6.schema.DNSSLOption(type=NO_VALUE, length=NO_VALUE, reserved=NO_VALUE, lifetime=NO_VALUE, names=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for DNS Search List options (RFC 8106 Section 5.2).

Added in version 1.9.0.

reserved: bytes = <BytesField reserved>

Reserved.

lifetime: int = <UInt32Field lifetime>

Lifetime, in seconds.

names: bytes = <BytesField names>

Domain names, each uncompressed (RFC 1035 Section 3.1), then zero padding.

class pcapkit.protocols.internet.icmpv6.schema.CaptivePortalOption(type=NO_VALUE, length=NO_VALUE, uri=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for Captive-Portal options (RFC 8910 Section 2.3).

Added in version 1.9.0.

uri: bytes = <BytesField uri>

URI, then NUL padding.

class pcapkit.protocols.internet.icmpv6.schema.PREF64Option(type=NO_VALUE, length=NO_VALUE, lifetime=NO_VALUE, prefix=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: NDOption

Header schema for PREF64 options (RFC 8781 Section 4).

Added in version 1.9.0.

lifetime: PREF64Lifetime = <BitField lifetime>

Scaled Lifetime and Prefix Length Code.

prefix: bytes = <BytesField prefix>

Highest 96 bits of the prefix.

class pcapkit.protocols.internet.icmpv6.schema.NDOptionField(length=lambda _: ..., base_schema=None, type_name='type', registry=None, eool=None, callback=lambda *_: ...)[source]

Bases: OptionField[NDOption]

The option list closing a Neighbor Discovery message (RFC 4861 Section 4.6).

The list runs to the end of the message, which a message parsed on its own knows only as the end of the data.

Added in version 1.9.0.

_accepts_short_read(option)[source]

Whether an option that read past the end of the data may stand.

Parameters:

option (NDOption) – Option just unpacked, which read short.

Return type:

bool

Returns:

Whether the message was parsed on its own, as frame_depth tells: its data then ends where it was cut (#2880), and the option keeps the short read its schema records. Inside a frame its lengths say where the message ends, so an option past them is refused.

Auxiliary Functions

pcapkit.protocols.internet.icmpv6.schema.icmpv6_data_selector(pkt)[source]

Selector function for ICMPv6.data field.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

FieldBase

Returns:

A SchemaField wrapped ICMPv6Type instance based on ICMPv6.type.

pcapkit.protocols.internet.icmpv6.schema.mldv2_query_present(pkt)[source]

Test function for MLDQuery.ext.

A Query of 28 or more octets is MLDv2’s, and one of fewer MLDv1’s (RFC 9777 Section 8.1): 28 octets leave at least 4 past the 20 read before MLDQuery.ext, behind the 4 of the ICMPv6 header. A Query of 25 to 27 octets, which neither version defines, reads as MLDv1, the octets past its 24 kept.

On the packing path 'ext' is already in pkt, and the question is whether an ext value was given.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

bool

Returns:

Whether MLDQuery.ext should be parsed (unpacking) or packed (packing).

Added in version 1.7.0.

pcapkit.protocols.internet.icmpv6.schema.mldv2_record_count(pkt)[source]

Count callback for MLDv2Report.records.

Parameters:

pkt (dict[str, Any]) – Packet data.

Return type:

int

Returns:

MLDv2Report.num_records, for a message parsed on its own; otherwise -1, counting none: inside a frame its lengths say where the message ends, and on the packing path 'records' is already in pkt. Records counted past the data are then a cut, which Schema.unpack records.

Raises:

ProtocolError – If the records counted, at the 20 fixed octets of each, behind the 8 octets ahead of them, reach past the IP_MAX_LENGTH octets an IP payload holds, so the count is no cut but one the message cannot carry.

Added in version 1.7.0.

pcapkit.protocols.internet.icmpv6.schema.nd_option_length(pkt, offset)[source]

Octets an ND option’s Length declares past its first offset.

The Length counts the whole option in units of 8 octets (RFC 4861 Section 4.6).

Parameters:
  • pkt (dict[str, Any]) – Option unpacked so far.

  • offset (int) – Octets of the option ahead of the field sized.

Return type:

int

Returns:

Length * 8 - offset, or 0 for a Length too small to reach past offset, an option _read_nd_options() refuses.

Added in version 1.9.0.

pcapkit.protocols.internet.icmpv6.schema.rdnss_address_length(pkt)[source]

Length of RDNSSOption.addresses.

Parameters:

pkt (dict[str, Any]) – Option unpacked so far.

Return type:

int

Returns:

16 octets for each of the (Length - 1) / 2 addresses (RFC 8106 Section 5.1). A Length below 3 or even is one _read_opt_rdnss() refuses (RFC 8106 Section 5.3.1).

Added in version 1.9.0.

pcapkit.protocols.internet.icmpv6.schema.nd_options()[source]

The option list of a Neighbor Discovery message.

Return type:

NDOptionField

Returns:

A list of NDOption running to the end of the message.

Added in version 1.9.0.

Type Stubs

class pcapkit.protocols.internet.icmpv6.schema.MLDv2QueryFlags[source]

Bases: TypedDict

MLDv2 Query flags octet.

Added in version 1.7.0.

flags: int

Flags.

s_flag: int

Suppress Router-Side Processing flag.

qrv: int

Querier’s Robustness Variable.

class pcapkit.protocols.internet.icmpv6.schema.RAFlags[source]

Bases: TypedDict

Router Advertisement flags octet, as IANA’s Router Advertisement Flags assigns it.

Added in version 1.9.0.

m_flag: int

Managed Address Configuration flag.

o_flag: int

Other Configuration flag.

h_flag: int

Mobile IPv6 Home Agent flag.

prf: int

Default Router Preference.

p_flag: int

Neighbor Discovery Proxy flag.

s_flag: int

SNAC Router flag.

reserved: int

Reserved.

class pcapkit.protocols.internet.icmpv6.schema.NAFlags[source]

Bases: TypedDict

Neighbor Advertisement flags and Reserved (RFC 4861 Section 4.4).

Added in version 1.9.0.

r_flag: int

Router flag.

s_flag: int

Solicited flag.

o_flag: int

Override flag.

reserved: int

Reserved.

class pcapkit.protocols.internet.icmpv6.schema.PrefixInformationFlags[source]

Bases: TypedDict

Prefix Information option flags octet, as IANA’s Prefix Information Option Flags assigns it.

Added in version 1.9.0.

l_flag: int

On-link flag.

a_flag: int

Autonomous Address Configuration flag.

r_flag: int

Router Address flag.

p_flag: int

DHCPv6-PD Preferred flag.

reserved1: int

Reserved1.

class pcapkit.protocols.internet.icmpv6.schema.RouteInformationFlags[source]

Bases: TypedDict

Route Information option Reserved and Prf octet (RFC 4191 Section 2.3).

Added in version 1.9.0.

reserved1: int

Reserved, the high-order 3 bits.

prf: int

Route Preference.

reserved2: int

Reserved, the low-order 3 bits.

class pcapkit.protocols.internet.icmpv6.schema.PREF64Lifetime[source]

Bases: TypedDict

PREF64 option Scaled Lifetime and PLC (RFC 8781 Section 4).

Added in version 1.9.0.

scaled_lifetime: int

Scaled Lifetime, in units of 8 seconds.

plc: int

Prefix Length Code.

Data Models

class pcapkit.protocols.internet.icmpv6.data.ICMPv6(*args, **kwargs)[source]

Bases: Protocol

Data model for ICMPv6 protocol.

The fields below are the only ones every ICMPv6 message shares (RFC 4443); what follows them is read entirely differently depending on type, which is why each message kind below adds its own fields rather than this base class growing a union of them all.

type: Type

ICMPv6 type.

code: int

ICMPv6 code. Left untyped as a bare int here because its meaning is entirely type-dependent; each subclass below documents which registry (if any) its own code values are drawn from.

checksum: bytes

Checksum.

length: int

Message length, in octets, header included. ICMPv6 messages carry no length field of their own – this is simply how many octets ICMPv6.read was handed, kept here so the whole message can be told apart from a truncated capture.

checksum_status: ChecksumStatus

Outcome of verifying checksum, present only when the enclosing IPv6 layer verified it under CHECKSUM_VERIFY.

class pcapkit.protocols.internet.icmpv6.data.Unknown(type, code, checksum, length, data)[source]

Bases: ICMPv6

Data model for ICMPv6 packet of unknown type.

code carries no pcapkit.const registry for a type this package does not recognise, so it is read as a bare int.

data: bytes

Message body, as captured.

class pcapkit.protocols.internet.icmpv6.data.DestinationUnreachable(type, code, checksum, length, unused, data)[source]

Bases: ICMPv6

Data model for ICMPv6 Destination Unreachable message (type 1).

unused: bytes

Unused (four octets, RFC 4443 Section 3.1), as captured.

data: bytes

As much of the invoking packet as fits the minimum IPv6 MTU, per RFC 4443 Section 3.1, as captured.

class pcapkit.protocols.internet.icmpv6.data.PacketTooBig(type, code, checksum, length, mtu, data)[source]

Bases: ICMPv6

Data model for ICMPv6 Packet Too Big message (type 2).

code is always 0 (RFC 4443 Section 3.2), so it is read as a bare int rather than typed against a registry of one member.

mtu: int

MTU of the link that could not forward the invoking packet.

data: bytes

As much of the invoking packet as fits the minimum IPv6 MTU, per RFC 4443 Section 3.2, as captured.

class pcapkit.protocols.internet.icmpv6.data.TimeExceeded(type, code, checksum, length, unused, data)[source]

Bases: ICMPv6

Data model for ICMPv6 Time Exceeded message (type 3).

unused: bytes

Unused (four octets, RFC 4443 Section 3.3), as captured.

data: bytes

As much of the invoking packet as fits the minimum IPv6 MTU, per RFC 4443 Section 3.3, as captured.

class pcapkit.protocols.internet.icmpv6.data.ParameterProblem(type, code, checksum, length, pointer, data)[source]

Bases: ICMPv6

Data model for ICMPv6 Parameter Problem message (type 4).

pointer: int

Pointer, identifying the octet offset within the invoking packet where the error was detected (RFC 4443 Section 3.4).

data: bytes

As much of the invoking packet as fits the minimum IPv6 MTU, per RFC 4443 Section 3.4, as captured.

class pcapkit.protocols.internet.icmpv6.data.Echo(type, code, checksum, length, id, seq, data)[source]

Bases: ICMPv6

Data model for ICMPv6 Echo Request/Reply message (types 128 and 129).

code is always 0 for both types (RFC 4443 Section 4.1, RFC 4443 Section 4.2), so it is read as a bare int rather than typed against a registry of one member.

id: int

Identifier.

seq: int

Sequence number.

data: bytes

Data, echoed back verbatim by a reply to the same identifier and sequence number.

class pcapkit.protocols.internet.icmpv6.data.MLDv1(type, code, checksum, length, version, max_resp_delay, reserved, multicast_address, data)[source]

Bases: ICMPv6

Data model for an MLDv1 message (RFC 2710 Section 3).

A Multicast Listener Query (type 130) of fewer than 28 octets (RFC 9777 Section 8.1), a Multicast Listener Report (131) or a Multicast Listener Done (132). code is zero on the wire and ignored (RFC 2710 Section 3.2).

Added in version 1.7.0.

version: Literal[1]

MLD version, always 1. It is on no octet; it names the version the message was read as, which a Query is rebuilt by.

max_resp_delay: int

Maximum Response Delay, in milliseconds (RFC 2710 Section 3.4); zero but in a Query.

reserved: bytes

Reserved (RFC 2710 Section 3.5), as captured.

multicast_address: IPv6Address

Multicast address (RFC 2710 Section 3.6), :: on a General Query and else the address queried, reported or left.

data: bytes

Octets past the 24 RFC 2710 Section 3 defines, as captured; empty for a conformant sender.

class pcapkit.protocols.internet.icmpv6.data.MLDv2Query(type, code, checksum, length, version, max_resp_code, max_resp_delay, reserved, multicast_address, flags, s_flag, qrv, qqic, qqi, num_sources, sources, data)[source]

Bases: ICMPv6

Data model for an MLDv2 Multicast Listener Query (RFC 9777 Section 5.1).

A Query (type 130) of 28 or more octets (RFC 9777 Section 8.1). code is zero on the wire and ignored (RFC 9777 Section 5.1.1).

Added in version 1.7.0.

version: Literal[2]

MLD version, always 2; see MLDv1.version.

max_resp_code: int

Maximum Response Code, as on the wire.

max_resp_delay: int

Maximum Response Delay, in milliseconds, decoded from max_resp_code: literal below 32768, else (mant | 0x1000) << (exp + 3) (RFC 9777 Section 5.1.3).

reserved: bytes

Reserved (RFC 9777 Section 5.1.4), as captured.

multicast_address: IPv6Address

Multicast address, :: on a General Query and else the address queried (RFC 9777 Section 5.1.5).

flags: int

Flags, the 4 high-order bits of the octet holding s_flag (RFC 9777 Section 5.1.6), as captured.

s_flag: bool

Suppress Router-Side Processing flag (RFC 9777 Section 5.1.7).

qrv: int

Querier’s Robustness Variable (RFC 9777 Section 5.1.8).

qqic: int

Querier’s Query Interval Code, as on the wire.

qqi: int

Querier’s Query Interval, in seconds, decoded from qqic (RFC 9777 Section 5.1.9).

num_sources: int

Number of source addresses, as on the wire (RFC 9777 Section 5.1.10); more than sources holds where the data ends inside them.

sources: tuple[IPv6Address, ...]

Source addresses (RFC 9777 Section 5.1.11).

data: bytes

Additional data (RFC 9777 Section 5.1.12), as captured; empty for a conformant sender.

class pcapkit.protocols.internet.icmpv6.data.MLDv2Report(type, code, checksum, length, version, flags, num_records, records, data)[source]

Bases: ICMPv6

Data model for an MLDv2 Version 2 Multicast Listener Report (RFC 9777 Section 5.2).

A Report is type 143, and its code the Reserved octet (RFC 9777 Section 5.2.1).

Added in version 1.7.0.

version: Literal[2]

MLD version, always 2; see MLDv1.version.

flags: int

Flags (RFC 9777 Section 5.2.3), as captured.

num_records: int

Number of multicast address records, as on the wire.

records: tuple[MulticastAddressRecord, ...]

Multicast address records (RFC 9777 Section 5.2.5).

data: bytes

Additional data (RFC 9777 Section 5.2.12), as captured; empty for a conformant sender.

class pcapkit.protocols.internet.icmpv6.data.MulticastAddressRecord(record_type, aux_data_len, num_sources, multicast_address, sources, aux_data)[source]

Bases: Data

Data model for an MLDv2 multicast address record (RFC 9777 Section 5.2).

Added in version 1.7.0.

record_type: RecordType

Record type (RFC 9777 Section 5.2.13).

aux_data_len: int

Auxiliary data length, in 32-bit words.

num_sources: int

Number of source addresses, as on the wire.

multicast_address: IPv6Address

Multicast address the record pertains to.

sources: tuple[IPv6Address, ...]

Source addresses (RFC 9777 Section 5.2.10).

aux_data: bytes

Auxiliary data (RFC 9777 Section 5.2.11), as captured; empty for an MLDv2 sender.

Neighbor Discovery Models

class pcapkit.protocols.internet.icmpv6.data.RouterSolicitation(type, code, checksum, length, reserved, options)[source]

Bases: ICMPv6

Data model for a Router Solicitation (type 133, RFC 4861 Section 4.1).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

options: OrderedMultiInfo[NDOption, NDOption]

Options (RFC 4861 Section 4.6).

class pcapkit.protocols.internet.icmpv6.data.RouterAdvertisement(type, code, checksum, length, cur_hop_limit, m_flag, o_flag, h_flag, prf, p_flag, s_flag, reserved, router_lifetime, reachable_time, retrans_timer, options)[source]

Bases: ICMPv6

Data model for a Router Advertisement (type 134, RFC 4861 Section 4.2).

Its flags are those IANA’s Router Advertisement Flags assigns to the octet (RFC 5175 Section 3).

Added in version 1.9.0.

cur_hop_limit: int

Current hop limit, zero for unspecified.

m_flag: bool

Managed Address Configuration flag (RFC 4861 Section 4.2).

o_flag: bool

Other Configuration flag (RFC 4861 Section 4.2).

h_flag: bool

Mobile IPv6 Home Agent flag (RFC 6275 Section 7.1).

prf: RouterPreference

Default Router Preference (RFC 4191 Section 2.2).

p_flag: bool

Neighbor Discovery Proxy flag (RFC 4389 Section 4.1.3.3).

s_flag: bool

SNAC Router flag.

reserved: int

Reserved, the octet’s last bit, as captured.

router_lifetime: int

Router lifetime, in seconds; zero for no default router.

reachable_time: int

Reachable time, in milliseconds; zero for unspecified.

retrans_timer: int

Retransmission timer, in milliseconds; zero for unspecified.

options: OrderedMultiInfo[NDOption, NDOption]

Options (RFC 4861 Section 4.6).

class pcapkit.protocols.internet.icmpv6.data.NeighborSolicitation(type, code, checksum, length, reserved, target_address, options)[source]

Bases: ICMPv6

Data model for a Neighbor Solicitation (type 135, RFC 4861 Section 4.3).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

target_address: IPv6Address

Target address.

options: OrderedMultiInfo[NDOption, NDOption]

Options (RFC 4861 Section 4.6).

class pcapkit.protocols.internet.icmpv6.data.NeighborAdvertisement(type, code, checksum, length, r_flag, s_flag, o_flag, reserved, target_address, options)[source]

Bases: ICMPv6

Data model for a Neighbor Advertisement (type 136, RFC 4861 Section 4.4).

Added in version 1.9.0.

r_flag: bool

Router flag.

s_flag: bool

Solicited flag.

o_flag: bool

Override flag.

reserved: int

Reserved, the 29 bits after the flags, as captured.

target_address: IPv6Address

Target address.

options: OrderedMultiInfo[NDOption, NDOption]

Options (RFC 4861 Section 4.6).

class pcapkit.protocols.internet.icmpv6.data.Redirect(type, code, checksum, length, reserved, target_address, destination_address, options)[source]

Bases: ICMPv6

Data model for a Redirect (type 137, RFC 4861 Section 4.5).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

target_address: IPv6Address

Target address, the better first hop.

destination_address: IPv6Address

Destination address, the one redirected.

options: OrderedMultiInfo[NDOption, NDOption]

Options (RFC 4861 Section 4.6).

class pcapkit.protocols.internet.icmpv6.data.NDOption(*args, **kwargs)[source]

Bases: Data

Data model for ICMPv6 Neighbor Discovery options (RFC 4861 Section 4.6).

Added in version 1.9.0.

type: NDOption

Option type.

length: int

Option length, in octets, type and length included, eight times the Length on the wire.

class pcapkit.protocols.internet.icmpv6.data.UnknownOption(type, length, data)[source]

Bases: NDOption

Data model for an ND option of a type not decoded.

Added in version 1.9.0.

data: bytes

Option data, as captured.

class pcapkit.protocols.internet.icmpv6.data.LinkLayerAddressOption(type, length, link_layer_address)[source]

Bases: NDOption

Data model for a Source or Target Link-layer Address option (RFC 4861 Section 4.6.1).

Added in version 1.9.0.

Link-layer address, as captured, laid out and padded as the link’s own specification gives, e.g. six octets on Ethernet (RFC 2464 Section 6).

class pcapkit.protocols.internet.icmpv6.data.PrefixInformationOption(type, length, prefix_length, l_flag, a_flag, r_flag, p_flag, reserved1, valid_lifetime, preferred_lifetime, reserved2, prefix)[source]

Bases: NDOption

Data model for a Prefix Information option (RFC 4861 Section 4.6.2).

Its flags are those IANA’s Prefix Information Option Flags assigns (RFC 8425).

Added in version 1.9.0.

prefix_length: int

Prefix length, in bits.

l_flag: bool

On-link flag (RFC 4861 Section 4.6.2).

a_flag: bool

Autonomous Address Configuration flag (RFC 4861 Section 4.6.2).

r_flag: bool

Router Address flag (RFC 6275 Section 7.2).

p_flag: bool

DHCPv6-PD Preferred flag (RFC 9762 Section 5).

reserved1: int

Reserved1, the low-order 4 bits of the flags octet, as captured.

valid_lifetime: int

Valid lifetime, in seconds; all ones for infinity.

preferred_lifetime: int

Preferred lifetime, in seconds; all ones for infinity.

reserved2: bytes

Reserved2, as captured.

prefix: IPv6Address

Prefix.

class pcapkit.protocols.internet.icmpv6.data.RedirectedHeaderOption(type, length, reserved, data)[source]

Bases: NDOption

Data model for a Redirected Header option (RFC 4861 Section 4.6.3).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

data: bytes

As much of the redirected packet, from its IP header, as fits.

class pcapkit.protocols.internet.icmpv6.data.MTUOption(type, length, reserved, mtu)[source]

Bases: NDOption

Data model for an MTU option (RFC 4861 Section 4.6.4).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

mtu: int

Recommended MTU of the link.

class pcapkit.protocols.internet.icmpv6.data.AdvertisementIntervalOption(type, length, reserved, interval)[source]

Bases: NDOption

Data model for an Advertisement Interval option (RFC 6275 Section 7.3).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

interval: int

Largest time between unsolicited Router Advertisements, in milliseconds.

class pcapkit.protocols.internet.icmpv6.data.HomeAgentInformationOption(type, length, reserved, preference, lifetime)[source]

Bases: NDOption

Data model for a Home Agent Information option (RFC 6275 Section 7.4).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

preference: int

Home agent preference; a higher value is more preferable.

lifetime: int

Home agent lifetime, in seconds.

class pcapkit.protocols.internet.icmpv6.data.NonceOption(type, length, nonce)[source]

Bases: NDOption

Data model for a Nonce option (RFC 3971 Section 5.3.2).

Added in version 1.9.0.

nonce: bytes

Nonce, as captured.

class pcapkit.protocols.internet.icmpv6.data.RouteInformationOption(type, length, prefix_length, reserved1, prf, reserved2, lifetime, prefix)[source]

Bases: NDOption

Data model for a Route Information option (RFC 4191 Section 2.3).

Added in version 1.9.0.

prefix_length: int

Prefix length, in bits.

reserved1: int

Reserved, the high-order 3 bits of the octet holding prf.

prf: RouterPreference

Route Preference.

reserved2: int

Reserved, the low-order 3 bits of the octet holding prf.

lifetime: int

Route lifetime, in seconds; all ones for infinity.

prefix: IPv6Address

Prefix, the 0, 8 or 16 octets the Length leaves, zero-extended.

class pcapkit.protocols.internet.icmpv6.data.RDNSSOption(type, length, reserved, lifetime, addresses)[source]

Bases: NDOption

Data model for a Recursive DNS Server option (RFC 8106 Section 5.1).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

lifetime: int

Lifetime, in seconds; all ones for infinity.

addresses: tuple[IPv6Address, ...]

Addresses of the recursive DNS servers.

class pcapkit.protocols.internet.icmpv6.data.RAFlagsExtensionOption(type, length, bits)[source]

Bases: NDOption

Data model for an RA Flags Extension option (RFC 5175 Section 4).

Added in version 1.9.0.

bits: bytes

Bits 8 onwards of IANA’s Router Advertisement Flags, as captured; none is assigned but to Private Experimentation.

class pcapkit.protocols.internet.icmpv6.data.DNSSLOption(type, length, reserved, lifetime, domain_names, padding)[source]

Bases: NDOption

Data model for a DNS Search List option (RFC 8106 Section 5.2).

Added in version 1.9.0.

reserved: bytes

Reserved, as captured.

lifetime: int

Lifetime, in seconds; all ones for infinity.

domain_names: tuple[str, ...]

Domain names, in presentation form (RFC 1035 Section 5.1).

padding: bytes

Octets past the last name, as captured; zeros for a conformant sender.

class pcapkit.protocols.internet.icmpv6.data.CaptivePortalOption(type, length, uri, padding)[source]

Bases: NDOption

Data model for a Captive-Portal option (RFC 8910 Section 2.3).

Added in version 1.9.0.

uri: bytes

URI of the captive portal API endpoint, the octets ahead of the first NUL.

padding: bytes

NUL padding, from the first NUL on, as captured.

class pcapkit.protocols.internet.icmpv6.data.PREF64Option(type, length, scaled_lifetime, lifetime, plc, prefix_length, prefix)[source]

Bases: NDOption

Data model for a PREF64 option (RFC 8781 Section 4).

Added in version 1.9.0.

scaled_lifetime: int

Scaled Lifetime, in units of 8 seconds, as on the wire.

lifetime: int

Lifetime, in seconds, decoded from scaled_lifetime (RFC 8781 Section 4.1).

plc: int

Prefix Length Code, as on the wire.

prefix_length: int | None

Prefix length, in bits, decoded from plc; None for a code RFC 8781 Section 4 assigns none.

prefix: IPv6Address

Prefix, its highest 96 bits as carried and the rest zero.

Constants

pcapkit.protocols.internet.icmpv6.const.PREF64_PREFIX_LENGTH = {0: 96, 1: 64, 2: 56, 3: 48, 4: 40, 5: 32}

NAT64 prefix length, in bits, by the PREF64 option’s Prefix Length Code (RFC 8781 Section 4).

Footnotes