Skip to content

vxlan: reset the remote's dst cache when snooping moves a MAC

Zhefu Peng linux-kselftest netdev 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 1 replyIn review
  2. v52 patches 1 replySuperseded
  3. v42 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v31 patch2 repliesSuperseded
v21 patch3 repliesSuperseded
v11 patch1 replySuperseded

Changes in v6 from the cover letter

- update the remote under vxlan->hash_lock and check the entry again once the lock is held, so concurrent snoops cannot mix remote_ip and remote_ifindex (Sashiko)
- selftest: pin pings to an allowed CPU instead of CPU 0, skip when setup_ns fails, and drop the CPU pinning from the IPv6 case, which does not test the route cache (Sashiko)

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2vxlan: reset the remote's dst cache when snooping moves a MACdrivers/net/vxlan/vxlan_core.c+51 -81 reply
2/2selftests: net: add a test for vxlan snooping moving a MACtools/testing/selftests/net/Makefile tools/testing/selftests/net/test_vxlan_snoop_move.sh+223 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH net v6 0/2] vxlan: reset the remote's dst cache when snooping moves a MAC

When a learning VXLAN device snoops a known MAC from another VTEP, it rewrites the remote's IP address in place but keeps the remote's dst_cache and remote_ifindex. Traffic to the moved MAC can then use the route cached for the previous remote and be blackholed. Patch 1 updates the remote the way vxlan_fdb_replace() does, under vxlan->hash_lock, and compares remote_ifindex in the early return only for link-local sources, so a "via" device set on a dynamic entry is kept. Patch 2 adds a selftest.

Results on net with 1, 2 and 4 CPUs, per selftest case (move behind a router, move to link-local, via kept):
- without patch 1: 0/7, 0/7, 7/7
- with v5 of patch 1: 7/7, 7/7, 7/7
- with this version: 14/14, 14/14, 14/14
- with this version and CONFIG_PROVE_LOCKING: 7/7 for each case, no lockdep splats

v6:
- update the remote under vxlan->hash_lock and check the entry again once the lock is held, so concurrent snoops cannot mix remote_ip and remote_ifindex (Sashiko)
- selftest: pin pings to an allowed CPU instead of CPU 0, skip when setup_ns fails, and drop the CPU pinning from the IPv6 case, which does not test the route cache (Sashiko)

v5: https://lore.kernel.org/netdev/[email protected]/
- compare remote_ifindex in the early return only for link-local sources, so traffic from the same remote no longer resets a "via" device to 0 (Sashiko)
- selftest: add a case for the above and keep lines within 80 columns

v4: https://lore.kernel.org/netdev/[email protected]/
- add the selftest (Nicolas Dichtel)

v3: https://lore.kernel.org/netdev/[email protected]/
- use my real name in From: and Signed-off-by:

v2: https://lore.kernel.org/netdev/[email protected]/
- also update remote_ifindex and clear offloaded, as vxlan_fdb_replace() does
- add the IPv6 link-local case to the changelog and a second Fixes tag

v1: https://lore.kernel.org/netdev/[email protected]/

Zhefu Peng (2):
vxlan: reset the remote's dst cache when snooping moves a MAC
selftests: net: add a test for vxlan snooping moving a MAC

 drivers/net/vxlan/vxlan_core.c                |  59 ++++-
 tools/testing/selftests/net/Makefile          |   1 +
 .../selftests/net/test_vxlan_snoop_move.sh    | 222 ++++++++++++++++++
 3 files changed, 274 insertions(+), 8 deletions(-)
 create mode 100755 tools/testing/selftests/net/test_vxlan_snoop_move.sh
Signature · 1 line
2.54.0