dhcpkit.ipv6.extensions.linklayer_id module

Implementation of the Client LinkLayer Address relay option as specified in RFC 6939.

class dhcpkit.ipv6.extensions.linklayer_id.LinkLayerIdOption(link_layer_type: int = 0, link_layer_address: bytes = b'')[source]

Bases: dhcpkit.ipv6.options.Option

RFC 6939#section-4

The format of the DHCPv6 Client Link-Layer Address option is shown below.

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OPTION_CLIENT_LINKLAYER_ADDR  |           option-length       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   link-layer type (16 bits)   |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
|               link-layer address (variable length)            |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_CLIENT_LINKLAYER_ADDR (79)
option-length
2 + length of link-layer address
link-layer type
Client link-layer address type. The link-layer type MUST be a valid hardware type assigned by the IANA, as described in RFC 826
link-layer address
Client link-layer address

Nicer representation of hardware types :return: Representation of hardware type

load_from(buffer: bytes, offset: int = 0, length: int = None) → int[source]

Load the internal state of this object from the given buffer. The buffer may contain more data after the structured element is parsed. This data is ignored.

Parameters:
  • buffer – The buffer to read data from
  • offset – The offset in the buffer where to start reading
  • length – The amount of data we are allowed to read from the buffer
Returns:

The number of bytes used from the buffer

option_type = 79
save() → Union[source]

Save the internal state of this object as a buffer.

Returns:The buffer with the data from this element
validate()[source]

Validate that the contents of this object conform to protocol specs.