diff options
author | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2024-01-22 20:29:42 +0100 |
---|---|---|
committer | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2024-01-22 20:29:42 +0100 |
commit | c5b9edb2f76322e27c3eb0092e4e02d1591fef82 (patch) | |
tree | 2bc10787e78f2f1a4198a683a347d81d0938c8d2 /src/conf_mode/service_dhcp-server.py | |
parent | 90a50f8c21433188257766be1b971cae365a7a0c (diff) | |
download | vyos-1x-c5b9edb2f76322e27c3eb0092e4e02d1591fef82.tar.gz vyos-1x-c5b9edb2f76322e27c3eb0092e4e02d1591fef82.zip |
dhcp: T5787: Allow disabled duplicates on static-mapping
Diffstat (limited to 'src/conf_mode/service_dhcp-server.py')
-rwxr-xr-x | src/conf_mode/service_dhcp-server.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py index 9632b91fc..91ea354b6 100755 --- a/src/conf_mode/service_dhcp-server.py +++ b/src/conf_mode/service_dhcp-server.py @@ -246,19 +246,21 @@ def verify(dhcp): raise ConfigError(f'Either MAC address or Client identifier (DUID) is required for ' f'static mapping "{mapping}" within shared-network "{network}, {subnet}"!') - if mapping_config['ip_address'] in used_ips: - raise ConfigError(f'Configured IP address for static mapping "{mapping}" already exists on another static mapping') - used_ips.append(mapping_config['ip_address']) - - if 'mac' in mapping_config: - if mapping_config['mac'] in used_mac: - raise ConfigError(f'Configured MAC address for static mapping "{mapping}" already exists on another static mapping') - used_mac.append(mapping_config['mac']) - - if 'duid' in mapping_config: - if mapping_config['duid'] in used_duid: - raise ConfigError(f'Configured DUID for static mapping "{mapping}" already exists on another static mapping') - used_duid.append(mapping_config['duid']) + if 'disable' not in mapping_config: + if mapping_config['ip_address'] in used_ips: + raise ConfigError(f'Configured IP address for static mapping "{mapping}" already exists on another static mapping') + used_ips.append(mapping_config['ip_address']) + + if 'disable' not in mapping_config: + if 'mac' in mapping_config: + if mapping_config['mac'] in used_mac: + raise ConfigError(f'Configured MAC address for static mapping "{mapping}" already exists on another static mapping') + used_mac.append(mapping_config['mac']) + + if 'duid' in mapping_config: + if mapping_config['duid'] in used_duid: + raise ConfigError(f'Configured DUID for static mapping "{mapping}" already exists on another static mapping') + used_duid.append(mapping_config['duid']) # There must be one subnet connected to a listen interface. # This only counts if the network itself is not disabled! |