}
}
- if (ifo->options & DHCPCD_IPV4)
- dhcp_start(ifp);
+ if (ifo->options & DHCPCD_IPV4) {
+ /* Ensure we have an IPv4 state before starting DHCP */
+ if (ipv4_getstate(ifp) != NULL)
+ dhcp_start(ifp);
+ }
}
static void
return r;
}
-static struct ipv4_state *
+struct ipv4_state *
ipv4_getstate(struct interface *ifp)
{
struct ipv4_state *state;
((const struct ipv4_state *)(ifp)->if_data[IF_DATA_IPV4])
#ifdef INET
+struct ipv4_state *ipv4_getstate(struct interface *);
int ipv4_init(struct dhcpcd_ctx *);
int ipv4_protocol_fd(const struct interface *, uint16_t);
int ipv4_ifcmp(const struct interface *, const struct interface *);