dhcpkit.ipv6.extensions.dns module

Implementation of DNS options as specified in RFC 3646.

class dhcpkit.ipv6.extensions.dns.DomainSearchListOption(search_list: Iterable = None)[source]

Bases: dhcpkit.ipv6.options.Option

RFC 3646#section-4

The Domain Search List option specifies the domain search list the client is to use when resolving hostnames with DNS. This option does not apply to other name resolution mechanisms.

The format of the Domain Search List option is:

 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_DOMAIN_LIST       |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          searchlist                           |
|                              ...                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_DOMAIN_LIST (24).
option-len
Length of the ‘searchlist’ field in octets.
searchlist
The specification of the list of domain names in the Domain Search List.

The list of domain names in the ‘searchlist’ MUST be encoded as specified in section “Representation and use of domain names” of RFC 3315.

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 = 24
save() → Union[source]

Save the internal state of this object as a buffer.

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

List of domain names to use as a search list

validate()[source]

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

class dhcpkit.ipv6.extensions.dns.RecursiveNameServersOption(dns_servers: Iterable = None)[source]

Bases: dhcpkit.ipv6.options.Option

RFC 3646#section-3

The DNS Recursive Name Server option provides a list of one or more IPv6 addresses of DNS recursive name servers to which a client’s DNS resolver MAY send DNS queries [1]. The DNS servers are listed in the order of preference for use by the client resolver.

The format of the DNS Recursive Name Server option is:

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_DNS_SERVERS       |         option-len            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|            DNS-recursive-name-server (IPv6 address)           |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|            DNS-recursive-name-server (IPv6 address)           |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ...                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
option-code
OPTION_DNS_SERVERS (23).
option-len
Length of the list of DNS recursive name servers in octets; must be a multiple of 16.
DNS-recursive-name-server
IPv6 address of DNS recursive name server.
dns_servers = None

List of IPv6 addresses of resolving DNS servers

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 = 23
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.