diff options
author | Christian Breunig <christian@breunig.cc> | 2024-01-22 21:39:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 21:39:20 +0100 |
commit | e2d46861092dedc18f6bd3c37736ac87cbfb5132 (patch) | |
tree | 2bc10787e78f2f1a4198a683a347d81d0938c8d2 /src/conf_mode | |
parent | 90a50f8c21433188257766be1b971cae365a7a0c (diff) | |
parent | c5b9edb2f76322e27c3eb0092e4e02d1591fef82 (diff) | |
download | vyos-1x-e2d46861092dedc18f6bd3c37736ac87cbfb5132.tar.gz vyos-1x-e2d46861092dedc18f6bd3c37736ac87cbfb5132.zip |
Merge pull request #2879 from sarthurdev/T5787_disabled
dhcp: T5787: Allow disabled duplicates on static-mapping
Diffstat (limited to 'src/conf_mode')
-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! |