]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Backup and restore any DHCP lease offered during the binding
authorRoy Marples <roy@marples.name>
Thu, 13 Nov 2014 18:45:04 +0000 (18:45 +0000)
committerRoy Marples <roy@marples.name>
Thu, 13 Nov 2014 18:45:04 +0000 (18:45 +0000)
of the IPv4LL address.

ipv4ll.c

index 8d7c7af42fadb88ac4ef0ef4ec24accc4eaf0b96..8cb6d2f3117ffc318c95c8a3e0b6339e274c68ac 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -105,14 +105,17 @@ static void
 ipv4ll_probed(struct arp_state *astate)
 {
        struct dhcp_state *state = D_STATE(astate->iface);
+       struct dhcp_message *offer;
 
-       free(state->offer);
+       /* A DHCP lease could have already been offered.
+        * Backup this lease and replace once the IPv4LL addres is bound */
+       offer = state->offer;
        state->offer = ipv4ll_make_lease(astate->addr.s_addr);
-       if (state->offer == NULL) {
+       if (state->offer == NULL)
                syslog(LOG_ERR, "%s: %m", __func__);
-               return;
-       }
-       dhcp_bind(astate->iface, astate);
+       else
+               dhcp_bind(astate->iface, astate);
+       state->offer = offer;
 }
 
 static void