dhcpkit.ipv6.extensions.subscriber_id module

Implementation of Subscriber-ID option as specified in RFC 4580.

class dhcpkit.ipv6.extensions.subscriber_id.SubscriberIdOption(subscriber_id: bytes = b'')[source]

Bases: dhcpkit.ipv6.options.Option

RFC 4580#section-2

The subscriber-id information allows the service provider to assign/ activate subscriber-specific actions; e.g., assignment of specific IP addresses, prefixes, DNS configuration, trigger accounting, etc. This option is de-coupled from the access network’s physical structure, so a subscriber that moves from one access-point to another, for example, would not require reconfiguration at the service provider’s DHCPv6 servers.

The subscriber-id information is only intended for use within a single administrative domain and is only exchanged between the relay agents and DHCPv6 servers within that domain. Therefore, the format and encoding of the data in the option is not standardized, and this specification does not establish any semantic requirements on the data. This specification only defines the option for conveying this information from relay agents to DHCPv6 servers.

However, as the DHCPv4 Subscriber-ID suboption [3] specifies Network Virtual Terminal (NVT) American Standard Code for Information Interchange (ASCII) [4] encoded data, in environments where both DHCPv4 [5] and DHCPv6 are being used, it may be beneficial to use that encoding.

The format of the DHCPv6 Relay Agent Subscriber-ID 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_SUBSCRIBER_ID      |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
.                         subscriber-id                         .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_SUBSCRIBER_ID (38)
option-len
length, in octets, of the subscriber-id field. The minimum length is 1 octet.
subscriber-id
The subscriber’s identity.
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 = 38
save() → Union[source]

Save the internal state of this object as a buffer.

Returns:The buffer with the data from this element
subscriber_id = None

The subscriber-id as bytes

validate()[source]

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