From: Roy Marples Date: Thu, 13 Nov 2014 18:45:04 +0000 (+0000) Subject: Backup and restore any DHCP lease offered during the binding X-Git-Tag: v6.6.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725f6f1e63e87daa0fd85b737e1bd24b0c3bcb12;p=thirdparty%2Fdhcpcd.git Backup and restore any DHCP lease offered during the binding of the IPv4LL address. --- diff --git a/ipv4ll.c b/ipv4ll.c index 8d7c7af4..8cb6d2f3 100644 --- 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