]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If we get a NAK during a test, we should not read the old lease as
authorRoy Marples <roy@marples.name>
Thu, 9 Sep 2010 18:27:00 +0000 (18:27 +0000)
committerRoy Marples <roy@marples.name>
Thu, 9 Sep 2010 18:27:00 +0000 (18:27 +0000)
it's not dropped during the NAK handling.

dhcpcd.c

index 8bfa8dd7d9b1617d21427bce06286aad28d6a94f..02a1fd29d9ced3785a5b8bf3fead74edfe16f086 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1091,6 +1091,7 @@ start_interface(void *arg)
        struct stat st;
        struct timeval now;
        uint32_t l;
+       int nolease;
 
        handle_carrier(iface->name);
        if (iface->carrier == LINK_DOWN) {
@@ -1098,6 +1099,9 @@ start_interface(void *arg)
                return;
        }
 
+       /* We don't want to read the old lease if we NAK an old test */
+       nolease = iface->state->offer && options & DHCPCD_TEST;
+
        iface->start_uptime = uptime();
        free(iface->state->offer);
        iface->state->offer = NULL;
@@ -1136,7 +1140,7 @@ start_interface(void *arg)
                        start_inform(iface);
                        return;
                }
-       } else
+       } else if (!nolease)
                iface->state->offer = read_lease(iface);
        if (iface->state->offer) {
                get_lease(&iface->state->lease, iface->state->offer);