diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-03-24 14:16:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-24 14:16:45 +0200 |
| commit | fa52679b3d5342cd2f19da27c500b5f4996dfc9c (patch) | |
| tree | dff3c6d2b3ef2f2cba0b075c8fb3d2c60ba5b20e | |
| parent | 45757aef36075b1706ae71b78aec072b952af26c (diff) | |
| parent | 65844cbb8bc47ec1d2f69e02615fa2e0f29389c8 (diff) | |
| download | vyos-1x-fa52679b3d5342cd2f19da27c500b5f4996dfc9c.tar.gz vyos-1x-fa52679b3d5342cd2f19da27c500b5f4996dfc9c.zip | |
Merge pull request #5062 from alexk37/fix-dhcpv6-server-subnet-validation
T8399: dhcpv6-server: move connectivity/overlap checks inside subnet loop
| -rwxr-xr-x | src/conf_mode/service_dhcpv6-server.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/conf_mode/service_dhcpv6-server.py b/src/conf_mode/service_dhcpv6-server.py index d7b2f2a6d..b567c8ed9 100755 --- a/src/conf_mode/service_dhcpv6-server.py +++ b/src/conf_mode/service_dhcpv6-server.py @@ -241,22 +241,22 @@ def verify(dhcpv6): subnets.append(subnet) - # DHCPv6 requires at least one configured address range or one static mapping - # (FIXME: is not actually checked right now?) - - # There must be one subnet connected to a listen interface if network is not disabled. - if 'disable' not in network_config: - if is_subnet_connected(subnet): - listen_ok = True - - # DHCPv6 subnet must not overlap. ISC DHCP also complains about overlapping - # subnets: "Warning: subnet 2001:db8::/32 overlaps subnet 2001:db8:1::/32" - net = ip_network(subnet) - for n in subnets: - net2 = ip_network(n) - if (net != net2): - if net.overlaps(net2): - raise ConfigError('DHCPv6 conflicting subnet ranges: {0} overlaps {1}'.format(net, net2)) + # DHCPv6 requires at least one configured address range or one static mapping + # (FIXME: is not actually checked right now?) + + # There must be one subnet connected to a listen interface if network is not disabled. + if 'disable' not in network_config: + if is_subnet_connected(subnet): + listen_ok = True + + # DHCPv6 subnet must not overlap. ISC DHCP also complains about overlapping + # subnets: "Warning: subnet 2001:db8::/32 overlaps subnet 2001:db8:1::/32" + net = ip_network(subnet) + for n in subnets: + net2 = ip_network(n) + if (net != net2): + if net.overlaps(net2): + raise ConfigError('DHCPv6 conflicting subnet ranges: {0} overlaps {1}'.format(net, net2)) if not listen_ok: raise ConfigError('None of the DHCPv6 subnets are connected to a subnet6 on '\ |
