]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When we're persistent and using the last lease ignore expired check. This is so we...
authorRoy Marples <roy@marples.name>
Wed, 28 May 2008 09:30:45 +0000 (09:30 +0000)
committerRoy Marples <roy@marples.name>
Wed, 28 May 2008 09:30:45 +0000 (09:30 +0000)
client.c
dhcpcd.8.in

index 70f7a3ab2e730da422e64dc4c0290d0031c1cd56..13ed31cc78d384b84502e003f24f0a6d1a6854f2 100644 (file)
--- 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)
index c7900e2f5ddd0e2e4d185cde306fa75ab920075d..33b882150dd803ddd6f1ff3d51bb92dfce52ebd1 100644 (file)
@@ -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.