dhcpkit.ipv6.extensions.remote_id module

Implementation of Remote-ID option as specified in RFC 4649.

class dhcpkit.ipv6.extensions.remote_id.RemoteIdOption(enterprise_number: int = 0, remote_id: bytes = b'')[source]

Bases: dhcpkit.ipv6.options.Option

RFC 4649#section-3

This option may be added by DHCPv6 relay agents that terminate switched or permanent circuits and have mechanisms to identify the remote host end of the circuit.

The format of the DHCPv6 Relay Agent Remote-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_REMOTE_ID        |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       enterprise-number                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
.                           remote-id                           .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_REMOTE_ID (37).
option-len
4 + the length, in octets, of the remote-id field. The minimum option-len is 5 octets.
enterprise-number
The vendor’s registered Enterprise Number as registered with IANA [5].
remote-id
The opaque value for the remote-id.

The definition of the remote-id carried in this option is vendor specific. The vendor is indicated in the enterprise-number field. The remote-id field may be used to encode, for instance:

  • a “caller ID” telephone number for dial-up connection
  • a “user name” prompted for by a Remote Access Server
  • a remote caller ATM address
  • a “modem ID” of a cable data modem
  • the remote IP address of a point-to-point link
  • a remote X.25 address for X.25 connections
  • an interface or port identifier

Each vendor must ensure that the remote-id is unique for its enterprise-number, as the octet sequence of enterprise-number followed by remote-id must be globally unique. One way to achieve uniqueness might be to include the relay agent’s DHCP Unique Identifier (DUID) [1] in the remote-id.

enterprise_number = None

The enterprise number as registered with IANA

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 = 37
remote_id = None

The remote-id as bytes

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.