As a preparation for handling multiple addresses, we update ignore_arp()
to check against all addresses in the addrs[] array.
Signed-off-by: Jon Maloy
---
arp.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arp.c b/arp.c
index bc77a9f..d8063e2 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)
{
+ int i;
+
if (ah->ar_hrd != htons(ARPHRD_ETHER) ||
ah->ar_pro != htons(ETH_P_IP) ||
ah->ar_hln != ETH_ALEN ||
@@ -53,9 +55,11 @@ 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 (!memcmp(am->tip, inany_v4(&c->ip4.addrs[0].addr), sizeof(am->tip)))
- return true;
+ /* Don't resolve any of the guest's addresses */
+ for (i = 0; i < c->ip4.addr_count; i++)
+ if (!memcmp(am->tip, inany_v4(&c->ip4.addrs[i].addr),
+ sizeof(am->tip)))
+ return true;
return false;
}
--
2.52.0