return;
}
+ /* Add the address */
+ if (ipv4_applyaddr(ifp) == NULL)
+ return;
+
/* Close the BPF filter as we can now receive DHCP messages
* on a UDP socket. */
dhcp_closebpf(ifp);
- /* Add the address */
- ipv4_applyaddr(ifp);
-
openudp:
/* If not in master mode, open an address specific socket. */
if (ctx->options & DHCPCD_MASTER ||
return 0;
}
-void
+struct ipv4_addr *
ipv4_applyaddr(void *arg)
{
struct interface *ifp = arg;
struct ipv4_addr *ia;
if (state == NULL)
- return;
+ return NULL;
lease = &state->lease;
if (state->new == NULL) {
script_runreason(ifp, state->reason);
} else
rt_build(ifp->ctx, AF_INET);
- return;
+ return NULL;
}
ia = ipv4_iffindaddr(ifp, &lease->addr, NULL);
#endif
#ifndef IP_LIFETIME
if (ipv4_daddaddr(ifp, lease) == -1 && errno != EEXIST)
- return;
+ return NULL;
#endif
}
#ifdef IP_LIFETIME
if (ipv4_daddaddr(ifp, lease) == -1 && errno != EEXIST)
- return;
+ return NULL;
#endif
ia = ipv4_iffindaddr(ifp, &lease->addr, NULL);
if (ia == NULL) {
logerrx("%s: added address vanished", ifp->name);
- return;
+ return NULL;
}
#if defined(ARP) && defined(IN_IFF_NOTUSEABLE)
if (ia->addr_flags & IN_IFF_NOTUSEABLE)
- return;
+ return NULL;
#endif
/* Delete the old address if different */
script_runreason(ifp, state->reason);
dhcpcd_daemonise(ifp->ctx);
}
+ return ia;
}
void
struct ipv4_addr *ipv4_addaddr(struct interface *,
const struct in_addr *, const struct in_addr *, const struct in_addr *,
uint32_t, uint32_t);
-void ipv4_applyaddr(void *);
+struct ipv4_addr *ipv4_applyaddr(void *);
struct ipv4_addr *ipv4_iffindaddr(struct interface *,
const struct in_addr *, const struct in_addr *);