From c6dcd37e27207731126e652a1cb1f8777734b6da Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sun, 26 Aug 2012 23:33:32 +0000 Subject: Junk global cur_time, and use time(NULL) or local variables where time is checked multiple times. Add a set_timeout_interval() function to allow setting a timeout based on an interval from current time. Fixes issues with initial startup where the global cur_time was always old and caused initial DHCPDISCOVER or DHCPREQUEST packets to be sent multiple times. And probably other timeout related oddities. Tested by naddy@ --- sbin/dhclient/clparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin/dhclient/clparse.c') diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 5f361dce498..9119943c496 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.39 2012/08/22 00:14:42 tedu Exp $ */ +/* $OpenBSD: clparse.c,v 1.40 2012/08/26 23:33:29 krw Exp $ */ /* Parser for dhclient config and lease files... */ @@ -471,7 +471,7 @@ parse_client_lease_statement(FILE *cfile, int is_static) * active. */ if (client->active) { - if (client->active->expiry < cur_time) + if (client->active->expiry < time(NULL)) free_client_lease(client->active); else if (addr_eq(client->active->address, lease->address)) free_client_lease(client->active); -- cgit v1.2.3