]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only remove the interface from DHCP consideration if the error
authorRoy Marples <roy@marples.name>
Tue, 20 May 2014 08:36:12 +0000 (08:36 +0000)
committerRoy Marples <roy@marples.name>
Tue, 20 May 2014 08:36:12 +0000 (08:36 +0000)
sending a packet is not a network error.

dhcp.c

diff --git a/dhcp.c b/dhcp.c
index a89d4bf8c9f15a2d5d2a408365ffcbea2f2b1454..2d0fe3ccf2a378ca237d6e92c22e32fcbd623a5b 100644 (file)
--- 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);