Skip to content

Commit

Permalink
minor fix for prior
Browse files Browse the repository at this point in the history
  • Loading branch information
rsmarples committed Oct 4, 2024
1 parent acbac12 commit 5228ee5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 29 deletions.
26 changes: 0 additions & 26 deletions src/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
1 change: 0 additions & 1 deletion src/arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
7 changes: 6 additions & 1 deletion src/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ipv4ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5228ee5

Please sign in to comment.