Page MenuHomeVyOS Platform

Showing DHCPv6 leases can fail due to DUID parsing issues
Closed, ResolvedPublicBUG

Description

$ show dhcpv6 server leases 

Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/dhcp.py", line 427, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 263, in run
    res = func(**args)
          ^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/dhcp.py", line 264, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/dhcp.py", line 317, in show_server_leases
    lease_data = _get_raw_server_leases(family=family, pool=pool, sorted=sorted, state=state, origin=origin)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/dhcp.py", line 108, in _get_raw_server_leases
    data_lease['duid'] = _format_hex_string(lease.duid)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/dhcp.py", line 54, in _format_hex_string
    out_str = ':'.join(a+b for a,b in zip(in_str[::2], in_str[1::2]))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, int found

To reproduce:

Add a dhcpv6 lease to /config/dhcpv6.leases

ia-na "\334\005\2750\000\004\004\360.\224\341h\033#\243\261d\344'\275b6" {
  cltt 5 2024/06/07 14:22:18;
  iaaddr fd00::1:0:0:ffff:b1d9 {
    binding state active;
    preferred-life 7200;
    max-life 7500;
    ends 5 2024/06/07 16:27:18;
  }
}

Then try to list it with show dhcpv6 server leases

Details

Difficulty level
Easy (less than an hour)
Version
1.4.0-GA
Why the issue appeared?
Implementation mistake
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

please , Could you share configuration on how to replicate it ? it's also here the guideline about report a bug :

https://blog.vyos.io/feature-requests-and-bug-reports-guidelines

Currently I'm not sure, might be related to changes from T4519

Added an example how to reproduce it

c-po assigned this task to nvollmar.
c-po edited projects, added VyOS 1.4 Sagitta (1.4.1); removed VyOS 1.4 Sagitta.
c-po changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
c-po changed Why the issue appeared? from Will be filled on close to Implementation mistake.
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
c-po changed Issue type from Unspecified (please specify) to Bug (incorrect behavior).
c-po moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta (1.4.1) board.
dmbaturin renamed this task from Showing DHCPv6 leases fails to Showing DHCPv6 leases can fail due to DUID parsing issues.Jul 1 2024, 2:37 PM
dmbaturin triaged this task as High priority.