dhcpkit.ipv6.extensions.sntp module

Implementation of SNTP option as specified in RFC 4075.

class dhcpkit.ipv6.extensions.sntp.SNTPServersOption(sntp_servers: Iterable = None)[source]

Bases: dhcpkit.ipv6.options.Option

RFC 4075#section-4

The Simple Network Time Protocol servers option provides a list of one or more IPv6 addresses of SNTP [3] servers available to the client for synchronization. The clients use these SNTP servers to synchronize their system time to that of the standard time servers. Clients MUST treat the list of SNTP servers as an ordered list. The server MAY list the SNTP servers in decreasing order of preference.

The option defined in this document can only be used to configure information about SNTP servers that can be reached using IPv6. The DHCP option to configure information about IPv4 SNTP servers can be found in RFC 2132 [4]. Mechanisms for configuring IPv4/IPv6 dual- stack applications are being considered, but are not specified in this document.

The format of the Simple Network Time Protocol servers option is as 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_SNTP_SERVERS       |        option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                  SNTP server (IPv6 address)                   |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                  SNTP server (IPv6 address)                   |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ...                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_SNTP_SERVERS (31).
option-len
Length of the ‘SNTP server’ fields, in octets; it must be a multiple of 16.
SNTP server
IPv6 address of SNTP server.
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 = 31
save() → Union[source]

Save the internal state of this object as a buffer.

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

List of IPv6 addresses of SNTP servers

validate()[source]

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