]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix mini timeouts and starting ipv4ll when link is down and we try to renew a lease.
authorRoy Marples <roy@marples.name>
Wed, 23 Jul 2008 10:32:00 +0000 (10:32 +0000)
committerRoy Marples <roy@marples.name>
Wed, 23 Jul 2008 10:32:00 +0000 (10:32 +0000)
client.c

index 64d604f3c3a1849f45d4da939a410bb6f0edc8bd..93fbce705d5f3d09f7c64fad906d73ef422b581d 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1077,7 +1077,8 @@ handle_timeout_fail(struct if_state *state, const struct options *options)
                return 1;
        case STATE_BOUND:
                logger(LOG_INFO, "renewing lease of %s",inet_ntoa(lease->addr));
-               do_socket(state, SOCKET_OPEN);
+               if (state->carrier != LINK_DOWN)
+                       do_socket(state, SOCKET_OPEN);
                state->xid = arc4random();
                state->state = STATE_RENEWING;
                tv.tv_sec = lease->rebindtime - lease->renewaltime;
@@ -1093,7 +1094,8 @@ handle_timeout_fail(struct if_state *state, const struct options *options)
                break;
        case STATE_REBINDING:
                logger(LOG_ERR, "failed to rebind");
-               if (state->options & DHCPCD_IPV4LL)
+               if (state->options & DHCPCD_IPV4LL &&
+                   state->carrier != LINK_DOWN)
                        state->state = STATE_INIT_IPV4LL;
                else {
                        reason = "EXPIRE";
@@ -1306,6 +1308,10 @@ handle_timeout(struct if_state *state, const struct options *options)
 #ifdef ENABLE_ARP
 dhcp_timeout:
 #endif
+       if (state->carrier == LINK_DOWN) {
+               timerclear(&state->timeout);
+               return 0;
+       }
        get_time(&state->timeout);
        tv.tv_sec = DHCP_BASE;
        for (i = 1; i < state->messages; i++) {