diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-05-22 11:56:04 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-22 11:56:04 +0300 |
| commit | 88b93c96faa5b1016546cbc15d1327b4692a87cc (patch) | |
| tree | 53c60f5bc9c455f9fcaa05e528fa2de562aeb750 /src | |
| parent | 6fa4967f49e988e4979c611ee9199bb14bef8536 (diff) | |
| parent | e97437c52d2d21b7e662d5569f668615aaee2d98 (diff) | |
| download | vyos-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-x | src/conf_mode/service_dhcpv6-server.py | 19 |
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']: |
