diff options
-rw-r--r-- | smoketest/configs/basic-vyos | 19 | ||||
-rwxr-xr-x | src/migration-scripts/dhcpv6-server/4-to-5 | 28 |
2 files changed, 43 insertions, 4 deletions
diff --git a/smoketest/configs/basic-vyos b/smoketest/configs/basic-vyos index c42f14841..76aa52039 100644 --- a/smoketest/configs/basic-vyos +++ b/smoketest/configs/basic-vyos @@ -22,6 +22,7 @@ interfaces { address 100.64.200.254/24 vif-c 201 { address 100.64.201.254/24 + address fe89::1/56 } vif-c 202 { address 100.64.202.254/24 @@ -111,6 +112,24 @@ service { } } } + subnet fe89::/56 { + address-range { + prefix fe89::/60 { + temporary + } + start fe89:0000:0000:fe:: { + stop fe89:0000:0000:ff:: + } + } + domain-search vyos.net + name-server fe89::1 + prefix-delegation { + start fe89:0000:0000:0001:: { + prefix-length 64 + stop fe89:0000:0000:0010:: + } + } + } } } dns { diff --git a/src/migration-scripts/dhcpv6-server/4-to-5 b/src/migration-scripts/dhcpv6-server/4-to-5 index e808edbe0..ae506b9c5 100755 --- a/src/migration-scripts/dhcpv6-server/4-to-5 +++ b/src/migration-scripts/dhcpv6-server/4-to-5 @@ -39,14 +39,34 @@ if not config.exists(base): def find_subnet_interface(subnet): subnet_net = ip_network(subnet) + def check_addr(if_path): + if config.exists(if_path + ['address']): + for addr in config.return_values(if_path + ['address']): + if ip_network(addr, strict=False) == subnet_net: + return True + return None + for iftype in config.list_nodes(['interfaces']): for ifname in config.list_nodes(['interfaces', iftype]): if_base = ['interfaces', iftype, ifname] - if config.exists(if_base + ['address']): - for addr in config.return_values(if_base + ['address']): - if ip_network(addr, strict=False) == subnet_net: - return ifname + if check_addr(if_base): + return ifname + + if config.exists(if_base + ['vif']): + for vif in config.list_nodes(if_base + ['vif']): + if check_addr(if_base + ['vif', vif]): + return f'{ifname}.{vif}' + + if config.exists(if_base + ['vif-s']): + for vifs in config.list_nodes(if_base + ['vif-s']): + if check_addr(if_base + ['vif-s', vifs]): + return f'{ifname}.{vifs}' + + if config.exists(if_base + ['vif-s', vifs, 'vif-c']): + for vifc in config.list_nodes(if_base + ['vif-s', vifs, 'vif-c']): + if check_addr(if_base + ['vif-s', vifs, 'vif-c', vifc]): + return f'{ifname}.{vifs}.{vifc}' return False |