We update ignore_arp() to check against all addresses in the addrs[]
array, not just addrs[0]. This ensures ARP requests for any of the
guest's configured addresses are properly ignored.
Signed-off-by: Jon Maloy
---
arp.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arp.c b/arp.c
index 7eaf517..61c309e 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,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 (!memcmp(am->tip, &c->ip4.addrs[0].addr, sizeof(am->tip)))
- return true;
+ /* Don't resolve any of the guest's assigned addresses, either */
+ for (i = 0; i < c->ip4.addr_count; i++)
+ if (!memcmp(am->tip, &c->ip4.addrs[i].addr, sizeof(am->tip)))
+ return true;
return false;
}
--
2.51.1