dhcpkit.ipv6.utils module

Utility functions for IPv6 DHCP

dhcpkit.ipv6.utils.address_in_prefixes(address: ipaddress.IPv6Address, prefixes: Iterable) → bool[source]

Check whether the given address is part of one of the given prefixes

Parameters:
  • address – The IPv6 address to check
  • prefixes (list[IPv6Network]) – The list of IPv6 prefixes
Returns:

Whether the address is part of one of the prefixes

dhcpkit.ipv6.utils.is_global_unicast(address: ipaddress.IPv6Address) → bool[source]

Check if an address is a global unicast address according to RFC 4291.

Parameters:address – The address to check
Returns:Whether it is a global unicast address
dhcpkit.ipv6.utils.prefix_overlaps_prefixes(prefix: ipaddress.IPv6Network, prefixes: Iterable) → bool[source]

Check whether the given address is part of one of the given prefixes

Parameters:
  • prefix – The IPv6 prefix to check
  • prefixes (list[IPv6Network]) – The list of IPv6 prefixes
Returns:

Whether the address is part of one of the prefixes

dhcpkit.ipv6.utils.split_relay_chain(message: dhcpkit.ipv6.messages.Message) → Tuple[source]

Separate the relay chain from the actual request message.

Parameters:message – The incoming message
Returns:The request and the chain of relay messages starting with the one closest to the client