summaryrefslogtreecommitdiff
path: root/sbin/dhclient/clparse.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-08-26 23:33:32 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-08-26 23:33:32 +0000
commitc6dcd37e27207731126e652a1cb1f8777734b6da (patch)
tree104ae4cd3109c7da0f9f807d4cb7c38b4326baa9 /sbin/dhclient/clparse.c
parentca9af048616b912f9b274db3f8941db823852133 (diff)
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@
Diffstat (limited to 'sbin/dhclient/clparse.c')
-rw-r--r--sbin/dhclient/clparse.c4
1 files changed, 2 insertions, 2 deletions
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);