diff options
-rw-r--r-- | networking/udhcp/dhcpc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 35e7c2070..a34829c3a 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1697,6 +1697,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) case RENEW_REQUESTED: case REBINDING: if (*message == DHCPACK) { + unsigned start; uint32_t lease_seconds; struct in_addr temp_addr; uint8_t *temp; @@ -1756,7 +1757,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) bb_info_msg("Lease of %s obtained, lease time %u", inet_ntoa(temp_addr), (unsigned)lease_seconds); requested_ip = packet.yiaddr; + + start = monotonic_sec(); udhcp_run_script(&packet, state == REQUESTING ? "bound" : "renew"); + already_waited_sec = (unsigned)monotonic_sec() - start; state = BOUND; change_listen_mode(LISTEN_NONE); @@ -1774,7 +1778,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) #endif /* make future renew packets use different xid */ /* xid = random_xid(); ...but why bother? */ - already_waited_sec = 0; + continue; /* back to main loop */ } if (*message == DHCPNAK) { |