diff options
author | 2012-08-18 00:20:01 +0000 | |
---|---|---|
committer | 2012-08-18 00:20:01 +0000 | |
commit | ad8224e851e3a8df33cf09aa9188dc899d508bce (patch) | |
tree | af67ef39a88c9bec1360bac0a2cc618ff22d9297 | |
parent | make sure mycreate uses -DSHARED_LIBS=1 (for now), gets a lot of tests to (diff) | |
download | wireguard-openbsd-ad8224e851e3a8df33cf09aa9188dc899d508bce.tar.xz wireguard-openbsd-ad8224e851e3a8df33cf09aa9188dc899d508bce.zip |
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@
-rw-r--r-- | sbin/dhclient/dhclient.c | 5 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 5 |
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) { |