summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2026-05-22 11:56:04 +0300
committerGitHub <noreply@github.com>2026-05-22 11:56:04 +0300
commit88b93c96faa5b1016546cbc15d1327b4692a87cc (patch)
tree53c60f5bc9c455f9fcaa05e528fa2de562aeb750 /src
parent6fa4967f49e988e4979c611ee9199bb14bef8536 (diff)
parente97437c52d2d21b7e662d5569f668615aaee2d98 (diff)
downloadvyos-1x-88b93c96faa5b1016546cbc15d1327b4692a87cc.tar.gz
vyos-1x-88b93c96faa5b1016546cbc15d1327b4692a87cc.zip
Merge pull request #5198 from indrajitr/T8862-dhcpv6-reservation-multi
dhcpv6: T8862: Allow multiple addresses and prefixes for reservations
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/service_dhcpv6-server.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/conf_mode/service_dhcpv6-server.py b/src/conf_mode/service_dhcpv6-server.py
index 88d34bf61..01bbf3096 100755
--- a/src/conf_mode/service_dhcpv6-server.py
+++ b/src/conf_mode/service_dhcpv6-server.py
@@ -226,13 +226,18 @@ def verify(dhcpv6):
for mapping, mapping_config in subnet_config['static_mapping'].items():
if 'ipv6_address' in mapping_config:
# Static address must be in subnet
- if ip_address(mapping_config['ipv6_address']) not in ip_network(subnet):
- raise ConfigError(f'static-mapping address for mapping "{mapping}" is not in subnet "{subnet}"!')
-
- if ('mac' not in mapping_config and 'duid' not in mapping_config) or \
- ('mac' in mapping_config and 'duid' in mapping_config):
- raise ConfigError(f'Either MAC address or Client identifier (DUID) is required for '
- f'static mapping "{mapping}" within shared-network "{network}, {subnet}"!')
+ for address in mapping_config['ipv6_address']:
+ if ip_address(address) not in ip_network(subnet):
+ raise ConfigError(f'static-mapping address for mapping "{mapping}" is not in subnet "{subnet}"!')
+
+ if ('ipv6_address' not in mapping_config and 'ipv6_prefix' not in mapping_config):
+ raise ConfigError('Either IPv6 address or IPv6 prefix must be set for static mapping '
+ f'"{mapping}" within shared-network "{network}, {subnet}"!')
+
+ if ('mac' not in mapping_config and 'duid' not in mapping_config) or \
+ ('mac' in mapping_config and 'duid' in mapping_config):
+ raise ConfigError('Either MAC address or Client identifier (DUID) is required for '
+ f'static mapping "{mapping}" within shared-network "{network}, {subnet}"!')
if 'option' in subnet_config:
if 'vendor_option' in subnet_config['option']: