summaryrefslogtreecommitdiff
path: root/src/conf_mode/dhcp_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/dhcp_server.py')
-rwxr-xr-xsrc/conf_mode/dhcp_server.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index 8ca72164a..556545e6d 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -703,10 +703,13 @@ def verify(dhcp):
# There must be one subnet connected to a real interface
#
for interface in netifaces.interfaces():
- # Retrieve IP address of network interface
- ip = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
- if ipaddress.ip_address(ip) in ipaddress.ip_network(subnet['network']):
- listen_ok = True
+ # Test if IPv4 addresses are configured at all
+ if netifaces.AF_INET in netifaces.ifaddresses(interface).keys():
+ # An interface can have multiple addresses, but ISC DHCP only supports the first :(
+ ip = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
+ if ipaddress.ip_address(ip) in ipaddress.ip_network(subnet['network']):
+ # Bingo! At least one subnet connected to an interface on this machine
+ listen_ok = True
#
# Subnets must be non overlapping