From: Roy Marples Date: Tue, 15 Sep 2015 13:37:44 +0000 (+0000) Subject: Fix moving a lease from one interface to another. X-Git-Tag: v6.9.4~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2e620b356c2ab9fa44f66f747837bfdc41910cd;p=thirdparty%2Fdhcpcd.git Fix moving a lease from one interface to another. --- diff --git a/dhcp.c b/dhcp.c index 3467a68e..946079ef 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1980,10 +1980,14 @@ dhcp_bind(struct interface *ifp) struct dhcp_lease *lease = &state->lease; state->reason = NULL; - free(state->old); - state->old = state->new; - state->new = state->offer; - state->offer = NULL; + /* If we don't have an offer, we are re-binding a lease on preference, + * normally when two interfaces have a lease matching IP addresses. */ + if (state->offer) { + free(state->old); + state->old = state->new; + state->new = state->offer; + state->offer = NULL; + } get_lease(ifp->ctx, lease, state->new); if (ifo->options & DHCPCD_STATIC) { logger(ifp->ctx, LOG_INFO, "%s: using static address %s/%d",