summaryrefslogtreecommitdiffstats
path: root/dhcp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-09-17 13:09:30 +0000
committerRoy Marples <roy@marples.name>2008-09-17 13:09:30 +0000
commitf7038ab8b9bcd3bb651d7decbfba3744b00a1c81 (patch)
tree2009d1c36208091203a5c88824c8e630f2df4aae /dhcp.c
parent5c39a95174cf4fa01fece35c6fbd67c13a39cf2b (diff)
downloaddhcpcd-f7038ab8b9bcd3bb651d7decbfba3744b00a1c81.tar.xz
As we now use times to trigger again instead of decreasing timers, ensure our lease fits. We may wish to revisit this again if we need decreasing timers once more.
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dhcp.c b/dhcp.c
index 0aa13fa6..2658e89d 100644
--- a/dhcp.c
+++ b/dhcp.c
@@ -1252,15 +1252,15 @@ configure_env(char **env, const char *prefix, const struct dhcp_message *dhcp,
void
get_lease(struct dhcp_lease *lease, const struct dhcp_message *dhcp)
{
- time_t t;
+ struct timeval now;
lease->addr.s_addr = dhcp->yiaddr;
if (get_option_addr(&lease->net.s_addr, dhcp, DHO_SUBNETMASK) == -1)
lease->net.s_addr = get_netmask(dhcp->yiaddr);
if (get_option_uint32(&lease->leasetime, dhcp, DHO_LEASETIME) == 0) {
/* Ensure that we can use the lease */
- t = 0;
- if (t + (time_t)lease->leasetime < t)
+ get_monotonic(&now);
+ if (now.tv_sec + (time_t)lease->leasetime < now.tv_sec)
lease->leasetime = ~0U; /* Infinite lease */
} else
lease->leasetime = DEFAULT_LEASETIME;