diff --git a/src/arp.c b/src/arp.c index b1c7952d..c9ca6f86 100644 --- a/src/arp.c +++ b/src/arp.c @@ -530,32 +530,6 @@ arp_ifannounceaddr(struct interface *ifp, const struct in_addr *ia) arp_announce(astate); return astate; } - -struct arp_state * -arp_announceaddr(struct dhcpcd_ctx *ctx, const struct in_addr *ia) -{ - struct interface *ifp, *iff = NULL; - struct ipv4_addr *iap; - - TAILQ_FOREACH(ifp, ctx->ifaces, next) { - if (!ifp->active || !if_is_link_up(ifp)) - continue; - iap = ipv4_iffindaddr(ifp, ia, NULL); - if (iap == NULL) - continue; -#ifdef IN_IFF_NOTUSEABLE - if (iap->addr_flags & IN_IFF_NOTUSEABLE) - continue; -#endif - if (iff != NULL && iff->metric < ifp->metric) - continue; - iff = ifp; - } - if (iff == NULL) - return NULL; - - return arp_ifannounceaddr(iff, ia); -} #endif struct arp_state * diff --git a/src/arp.h b/src/arp.h index 1a5f41f0..2edbc530 100644 --- a/src/arp.h +++ b/src/arp.h @@ -96,7 +96,6 @@ struct iarp_state { void arp_packet(struct interface *, uint8_t *, size_t, unsigned int); struct arp_state *arp_new(struct interface *, const struct in_addr *); void arp_probe(struct arp_state *); -struct arp_state *arp_announceaddr(struct dhcpcd_ctx *, const struct in_addr *); struct arp_state *arp_ifannounceaddr(struct interface *, const struct in_addr *); struct arp_state * arp_find(struct interface *, const struct in_addr *); void arp_free(struct arp_state *); diff --git a/src/ipv4.c b/src/ipv4.c index 69e0dab8..be7d7cff 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -715,8 +715,13 @@ ipv4_addaddr(struct interface *ifp, const struct in_addr *addr, } #endif - if (ia->flags & IPV4_AF_NEW) + if (ia->flags & IPV4_AF_NEW) { TAILQ_INSERT_TAIL(&state->addrs, ia, next); +#ifdef ARP + arp_ifannounceaddr(ifp, &ia->addr); +#endif + } + return ia; } diff --git a/src/ipv4ll.c b/src/ipv4ll.c index ebe8aae0..01556cab 100644 --- a/src/ipv4ll.c +++ b/src/ipv4ll.c @@ -268,7 +268,7 @@ ipv4ll_not_found(struct interface *ifp) rt_build(ifp->ctx, AF_INET); #ifndef KERNEL_RFC5227 - astate = arp_announceaddr(ifp->ctx, &ia->addr); + astate = arp_ifannounceaddr(ifp, &ia->addr); if (astate != NULL) astate->announced_cb = ipv4ll_announced_arp; #endif