From a920af6b8b7a68f4ebcbdbd91b0f3e010ff64356 Mon Sep 17 00:00:00 2001 From: krw Date: Tue, 6 Feb 2018 21:01:27 +0000 Subject: [PATCH] When binding a lease from the dhclient.leasees. file and the renewal time is in the past wait retry_interval before trying to renew the lease. --- sbin/dhclient/dhclient.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index a40a6ab5c76..9f54fa1e086 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.556 2018/02/06 05:09:51 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.557 2018/02/06 21:01:27 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -1076,8 +1076,17 @@ newlease: ifi->state = S_BOUND; - /* Set timeout to start the renewal process. */ - set_timeout(ifi, renewal - cur_time, state_bound); + /* + * Set timeout to start the renewal process. + * + * If the renewal time is in the past, the lease is from the + * leaseDB. Rather than immediately trying to contact a server, + * pause the configured time between attempts. + */ + if (renewal < cur_time) + set_timeout(ifi, config->retry_interval, state_bound); + else + set_timeout(ifi, renewal - cur_time, state_bound); } /* -- 2.20.1