summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-08-18 00:20:02 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-08-18 00:20:02 +0000
commitae5e4cda044ab44688d1d88b0ccd026a0ecc7511 (patch)
tree277c57251fd2e2a48ad9aadcf54e085a48a2a895 /sbin
parenta76ccdf52d95be225350e5286e4ef06790d88bba (diff)
Update global cur_time after exiting poll() and before calling the
state engine for packet processing. Time may have passed! Use cur_time in routing message processing. Makes sense to todd@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dhclient.c5
-rw-r--r--sbin/dhclient/dispatch.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 90308927d28..6c0b7dc9dde 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.146 2012/07/09 16:21:21 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.147 2012/08/18 00:20:01 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -163,7 +163,6 @@ routehandler(void)
struct ifa_msghdr *ifam;
struct if_announcemsghdr *ifan;
struct client_lease *l;
- time_t t = time(NULL);
struct sockaddr *sa;
struct iaddr a;
ssize_t n;
@@ -221,7 +220,7 @@ routehandler(void)
ifam->ifam_addrs) != AF_INET)
break;
/* XXX check addrs like RTM_NEWADDR instead of this? */
- if (scripttime == 0 || t < scripttime + 10)
+ if (scripttime == 0 || cur_time < scripttime + 10)
break;
errmsg = "interface address deleted";
goto die;
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 1ca9fa84e8e..c117479bd7e 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.53 2012/07/26 18:42:58 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.54 2012/08/18 00:20:01 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -174,6 +174,9 @@ another:
/* Wait for a packet or a timeout... XXX */
count = poll(fds, 2, to_msec);
+ /* Time may have moved on while we polled! */
+ time(&cur_time);
+
/* Not likely to be transitory... */
if (count == -1) {
if (errno == EAGAIN || errno == EINTR) {