From: Roy Marples Date: Mon, 29 Jun 2015 15:31:33 +0000 (+0000) Subject: Send the IPv4LL interface to listeners. X-Git-Tag: v6.9.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=706afa0ff47c3c1a6b71d05fa246f8755f1f7e30;p=thirdparty%2Fdhcpcd.git Send the IPv4LL interface to listeners. Send the expired IP in the old_ prefix. --- diff --git a/dhcpcd.c b/dhcpcd.c index 305eb2d8..a692465f 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -1238,6 +1238,8 @@ dhcpcd_getinterfaces(void *arg) len++; if (D_STATE_RUNNING(ifp)) len++; + if (IPV4LL_STATE_RUNNING(ifp)) + len++; if (RS_STATE_RUNNING(ifp)) len++; if (D6_STATE_RUNNING(ifp)) diff --git a/ipv4ll.c b/ipv4ll.c index 6a8af811..87e598bf 100644 --- a/ipv4ll.c +++ b/ipv4ll.c @@ -229,8 +229,9 @@ ipv4ll_conflicted(struct arp_state *astate, const struct arp_msg *amsg) ifp->name, DEFEND_INTERVAL, inet_ntoa(state->addr)); ipv4_deladdr(ifp, &state->addr, &inaddr_llmask, 1); - state->addr.s_addr = INADDR_ANY; + state->down = 1; script_runreason(ifp, "IPV4LL"); + state->addr.s_addr = INADDR_ANY; } else { logger(ifp->ctx, LOG_DEBUG, "%s: defended IPv4LL address %s", diff --git a/ipv4ll.h b/ipv4ll.h index eeebb958..32390216 100644 --- a/ipv4ll.h +++ b/ipv4ll.h @@ -44,6 +44,7 @@ struct ipv4ll_state { unsigned int conflicts; struct timespec defend; char randomstate[128]; + uint8_t down; }; #define IPV4LL_STATE(ifp) \ @@ -51,7 +52,7 @@ struct ipv4ll_state { #define IPV4LL_CSTATE(ifp) \ ((const struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL]) #define IPV4LL_STATE_RUNNING(ifp) \ - (IPV4LL_CSTATE((ifp)) && \ + (IPV4LL_CSTATE((ifp)) && !IPV4LL_CSTATE((ifp))->down && \ IN_LINKLOCAL(ntohl(IPV4LL_CSTATE((ifp))->addr.s_addr))) struct rt* ipv4ll_subnet_route(const struct interface *); diff --git a/script.c b/script.c index 9033e575..be1e3ad3 100644 --- a/script.c +++ b/script.c @@ -235,6 +235,7 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) #ifdef INET int dhcp, ipv4ll; const struct dhcp_state *state; + const struct ipv4ll_state *istate; #endif #ifdef INET6 const struct dhcp6_state *d6_state; @@ -244,6 +245,7 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) #ifdef INET dhcp = ipv4ll = 0; state = D_STATE(ifp); + istate = IPV4LL_CSTATE(ifp); #endif #ifdef INET6 dhcp6 = ra = 0; @@ -463,7 +465,8 @@ dumplease: if (nenv == NULL) goto eexit; env = nenv; - if ((n = ipv4ll_env(env + elen, "new", ifp)) == -1) + if ((n = ipv4ll_env(env + elen, + istate->down ? "old" : "new", ifp)) == -1) goto eexit; elen += (size_t)n; } @@ -609,6 +612,10 @@ send_interface(struct fd_list *fd, const struct interface *ifp) if (send_interface1(fd, ifp, d->reason) == -1) retval = -1; } + if (IPV4LL_STATE_RUNNING(ifp)) { + if (send_interface1(fd, ifp, "IPV4LL") == -1) + retval = -1; + } #endif #ifdef INET6