From f46fc9f7def929c060b31be830c836bdc29bda0e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 12 Jan 2022 09:27:49 -0500 Subject: [PATCH] Provide error about in-use dhcp The events will more clearly indicate when dnsmasq is not adequately configured. --- confluent_server/confluent/discovery/protocols/pxe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/pxe.py b/confluent_server/confluent/discovery/protocols/pxe.py index 8a8adda1..75476478 100644 --- a/confluent_server/confluent/discovery/protocols/pxe.py +++ b/confluent_server/confluent/discovery/protocols/pxe.py @@ -345,7 +345,11 @@ def snoop(handler, protocol=None, nodeguess=None): net4.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) net4.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) net4.setsockopt(socket.IPPROTO_IP, IP_PKTINFO, 1) - net4.bind(('', 67)) + try: + net4.bind(('', 67)) + except Exception: + log.log({'error': 'Unable to bind DHCP server port, if using dnsmasq, specify bind-dynamic in dnsmasq.conf and restart dnsmasq and then confluent'}) + return v6addr = socket.inet_pton(socket.AF_INET6, mcastv6addr) net6 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) net6.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)