summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2017-09-28 21:25:49 +0000
committerkrw <krw@openbsd.org>2017-09-28 21:25:49 +0000
commit55e25cfe733127d9416bf80758a3bfb96286476e (patch)
treee09223c90afa4e35ad6ee7f9c83170815cc7a778
parentmake clang include a FILE symbol for .(s|S) files (diff)
downloadwireguard-openbsd-55e25cfe733127d9416bf80758a3bfb96286476e.tar.xz
wireguard-openbsd-55e25cfe733127d9416bf80758a3bfb96286476e.zip
Correct the timeout used when select-timeout is
set to a non-zero value in dhclient.conf(5). Fixes the bsd.rd upgrade issue reported by Eivinde Eide via misc@.
-rw-r--r--sbin/dhclient/dhclient.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index bf4a33e7a5c..08b7bd76ae1 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.513 2017/09/22 14:04:13 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.514 2017/09/28 21:25:49 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -858,7 +858,7 @@ void
dhcpoffer(struct interface_info *ifi, struct option_data *options, char *info)
{
struct client_lease *lease;
- time_t stop_selecting;
+ time_t cur_time, stop_selecting;
if (ifi->state != S_SELECTING) {
#ifdef DEBUG
@@ -868,6 +868,7 @@ dhcpoffer(struct interface_info *ifi, struct option_data *options, char *info)
return;
}
+ time(&cur_time);
log_info("%s: %s", log_procname, info);
lease = packet_to_lease(ifi, options);
@@ -888,10 +889,10 @@ dhcpoffer(struct interface_info *ifi, struct option_data *options, char *info)
/* Figure out when we're supposed to stop selecting. */
stop_selecting = ifi->first_sending + config->select_interval;
- if (stop_selecting <= time(NULL))
+ if (stop_selecting <= cur_time)
state_selecting(ifi);
else
- set_timeout(ifi, stop_selecting, state_selecting);
+ set_timeout(ifi, stop_selecting - cur_time, state_selecting);
}
void