Page MenuHomeVyOS Platform

DHCPv6 leases traceback when PD using
Closed, ResolvedPublicBUG

Description

When the client got IPv6 from DHCPv6 server, does not possible see leases

vyos@debian# run show dhcpv6 server leases 
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 209, in <module>
    leases = get_leases(conf, lease_file, args.state, args.pool, args.sort)
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in get_leases
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in <lambda>
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '2001:db8:290::/64' does not appear to be an IPv4 or IPv6 address

Reproducing steps:

set service dhcpv6-server shared-network-name VyOS-DHCPv6 subnet 2001:db8:3456::/64 address-range start 2001:db8:3456::100 stop '2001:db8:3456::1ff'
set service dhcpv6-server shared-network-name VyOS-DHCPv6 subnet 2001:db8:3456::/64 name-server '2001:db8:daad::1'
set service dhcpv6-server shared-network-name VyOS-DHCPv6 subnet 2001:db8:3456::/64 prefix-delegation start 2001:db8:290:: prefix-length '64'
set service dhcpv6-server shared-network-name VyOS-DHCPv6 subnet 2001:db8:3456::/64 prefix-delegation start 2001:db8:290:: stop '2001:db8:290::'

Details

Version
1.4-rolling-202104221210
Is it a breaking change?
Perfectly compatible

Event Timeline

Unknown Object (User) created this task.Apr 23 2021, 2:25 PM
Unknown Object (User) changed the task status from Open to Needs testing.Apr 26 2021, 9:45 AM
Unknown Object (User) claimed this task.

Work as expected on 1.4-rolling-202104260417

vyos@R1:~$ show dhcpv6 server leases 
IPv6 address        State    Last communication    Lease expiration     Remaining    Type               Pool         IAID_DUID
------------------  -------  --------------------  -------------------  -----------  -----------------  -----------  -----------------------------------------------------
2001:db8:290::/64   active   2021/04/23 14:52:48                                     prefix delegation  VyOS-DHCPv6  00:00:00:00:00:01:00:01:28:15:9b:bd:50:00:00:06:00:00
2001:db8:3456::15b  active   2021/04/27 05:07:51   2021/04/27 17:07:51  10:28:27     non-temporary      VyOS-DHCPv6  00:00:00:00:00:01:00:01:28:15:9b:bd:50:00:00:06:00:00

Please, cherry-pick it to 1.3

Please backport this to 1.3. Thanks.

syncer closed this task as Unknown Status.Oct 17 2021, 3:40 PM
syncer triaged this task as Normal priority.
syncer moved this task from Open to Finished on the VyOS 1.4 Sagitta board.

Checked DHCPv6 server on version: VyOS 1.3.0-epa2

vyos@vyos# run show dhcpv6 server leases
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 209, in <module>
    leases = get_leases(conf, lease_file, args.state, args.pool, args.sort)
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in get_leases
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in <lambda>
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '2001:cafe:fefe:ffff::/64' does not appear to be an IPv4 or IPv6 address
[edit]

Configuring dhcpv6 on the server:

set service dhcpv6-server shared-network-name DHCPv6 subnet 2001:cafe:fefe::/48 address-range start 2001:cafe:fefe::100 stop '2001:cafe:fefe::1000'
set service dhcpv6-server shared-network-name PREFIX subnet 2001:cafe:fefe::/48 prefix-delegation start 2001:cafe:fefe:1111:: prefix-length '64'
set service dhcpv6-server shared-network-name PREFIX subnet 2001:cafe:fefe::/48 prefix-delegation start 2001:cafe:fefe:1111:: stop '2001:cafe:fefe:ffff::'

An interesting thing that I get the error with that configuration:

set service dhcpv6-server shared-network-name DHCPv6 subnet 2001:cafe:fefe::/48 address-range start 2001:cafe:fefe::100 stop '2001:cafe:fefe::1000'
set service dhcpv6-server shared-network-name PREFIX subnet 2001:cafe:fefe::/48 prefix-delegation start 2001:cafe:fefe:1111:: prefix-length '64'
set service dhcpv6-server shared-network-name PREFIX subnet 2001:cafe:fefe::/48 prefix-delegation start 2001:cafe:fefe:1111:: stop '2001:cafe:fefe:ffff::'

Commit:

vyos@r4-epa# commit
[ service dhcpv6-server ]
VyOS had an issue completing a command.


Report time:      2021-10-19 22:13:39
Image version:    VyOS 1.3.0-epa2
Release train:    equuleus

Built by:         Sentrium S.L.
Built on:         Sun 17 Oct 2021 17:35 UTC
Build UUID:       2a282866-08cf-40fc-82a1-29ac261d3fb4
Build commit ID:  defac161082bc3-dirty

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    6f3ac57f-f80f-4b11-9abc-56bdc6f0e33d

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/dhcpv6_server.py", line 183, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/dhcpv6_server.py", line 131, in verify
    raise ConfigError('DHCPv6 subnets must be unique! Subnet {0} defined multiple times!'.format(subnet['network']))
TypeError: string indices must be integers



[[service dhcpv6-server]] failed
Commit failed
[edit]
vyos@r4-epa#

But it is a separate task T3918

Unknown Object (User) changed the task status from Unknown Status to Resolved.Feb 15 2022, 9:30 AM

Tested on VyOS version 1.3.0, works properly

vyos@vyos# run show version | match Version
Version:          VyOS 1.3.0
[edit]
vyos@vyos# run show dhcpv6 server leases 
IPv6 address        State    Last communication    Lease expiration     Remaining    Type           Pool         IAID_DUID
------------------  -------  --------------------  -------------------  -----------  -------------  -----------  -----------------------------------------------------------------
2001:db8:3456::187  active   2022/02/15 09:28:10   2022/02/15 21:28:10  11:58:28     non-temporary  VyOS-DHCPv6  00:00:00:00:00:04:79:76:62:99:23:ad:43:fb:9c:5b:1c:1e:59:4b:58:01
Unknown Object (User) changed the task status from Resolved to Unknown Status.Feb 15 2022, 9:40 AM

Sorry, it works properly only for not PD. Looks like is not backported to equuleus
Client-side configuration to reproduce

set interfaces ethernet eth0 address 'dhcpv6'
set interfaces ethernet eth0 dhcpv6-options pd 0 interface eth1 address '1'
set interfaces ethernet eth0 dhcpv6-options pd 0 interface eth1 sla-id '0'
set interfaces ethernet eth0 dhcpv6-options pd 0 length '64'

On server-side we get the same backtrace

vyos@vyos# run show dhcpv6 server leases 
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 209, in <module>
    leases = get_leases(conf, lease_file, args.state, args.pool, args.sort)
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in get_leases
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/libexec/vyos/op_mode/show_dhcpv6.py", line 142, in <lambda>
    leases = sorted(leases, key = lambda k: int(ip_address(k['ip'])))
  File "/usr/lib/python3.7/ipaddress.py", line 54, in ip_address
    address)
ValueError: '2001:db8:290::/64' does not appear to be an IPv4 or IPv6 address
Unknown Object (User) changed the task status from Unknown Status to Resolved.Feb 15 2022, 6:58 PM