changeset 2881:0d45224bdcb5 draft

Allow other processes to handle the DHCP port on the wildcard address.
author Roy Marples <roy@marples.name>
date Tue, 09 Dec 2014 12:52:52 +0000
parents 53d7e046daee
children c64e9ca0f9c2
files dhcp.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp.c	Tue Dec 09 09:45:56 2014 +0000
+++ b/dhcp.c	Tue Dec 09 12:52:52 2014 +0000
@@ -3074,11 +3074,14 @@
 	if (ifp->ctx->udp_fd == -1) {
 		ifp->ctx->udp_fd = dhcp_openudp(NULL);
 		if (ifp->ctx->udp_fd == -1) {
-			syslog(LOG_ERR, "dhcp_openudp: %m");
-			return;
-		}
-		eloop_event_add(ifp->ctx->eloop,
-		    ifp->ctx->udp_fd, dhcp_handleudp, ifp->ctx, NULL, NULL);
+			/* Don't log an error if some other process
+			 * is handling this. */
+			if (errno != EADDRINUSE)
+				syslog(LOG_ERR, "dhcp_openudp: %m");
+		} else
+			eloop_event_add(ifp->ctx->eloop,
+			    ifp->ctx->udp_fd, dhcp_handleudp,
+			    ifp->ctx, NULL, NULL);
 	}
 
 	if (dhcp_init(ifp) == -1) {