summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2026-05-14 08:57:06 -0500
committerIndrajit Raychaudhuri <irc@indrajit.com>2026-05-16 16:27:30 -0500
commite97437c52d2d21b7e662d5569f668615aaee2d98 (patch)
tree0cdaab045a0ed422a52d99ffcd65beed4d6309bb /src
parent28898e4477727c5d4406c227b0d056e6dfc1ce39 (diff)
downloadvyos-1x-e97437c52d2d21b7e662d5569f668615aaee2d98.tar.gz
vyos-1x-e97437c52d2d21b7e662d5569f668615aaee2d98.zip
dhcpv6: T8862: Add validation for presence of address or prefix in reservation
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/service_dhcpv6-server.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conf_mode/service_dhcpv6-server.py b/src/conf_mode/service_dhcpv6-server.py
index 6e3e3fad7..01bbf3096 100755
--- a/src/conf_mode/service_dhcpv6-server.py
+++ b/src/conf_mode/service_dhcpv6-server.py
@@ -230,10 +230,14 @@ def verify(dhcpv6):
if ip_address(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}"!')
+ 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']: