mirror of
https://passt.top/passt
synced 2024-12-22 21:55:22 +00:00
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>
This commit is contained in:
parent
1e49d194d0
commit
2166c5872e
6
arp.c
6
arp.c
@ -57,6 +57,12 @@ int arp(struct ctx *c, struct ethhdr *eh, size_t len)
|
|||||||
ah->ar_op != htons(ARPOP_REQUEST))
|
ah->ar_op != htons(ARPOP_REQUEST))
|
||||||
return 1;
|
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);
|
ah->ar_op = htons(ARPOP_REPLY);
|
||||||
memcpy(am->tha, am->sha, ETH_ALEN);
|
memcpy(am->tha, am->sha, ETH_ALEN);
|
||||||
memcpy(am->sha, c->mac, ETH_ALEN);
|
memcpy(am->sha, c->mac, ETH_ALEN);
|
||||||
|
Loading…
Reference in New Issue
Block a user