From: Roy Marples Date: Fri, 7 Aug 2015 12:54:21 +0000 (+0000) Subject: Fix IPv4LL on NetBSD when wifi reconfigures. X-Git-Tag: v6.9.2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f41791e454cf5b31e2c86ea22fa06aa175594a25;p=thirdparty%2Fdhcpcd.git Fix IPv4LL on NetBSD when wifi reconfigures. --- diff --git a/dhcp.c b/dhcp.c index 9a0a44c6..d95baa77 100644 --- a/dhcp.c +++ b/dhcp.c @@ -3342,13 +3342,8 @@ dhcp_start1(void *arg) } if (!(ifo->options & DHCPCD_DHCP)) { - if (ifo->options & DHCPCD_IPV4LL) { - if (state->offer && state->offer->cookie != 0) { - free(state->offer); - state->offer = NULL; - } + if (ifo->options & DHCPCD_IPV4LL) ipv4ll_start(ifp); - } return; } @@ -3385,6 +3380,13 @@ dhcp_start(struct interface *ifp) eloop_timeout_add_tv(ifp->ctx->eloop, &tv, dhcp_start1, ifp); } +void +dhcp_abort(struct interface *ifp) +{ + + eloop_timeout_delete(ifp->ctx->eloop, dhcp_start1, ifp); +} + void dhcp_handleifa(int cmd, struct interface *ifp, const struct in_addr *addr, diff --git a/dhcp.h b/dhcp.h index 1495aafb..4cd242f7 100644 --- a/dhcp.h +++ b/dhcp.h @@ -264,7 +264,7 @@ void dhcp_handleifa(int, struct interface *, void dhcp_drop(struct interface *, const char *); void dhcp_start(struct interface *); -void dhcp_stop(struct interface *); +void dhcp_abort(struct interface *); void dhcp_discover(void *); void dhcp_inform(struct interface *); void dhcp_bind(struct interface *); @@ -275,6 +275,7 @@ int dhcp_dump(struct interface *); #else #define dhcp_drop(a, b) {} #define dhcp_start(a) {} +#define dhcp_abort(a) {} #define dhcp_reboot(a, b) (b = b) #define dhcp_reboot_newopts(a, b) (b = b) #define dhcp_close(a) {} diff --git a/dhcpcd.c b/dhcpcd.c index 0a3daf62..9ea6c7ad 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -696,6 +696,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags, script_runreason(ifp, "NOCARRIER"); #ifdef NOCARRIER_PRESERVE_IP arp_close(ifp); + dhcp_abort(ifp); if_sortinterfaces(ctx); ipv4_preferanother(ifp); ipv6nd_expire(ifp, 0);