summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2018-01-24 19:12:50 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2018-01-24 19:12:50 +0000
commit336ba163d3caf8044c83e2651be02ad96fa0c919 (patch)
tree6f63e5067e3391fc7428c4e420ee504f84a5910c /sbin/dhclient
parent2eac49c3e2227d1811f52e8eb089ffc98bd4da7c (diff)
Don't display the seconds until renewal. i.e. "em0: bound to 1.2.3.4
-- renewal in 300000 seconds" becomes simply "em0: bound to 1.2.3.4" While here avoid setting timeouts before the current time. ok florian@
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient.c16
-rw-r--r--sbin/dhclient/dispatch.c5
2 files changed, 10 insertions, 11 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 278becb16e0..f0393d0aa0b 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.543 2017/12/20 18:51:14 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.544 2018/01/24 19:12:49 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -970,14 +970,12 @@ bind_lease(struct interface_info *ifi)
* renewal == time to renew lease from server that provided it.
* rebind == time to renew lease from any server.
*
- * 0 <= renewal <= rebind <= expiry
- * &&
- * expiry >= MIN(time_max, 60)
+ * N.B.: renewal and/or rebind time could be < cur_time when the
+ * lease was obtained from the leases file.
*/
ifi->expiry = lease_expiry(lease);
ifi->rebind = lease_rebind(lease);
-
- renewal = lease_renewal(lease) - cur_time;
+ renewal = lease_renewal(lease);
/*
* A duplicate proposal once we are responsible & S_RENEWING means we
@@ -1015,8 +1013,8 @@ bind_lease(struct interface_info *ifi)
newlease:
write_resolv_conf();
- log_info("%s: bound to %s -- renewal in %lld seconds", log_procname,
- inet_ntoa(ifi->active->address), (long long)renewal);
+ log_info("%s: bound to %s", log_procname,
+ inet_ntoa(ifi->active->address));
go_daemon(ifi->name);
rewrite_option_db(ifi->name, ifi->active, lease);
free_client_lease(lease);
@@ -1054,7 +1052,7 @@ newlease:
ifi->state = S_BOUND;
/* Set timeout to start the renewal process. */
- set_timeout(ifi, renewal, state_bound);
+ set_timeout(ifi, renewal - cur_time, state_bound);
}
/*
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index f5916c9be55..ef3005baf92 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.146 2017/09/20 22:05:10 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.147 2018/01/24 19:12:49 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -325,7 +325,8 @@ set_timeout(struct interface_info *ifi, time_t secs,
void (*where)(struct interface_info *))
{
time(&ifi->timeout);
- ifi->timeout += secs;
+ if (secs > 0)
+ ifi->timeout += secs;
ifi->timeout_func = where;
}