aboutgitcodebugslistschat
path: root/arp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-08-19 19:44:31 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-01 17:00:27 +0200
commit2166c5872e9b792f8a0284b29e3fab8f2f2607a5 (patch)
treebcf7fccb731ababa295d25a6c11d8738a551a3f5 /arp.c
parent1e49d194d01788afbc4b8216e27c794651a4facf (diff)
downloadpasst-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar.gz
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar.bz2
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar.lz
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar.xz
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.tar.zst
passt-2166c5872e9b792f8a0284b29e3fab8f2f2607a5.zip
arp: Don't answer announcements from guest or namespace
Depending on the configuration, the host might have the same address. Don't answer them to avoid a duplicate IP address detection. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'arp.c')
-rw-r--r--arp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arp.c b/arp.c
index 547057c..17fad9f 100644
--- a/arp.c
+++ b/arp.c
@@ -57,6 +57,12 @@ int arp(struct ctx *c, struct ethhdr *eh, size_t len)
ah->ar_op != htons(ARPOP_REQUEST))
return 1;
+ /* Discard announcements (but not 0.0.0.0 "probes"): we might have the
+ * same IP address, hide that.
+ */
+ if (*((uint32_t *)&am->sip) && !memcmp(am->sip, am->tip, 4))
+ return 1;
+
ah->ar_op = htons(ARPOP_REPLY);
memcpy(am->tha, am->sha, ETH_ALEN);
memcpy(am->sha, c->mac, ETH_ALEN);