diff options
author | Christian Breunig <christian@breunig.cc> | 2024-02-15 23:51:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-15 23:51:50 +0100 |
commit | 2ff7d80f44aa1bc8429b18417cd63eb6f7105eef (patch) | |
tree | bf443e9fef6129e26fe85eb3d9f36be4e7966d30 /src/migration-scripts/dhcpv6-server | |
parent | f01d45e9117d39a4e3f30590e9dd2dbd9fcf9d77 (diff) | |
parent | 324c8a5d5b9883a50a01e23ab0f2c3967253023e (diff) | |
download | vyos-1x-2ff7d80f44aa1bc8429b18417cd63eb6f7105eef.tar.gz vyos-1x-2ff7d80f44aa1bc8429b18417cd63eb6f7105eef.zip |
Merge pull request #3012 from sarthurdev/T5993
dhcpv6-server: T5993: Extend interface migrator to check VLAN/QinQ
Diffstat (limited to 'src/migration-scripts/dhcpv6-server')
-rwxr-xr-x | src/migration-scripts/dhcpv6-server/4-to-5 | 28 |
1 files changed, 24 insertions, 4 deletions
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 |