summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2024-01-07 21:41:23 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2024-01-10 00:42:22 +0100
commit74ddb29c6c9ce31450234e77fd39c73d0d51c3c5 (patch)
tree9e50995c79176629e5dc5641d91e0bac24d5fb10 /src/conf_mode
parentdaffee2cbf001dab13799f5b2b69330162491214 (diff)
downloadvyos-1x-74ddb29c6c9ce31450234e77fd39c73d0d51c3c5.tar.gz
vyos-1x-74ddb29c6c9ce31450234e77fd39c73d0d51c3c5.zip
dhcp: T3316: Fix `listen-address` handling and add `listen-interface` as supported by Kea
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/service_dhcp-server.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py
index 7ebc560ba..329e18993 100755
--- a/src/conf_mode/service_dhcp-server.py
+++ b/src/conf_mode/service_dhcp-server.py
@@ -31,6 +31,7 @@ from vyos.utils.file import chmod_775
from vyos.utils.file import makedir
from vyos.utils.file import write_file
from vyos.utils.process import call
+from vyos.utils.network import interface_exists
from vyos.utils.network import is_subnet_connected
from vyos.utils.network import is_addr_assigned
from vyos import ConfigError
@@ -294,12 +295,18 @@ def verify(dhcp):
else:
raise ConfigError(f'listen-address "{address}" not configured on any interface')
-
if not listen_ok:
raise ConfigError('None of the configured subnets have an appropriate primary IP address on any\n'
'broadcast interface configured, nor was there an explicit listen-address\n'
'configured for serving DHCP relay packets!')
+ if 'listen_address' in dhcp and 'listen_interface' in dhcp:
+ raise ConfigError(f'Cannot define listen-address and listen-interface at the same time')
+
+ for interface in (dict_search('listen_interface', dhcp) or []):
+ if not interface_exists(interface):
+ raise ConfigError(f'listen-interface "{interface}" does not exist')
+
return None
def generate(dhcp):