From: Roy Marples Date: Sat, 4 Jul 2015 12:33:22 +0000 (+0000) Subject: Allow static to work for pre-existing addresses without a config. X-Git-Tag: v6.9.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56989889d3d1c63ca64c8f83be3d0be16a2a763b;p=thirdparty%2Fdhcpcd.git Allow static to work for pre-existing addresses without a config. --- diff --git a/dhcp.c b/dhcp.c index df0212b1..09e002b5 100644 --- a/dhcp.c +++ b/dhcp.c @@ -2134,10 +2134,15 @@ dhcp_static(struct interface *ifp) { struct if_options *ifo; struct dhcp_state *state; + struct ipv4_addr *ia; state = D_STATE(ifp); ifo = ifp->options; - if (ifo->req_addr.s_addr == INADDR_ANY) { + + ia = NULL; + if (ifo->req_addr.s_addr == INADDR_ANY && + (ia = ipv4_iffindaddr(ifp, NULL, NULL)) == NULL) + { logger(ifp->ctx, LOG_INFO, "%s: waiting for 3rd party to " "configure IP address", @@ -2146,7 +2151,9 @@ dhcp_static(struct interface *ifp) script_runreason(ifp, state->reason); return; } - state->offer = dhcp_message_new(&ifo->req_addr, &ifo->req_mask); + + state->offer = dhcp_message_new(ia ? &ia->addr : &ifo->req_addr, + ia ? &ia->net : &ifo->req_mask); if (state->offer) { eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); dhcp_bind(ifp);