From f31c6094c5770be2fbb45a283faccf40a9e3a650 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 20 May 2014 08:36:12 +0000 Subject: [PATCH] Only remove the interface from DHCP consideration if the error sending a packet is not a network error. --- dhcp.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dhcp.c b/dhcp.c index a89d4bf8..2d0fe3cc 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1613,11 +1613,19 @@ send_message(struct interface *iface, uint8_t type, 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); -- 2.47.3