ipv4_finaliseaddr(astate->iface);
arp_close(astate->iface);
#else
- dhcp_bind(astate->iface, astate);
+ dhcp_bind(astate->iface);
#endif
/* Stop IPv4LL now we have a working DHCP address */
}
void
-dhcp_bind(struct interface *ifp, struct arp_state *astate)
+dhcp_bind(struct interface *ifp)
{
struct dhcp_state *state = D_STATE(ifp);
struct if_options *ifo = ifp->options;
struct dhcp_lease *lease = &state->lease;
+ struct arp_state *astate;
if (state->state == DHS_BOUND)
goto applyaddr;
applyaddr:
#ifdef IN_IFF_TENTATIVE
- if (astate == NULL) {
- astate = arp_new(ifp, &lease->addr);
- if (astate) {
+ if ((astate = arp_find(ifp, &lease->addr)) == NULL) {
+ if ((astate = arp_new(ifp, &lease->addr)) != NULL) {
astate->probed_cb = dhcp_arp_probed;
astate->conflicted_cb = dhcp_arp_conflicted;
}
struct interface *ifp = arg;
struct dhcp_state *state = D_STATE(ifp);
- dhcp_bind(ifp, NULL);
+ dhcp_bind(ifp);
state->interval = 0;
dhcp_discover(ifp);
}
state->offer = dhcp_message_new(&ifo->req_addr, &ifo->req_mask);
if (state->offer) {
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
- dhcp_bind(ifp, NULL);
+ dhcp_bind(ifp);
}
}
dhcp_message_new(&ifo->req_addr, &ifo->req_mask);
if (state->offer) {
ifo->options |= DHCPCD_STATIC;
- dhcp_bind(ifp, NULL);
+ dhcp_bind(ifp);
ifo->options &= ~DHCPCD_STATIC;
}
}
unsigned int i;
size_t auth_len;
char *msg;
- struct arp_state *astate;
struct ipv4_addr *ia;
/* We may have found a BOOTP server */
lease->frominfo = 0;
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
- astate = NULL;
#ifndef IN_IFF_TENTATIVE
if (ifo->options & DHCPCD_ARP
* then we can't ARP for duplicate detection. */
ia = ipv4_findaddr(ifp->ctx, &addr);
if (ia == NULL) {
+ struct arp_state *astate;
+
astate = arp_new(ifp, &addr);
if (astate) {
astate->probed_cb = dhcp_arp_probed;
}
#endif
- dhcp_bind(ifp, astate);
+ dhcp_bind(ifp);
}
static size_t
void dhcp_stop(struct interface *);
void dhcp_discover(void *);
void dhcp_inform(struct interface *);
-void dhcp_bind(struct interface *, struct arp_state *);
+void dhcp_bind(struct interface *);
void dhcp_reboot_newopts(struct interface *, unsigned long long);
void dhcp_close(struct interface *);
void dhcp_free(struct interface *);