changeset 2490:19b7947d234c draft

Only remove the interface from DHCP consideration if the error sending a packet is not a network error.
author Roy Marples <roy@marples.name>
date Tue, 20 May 2014 08:36:12 +0000
parents a7bd17a62fde
children 6ec3f4009bb4
files dhcp.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp.c	Mon May 19 00:49:14 2014 +0000
+++ b/dhcp.c	Tue May 20 08:36:12 2014 +0000
@@ -1613,11 +1613,19 @@
 		if (r == -1) {
 			syslog(LOG_ERR, "%s: if_sendrawpacket: %m",
 			    iface->name);
-			if (!(iface->ctx->options & DHCPCD_TEST))
-				dhcp_drop(iface, "FAIL");
-			dhcp_close(iface);
-			eloop_timeout_delete(iface->ctx->eloop, NULL, iface);
-			callback = NULL;
+			switch(errno) {
+			case ENETDOWN:
+			case ENETRESET:
+			case ENETUNREACH:
+				break;
+			default:
+				if (!(iface->ctx->options & DHCPCD_TEST))
+					dhcp_drop(iface, "FAIL");
+				dhcp_close(iface);
+				eloop_timeout_delete(iface->ctx->eloop,
+				    NULL, iface);
+				callback = NULL;
+			}
 		}
 	}
 	free(dhcp);