As a preparation for handling multiple addresses, we update ignore_arp()
to check against all addresses in the unified addrs[] array using the
for_each_addr() macro.
Signed-off-by: Jon Maloy
---
v3: Adapted to single-array changes earlier in this series
---
arp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arp.c b/arp.c
index f16beac..c493f9e 100644
--- a/arp.c
+++ b/arp.c
@@ -41,6 +41,8 @@
static bool ignore_arp(const struct ctx *c,
const struct arphdr *ah, const struct arpmsg *am)
{
+ const struct inany_addr_entry *e;
+
if (ah->ar_hrd != htons(ARPHRD_ETHER) ||
ah->ar_pro != htons(ETH_P_IP) ||
ah->ar_hln != ETH_ALEN ||
@@ -53,10 +55,10 @@ static bool ignore_arp(const struct ctx *c,
!memcmp(am->sip, am->tip, sizeof(am->sip)))
return true;
- /* Don't resolve the guest's assigned address, either. */
- if (first_v4(c) &&
- !memcmp(am->tip, inany_v4(&first_v4(c)->addr), sizeof(am->tip)))
- return true;
+ /* Don't resolve any of the guest's addresses */
+ for_each_addr(c, e, AF_INET)
+ if (!memcmp(am->tip, inany_v4(&e->addr), sizeof(am->tip)))
+ return true;
return false;
}
--
2.52.0