]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix NAK backoff
authorRoy Marples <roy@marples.name>
Thu, 12 Dec 2013 10:24:14 +0000 (10:24 +0000)
committerRoy Marples <roy@marples.name>
Thu, 12 Dec 2013 10:24:14 +0000 (10:24 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index cdc989a3b19501189c217bf6c4359ea8b8a49b6b..4c177969228ebc38c5363f7d36dc2cf060634ea7 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -1607,20 +1607,13 @@ dhcp_expire(void *arg)
        struct interface *ifp = arg;
        struct dhcp_state *state = D_STATE(ifp);
 
-       state->interval = 0;
-       if (state->addr.s_addr == 0) {
-               /* We failed to reboot, so enter discovery. */
-               state->lease.addr.s_addr = 0;
-               dhcp_discover(ifp);
-               return;
-       }
-
        syslog(LOG_ERR, "%s: DHCP lease expired", ifp->name);
        eloop_timeout_delete(NULL, ifp);
        dhcp_drop(ifp, "EXPIRE");
        unlink(state->leasefile);
-       if (ifp->carrier != LINK_DOWN)
-               start_interface(ifp);
+
+       state->interval = 0;
+       dhcp_discover(ifp);
 }
 
 void
@@ -2064,7 +2057,7 @@ whitelisted_ip(const struct if_options *ifo, in_addr_t addr)
 }
 
 static void
-dhcp_handle(struct interface *iface, struct dhcp_message **dhcpp,
+dhcp_handledhcp(struct interface *iface, struct dhcp_message **dhcpp,
     const struct in_addr *from)
 {
        struct dhcp_state *state = D_STATE(iface);
@@ -2098,7 +2091,7 @@ dhcp_handle(struct interface *iface, struct dhcp_message **dhcpp,
                }
                dhcp_close(iface);
                /* If we constantly get NAKS then we should slowly back off */
-               eloop_timeout_add_sec(state->nakoff, start_interface, iface);
+               eloop_timeout_add_sec(state->nakoff, dhcp_discover, iface);
                if (state->nakoff == 0)
                        state->nakoff = 1;
                else {
@@ -2370,7 +2363,7 @@ dhcp_handlepacket(void *arg)
                            hwaddr_ntoa(dhcp->chaddr, sizeof(dhcp->chaddr)));
                        continue;
                }
-               dhcp_handle(iface, &dhcp, &from);
+               dhcp_handledhcp(iface, &dhcp, &from);
                if (state->raw_fd == -1)
                        break;
        }