minor fix for prior

This commit is contained in:
Roy Marples 2024-10-04 17:11:26 +01:00
parent acbac12169
commit 5228ee5a6d
4 changed files with 7 additions and 29 deletions

View File

@ -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 *

View File

@ -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 *);

View File

@ -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;
}

View File

@ -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