Skip to content

Commit f0bf701

Browse files
borkmannSasha Levin
authored andcommitted
vxlan: Fix regression when dropping packets due to invalid src addresses
[ Upstream commit 1cd4bc9 ] Commit f58f45c ("vxlan: drop packets from invalid src-address") has recently been added to vxlan mainly in the context of source address snooping/learning so that when it is enabled, an entry in the FDB is not being created for an invalid address for the corresponding tunnel endpoint. Before commit f58f45c vxlan was similarly behaving as geneve in that it passed through whichever macs were set in the L2 header. It turns out that this change in behavior breaks setups, for example, Cilium with netkit in L3 mode for Pods as well as tunnel mode has been passing before the change in f58f45c for both vxlan and geneve. After mentioned change it is only passing for geneve as in case of vxlan packets are dropped due to vxlan_set_mac() returning false as source and destination macs are zero which for E/W traffic via tunnel is totally fine. Fix it by only opting into the is_valid_ether_addr() check in vxlan_set_mac() when in fact source address snooping/learning is actually enabled in vxlan. This is done by moving the check into vxlan_snoop(). With this change, the Cilium connectivity test suite passes again for both tunnel flavors. Fixes: f58f45c ("vxlan: drop packets from invalid src-address") Signed-off-by: Daniel Borkmann <[email protected]> Cc: David Bauer <[email protected]> Cc: Ido Schimmel <[email protected]> Cc: Nikolay Aleksandrov <[email protected]> Cc: Martin KaFai Lau <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Reviewed-by: Nikolay Aleksandrov <[email protected]> Reviewed-by: David Bauer <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 52d15e9 commit f0bf701

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/vxlan/vxlan_core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,10 @@ static bool vxlan_snoop(struct net_device *dev,
14931493
struct vxlan_fdb *f;
14941494
u32 ifindex = 0;
14951495

1496+
/* Ignore packets from invalid src-address */
1497+
if (!is_valid_ether_addr(src_mac))
1498+
return true;
1499+
14961500
#if IS_ENABLED(CONFIG_IPV6)
14971501
if (src_ip->sa.sa_family == AF_INET6 &&
14981502
(ipv6_addr_type(&src_ip->sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL))

0 commit comments

Comments
 (0)