diff options
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/dhcp_server.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index 485b25e4c..fc8855f9f 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -664,9 +664,14 @@ def verify(dhcp): failover_names = [] listen_ok = False subnets = [] + shared_networks = len(dhcp['shared_network']) + disabled_shared_networks = 0 # A shared-network requires a subnet definition for network in dhcp['shared_network']: + if network['disabled']: + disabled_shared_networks += 1 + if len(network['subnet']) == 0: raise ConfigError('No DHCP lease subnets configured for {0}. At least one\n' \ 'lease subnet must be configured for each shared network.'.format(network['name'])) @@ -793,6 +798,10 @@ def verify(dhcp): if net.overlaps(net2): raise ConfigError('DHCP conflicting subnet ranges: {0} overlaps {1}'.format(net, net2)) + # Prevent 'disable' for shared-network if only one network is configured + if (shared_networks - disabled_shared_networks) < 1: + raise ConfigError('At least one shared network must be active!') + if not listen_ok: raise ConfigError('DHCP server configuration error!\n' \ 'None of configured DHCP subnets does not have appropriate\n' \ |