dhcp_inform(ifp);
}
-
static bool
dhcp_addr_duplicated(struct interface *ifp, struct in_addr *ia)
{
state = D_STATE(ifp);
ifo = ifp->options;
- state->state = DHS_INFORM;
free(state->offer);
state->offer = NULL;
state->offer_len = 0;
}
}
+ state->state = DHS_INFORM;
state->addr = ia;
state->offer_len = dhcp_message_new(&state->offer,
&ia->addr, &ia->mask);
}
#endif
+ /* If we have requested a specific address, return now.
+ * The below code is only for when inform or static has been
+ * requested without a specific address. */
+ if (ifo->req_addr.s_addr != INADDR_ANY)
+ return ia;
+
+ /* Only inform if we are NOT in the inform state or bound. */
if (ifo->options & DHCPCD_INFORM) {
if (state->state != DHS_INFORM && state->state != DHS_BOUND)
dhcp_inform(ifp);
return ia;
}
+ /* Static and inform are mutually exclusive. If not static, return. */
if (!(ifo->options & DHCPCD_STATIC))
return ia;
- if (ifo->req_addr.s_addr != INADDR_ANY)
- return ia;
free(state->old);
state->old = state->new;
state->new_len = dhcp_message_new(&state->new, &ia->addr, &ia->mask);
if (state->new == NULL)
return ia;
+
if (ifp->flags & IFF_POINTOPOINT) {
for (i = 1; i < 255; i++)
if (i != DHO_ROUTER && has_option_mask(ifo->dstmask,i))
dhcp_message_add_addr(state->new, i, ia->brd);
}
+
state->reason = "STATIC";
rt_build(ifp->ctx, AF_INET);
script_runreason(ifp, state->reason);
- if (ifo->options & DHCPCD_INFORM) {
- state->state = DHS_INFORM;
- dhcp_new_xid(ifp);
- state->lease.server.s_addr = INADDR_ANY;
- state->addr = ia;
- dhcp_inform(ifp);
- }
return ia;
}