From: Roy Marples Date: Wed, 28 May 2008 09:30:45 +0000 (+0000) Subject: When we're persistent and using the last lease ignore expired check. This is so we... X-Git-Tag: v4.0.2~315 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841ff129d17612a40b92362a67fa26da86c884f3;p=thirdparty%2Fdhcpcd.git When we're persistent and using the last lease ignore expired check. This is so we work with NFS / and the DHCP server has been down for a while. --- diff --git a/client.c b/client.c index 70f7a3ab..13ed31cc 100644 --- a/client.c +++ b/client.c @@ -427,7 +427,13 @@ get_old_lease(struct if_state *state, const struct options *options) { logger(LOG_ERR, "lease expired %u seconds ago", offset + lease->leasetime); - goto eexit; + /* Persistent interfaces should still try and use the lease + * if we can't contact a DHCP server. We just set the timeout + * to 1 second. */ + if (state->options & DHCPCD_PERSISTENT) + offset = lease->renewaltime - 1; + else + goto eexit; } if (lease->leasedfrom == 0) diff --git a/dhcpcd.8.in b/dhcpcd.8.in index c7900e2f..33b88215 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 21, 2008 +.Dd May 28, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd @@ -266,8 +266,10 @@ and should not be copied to other hosts. .It Fl E , -lastlease If .Nm -cannot obtain a lease, then try to use the last lease we got for the -interface if it hasn't yet expired. +cannot obtain a lease, then try to use the last lease we got for the interface. +If the +.Fl p, -persistent +option is not given then we only use the lease if it hasn't expired. .It Fl F , -fqdn Ar fqdn Requests that the DHCP server updates DNS using FQDN instead of just a hostname.