Page MenuHomeVyOS Platform

dhcpv6-server migration script 4-to-5 errors out
Closed, ResolvedPublicBUG

Description

When upgrading from 1.5-rolling-202402090022 to 1.5-rolling-202403050022, the 4-to-5 migration script errored out at boot time.

From trying to re-trigger the migration script manually:

Traceback (most recent call last):
  File "/opt/vyatta/etc/config-migrate/migrate/dhcpv6-server/4-to-5", line 78, in <module>
    subnet_interface = find_subnet_interface(subnet)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/vyatta/etc/config-migrate/migrate/dhcpv6-server/4-to-5", line 53, in find_subnet_interface
    if check_addr(if_base):
       ^^^^^^^^^^^^^^^^^^^
  File "/opt/vyatta/etc/config-migrate/migrate/dhcpv6-server/4-to-5", line 45, in check_addr
    if ip_network(addr, strict=False) == subnet_net:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ipaddress.py", line 83, in ip_network
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 network')
ValueError: 'dhcp' does not appear to be an IPv4 or IPv6 network

Relevant configuration in my setup:

lucas@router# show service dhcpv6-server
 shared-network-name LAN-10Gv6 {
     common-options {
         domain-search <redacted>
         name-server fdcc:2200:a8ee:2356::1
     }
     subnet fdcc:2200:a8ee:2356::0/64 {
         subnet-id 1
     }
 }
 shared-network-name LANv6 {
     common-options {
         domain-search <redacted>
         name-server fdcc:2200:a8ee:2355::1
     }
     subnet fdcc:2200:a8ee:2355::0/64 {
         subnet-id 2
     }
 }
 shared-network-name Management-LANv6 {
     common-options {
         domain-search <redacted>
         name-server fdcc:2200:a8ee:2354::1
     }
     subnet fdcc:2200:a8ee:2354::0/64 {
         subnet-id 3
     }
 }

Relevant section of interface config that seems to be causing the problem:

ethernet eth1 {
    address dhcp
    address dhcpv6
    description WAN
    ...
}

The migration script seems to choke on "address dhcp" (or any "address" line that does not contain a valid IPv4 or IPv6 address). To fix we probably need to ignore those values that are magic string such as "dhcp" and "dhcpv6".

Details

Difficulty level
Easy (less than an hour)
Version
1.5-rolling-202403050022
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)