diff options
author | Jose Phillips <jose@latinol.com> | 2024-01-16 23:35:14 -0500 |
---|---|---|
committer | Jose Phillips <jose@latinol.com> | 2024-01-16 23:35:14 -0500 |
commit | 62a8ef29d6238d5b777c3e946c132aca16a813c3 (patch) | |
tree | 3f8c1d266dfe7c47d3db2bbe61511017fd9ce7c6 /src/conf_mode/service_dhcp-server.py | |
parent | 9171b2912a6adbe88de4eeacbcc83cea5c941e48 (diff) | |
download | vyos-1x-62a8ef29d6238d5b777c3e946c132aca16a813c3.tar.gz vyos-1x-62a8ef29d6238d5b777c3e946c132aca16a813c3.zip |
dhcp: T5952: Fix validate duplicate MAC Address on same subnet
Diffstat (limited to 'src/conf_mode/service_dhcp-server.py')
-rwxr-xr-x | src/conf_mode/service_dhcp-server.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py index 2418c8faa..b11fa7c1a 100755 --- a/src/conf_mode/service_dhcp-server.py +++ b/src/conf_mode/service_dhcp-server.py @@ -233,6 +233,7 @@ def verify(dhcp): if 'static_mapping' in subnet_config: # Static mappings require just a MAC address (will use an IP from the dynamic pool if IP is not set) used_ips = [] + used_mac = [] for mapping, mapping_config in subnet_config['static_mapping'].items(): if 'ip_address' in mapping_config: if ip_address(mapping_config['ip_address']) not in ip_network(subnet): @@ -247,7 +248,11 @@ def verify(dhcp): if mapping_config['ip_address'] in used_ips: raise ConfigError(f'Configured IP address for static mapping "{mapping}" exists on another static mapping') + if mapping_config['mac'] in used_mac: + raise ConfigError(f'Configured MAC address for static mapping "{mapping}" exists on another static mapping') + used_ips.append(mapping_config['ip_address']) + used_mac.append(mapping_config['mac']) # There must be one subnet connected to a listen interface. # This only counts if the network itself is not disabled! |