* [PATCH net v4 0/2] vxlan: reset the remote's dst cache when snooping moves a MAC @ 2026-11-13 15:51 Zhefu Peng 2026-11-13 15:51 ` [PATCH net v4 1/2] " Zhefu Peng 2026-11-13 15:51 ` [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving " Zhefu Peng 0 siblings, 2 replies; 5+ messages in thread From: Zhefu Peng @ 2026-11-13 15:51 UTC (permalink / raw) To: netdev Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mschiffer, nicolas.dichtel, shuah, linux-kselftest 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. Patch 2 adds a selftest for both cases. The selftest fails both cases on net without patch 1 (8 of 8 runs with 1, 2 and 4 CPUs) and passes them with it (16 of 16 runs). v4: - add the selftest (Nicolas Dichtel) v3: https://lore.kernel.org/netdev/20261111180001.2475-1-ilskdw@gmail.com/ - use my real name in From: and Signed-off-by: v2: https://lore.kernel.org/netdev/20261110153020.9635-1-ilskdw@gmail.com/ - 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/20261106144406.66035-1-ilskdw@gmail.com/ 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 | 3 + tools/testing/selftests/net/Makefile | 1 + .../selftests/net/test_vxlan_snoop_move.sh | 161 ++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100755 tools/testing/selftests/net/test_vxlan_snoop_move.sh -- 2.54.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v4 1/2] vxlan: reset the remote's dst cache when snooping moves a MAC 2026-11-13 15:51 [PATCH net v4 0/2] vxlan: reset the remote's dst cache when snooping moves a MAC Zhefu Peng @ 2026-11-13 15:51 ` Zhefu Peng 2026-11-17 16:14 ` netdev-bot+sashiko 2026-11-13 15:51 ` [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving " Zhefu Peng 1 sibling, 1 reply; 5+ messages in thread From: Zhefu Peng @ 2026-11-13 15:51 UTC (permalink / raw) To: netdev Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mschiffer, nicolas.dichtel, shuah, linux-kselftest vxlan_snoop() handles a known MAC that now arrives from another remote by rewriting the remote's IP address in place. It leaves the remote's dst_cache alone, so the next packet to that MAC is routed with the dst cached for the previous remote. When the two remotes have different next hops, the packet leaves the wrong way. For example, if the previous remote was on-link and the new one is behind a router, the device resolves the new remote's address on the local link, the neighbour stays incomplete, and traffic to the MAC is blackholed until the cached route is invalidated, such as by "ip route flush cache". The same branch also leaves remote_ifindex unchanged, although the early return compares it and vxlan_xmit_one() uses it as the output interface. When a MAC moves between an IPv6 link-local and another address, the remote keeps the previous interface, and every later packet from that remote enters the migration branch again. vxlan_fdb_replace(), which makes the same change through netlink, already resets the cache, updates remote_ifindex and clears offloaded. Do the same when snooping. Reproduced with network namespaces: a learning VXLAN device has one peer VTEP on-link and another behind a router, and an inner MAC moves from the first peer to the second. Without this patch, pings to the MAC fail after the move until the route cache is flushed: in 10 of 10 runs with one CPU, and in 5 of 6 runs with two CPUs, where it depends on whether the sending CPU holds the stale entry. With the patch, they succeed in all 16 runs. In a second setup over IPv6, the MAC moves from a peer with a global address to a peer with a link-local one. Without this patch, the move and every later packet from the new peer each send an RTM_NEWNEIGH notification, 33 in each run. With the patch, only the move sends one. This was found by our AI-driven automated live migration tests. The fix and this changelog were written with the help of an AI coding assistant. Fixes: 0c1d70af924b ("net: use dst_cache for vxlan device") Fixes: 87613de95041 ("vxlan: fix snooping for link-local IPv6 addresses") Signed-off-by: Zhefu Peng <ilskdw@gmail.com> --- drivers/net/vxlan/vxlan_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index d11028b37..6bc54642e 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1482,7 +1482,10 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev, "%pM migrated from %pIS to %pIS\n", src_mac, &rdst->remote_ip.sa, &src_ip->sa); + dst_cache_reset(&rdst->dst_cache); rdst->remote_ip = *src_ip; + rdst->remote_ifindex = ifindex; + rdst->offloaded = false; vxlan_fdb_notify(vxlan, f, rdst, RTM_NEWNEIGH, true, NULL); } else { /* learned new entry */ -- 2.54.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v4 1/2] vxlan: reset the remote's dst cache when snooping moves a MAC 2026-11-13 15:51 ` [PATCH net v4 1/2] " Zhefu Peng @ 2026-11-17 16:14 ` netdev-bot+sashiko 0 siblings, 0 replies; 5+ messages in thread From: netdev-bot+sashiko @ 2026-11-17 16:14 UTC (permalink / raw) To: ilskdw Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mschiffer, nicolas.dichtel, shuah, linux-kselftest Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 4 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] On a switchdev-offloaded device, the snoop migration path can now hit a notifier rejection that it ignores. - [Medium] A packet from the same remote now erases a user-configured `via <dev>` on a dynamic FDB entry. - [Medium] The patch adds two unlocked stores, rdst->remote_ifindex and rdst->offloaded, to fields that every other writer updates under… - [Medium] The stale dst-cache blackhole that the commit claims to fix can still happen through a race with a concurrent transmitter. -- vxlan: reset the remote's dst cache when snooping moves a MAC When a known MAC arrives from a different remote, this patch makes the migration branch of vxlan_snoop() reset the remote's dst_cache, update remote_ifindex and clear offloaded. That matches what vxlan_fdb_replace() already does for netlink updates. The goal is to stop routing with a stale cached dst after a MAC move, and to stop the repeated RTM_NEWNEIGH notifications when a MAC moves between link-local and other IPv6 addresses. > diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c > index d11028b374721..6bc54642e7f45 100644 > --- a/drivers/net/vxlan/vxlan_core.c > +++ b/drivers/net/vxlan/vxlan_core.c > @@ -1482,7 +1482,10 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev, > "%pM migrated from %pIS to %pIS\n", > src_mac, &rdst->remote_ip.sa, &src_ip->sa); > > + dst_cache_reset(&rdst->dst_cache); > rdst->remote_ip = *src_ip; [Severity: Medium] Can a transmitter on another CPU still fill the cache with a dst for the old remote after this reset? dst_cache_reset() only records a timestamp: static inline void dst_cache_reset(struct dst_cache *dst_cache) { WRITE_ONCE(dst_cache->reset_ts, jiffies); } vxlan_xmit_one() reads rdst->remote_ip into the flow key before it reaches dst_cache_get_ip4()/dst_cache_get_ip6() through udp_tunnel_dst_lookup(). dst_cache_per_cpu_get() treats an entry as valid while time_after(refresh_ts, reset_ts), and sets refresh_ts = jiffies on a miss. Consider this sequence: CPU0 (vxlan_xmit_one) CPU1 (vxlan_snoop) reads rdst->remote_ip (old) dst_cache_reset(), reset_ts = J <jiffies advances to J+1> dst_cache_get misses, refresh_ts = J+1 rdst->remote_ip = *src_ip routes the old address, dst_cache_set_ip4/ip6() >From then on, CPU0 reads the new remote_ip, but dst_cache_per_cpu_get() returns the dst for the old remote because time_after(J+1, J) is true. Wouldn't that be the same blackhole the changelog describes, lasting until the route is invalidated (for example by "ip route flush cache")? Moving the address store ahead of the reset doesn't close the window. Nothing orders the reset_ts store against the remote_ip store for lockless readers on weakly ordered CPUs. The window is narrow because it needs a jiffies tick at the right moment. It is widest in the live migration case this patch targets, where traffic flows both ways during the move. On PREEMPT_RT, the xmit path can also be preempted between reading the IP and the cache lookup. vxlan_fdb_replace() has the same weakness. > + rdst->remote_ifindex = ifindex; [Severity: Medium] Could a packet from the same remote now erase a user-configured "via <dev>" on a dynamic FDB entry? For IPv4 or global IPv6 sources, vxlan_snoop() keeps ifindex at 0. Only link-local IPv6 sources get src_ifindex. vxlan_fdb_parse() accepts NDA_IFINDEX for any address family, so a dynamic entry such as: bridge fdb add MAC dev vxlan0 dst 10.0.0.2 via eth1 dynamic has remote_ifindex set to eth1. The first packet from 10.0.0.2 with that inner source MAC fails the early return: if (likely(vxlan_addr_equal(&rdst->remote_ip, src_ip) && rdst->remote_ifindex == ifindex)) return SKB_NOT_DROPPED_YET; because remote_ifindex is eth1 and ifindex is 0. The entry is not NUD_PERMANENT or NUD_NOARP, so it enters the migration branch and logs "migrated from 10.0.0.2 to 10.0.0.2". With this patch, that branch overwrites remote_ifindex with 0, resets the dst_cache and clears offloaded. vxlan_xmit_one() uses the field as the oif for the underlay route lookup: ifindex = rdst->remote_ifindex; Later packets to the MAC are then routed without the configured egress interface. On multi-homed or VRF underlays, that can change the egress device. Before this patch, the same case sent a notification on every packet but kept the configured interface. The commit message only covers link-local moves and doesn't mention this case. Should remote_ifindex only be rewritten when the remote actually changes? > + rdst->offloaded = false; [Severity: Medium] Can these new stores race with the other writers of these fields? vxlan_snoop() runs in RX softirq under rcu_read_lock only, without vxlan->hash_lock. vxlan_fdb_replace(), vxlan_fdb_offloaded_set() and vxlan_fdb_clear_offload() all write remote_ip, remote_ifindex and offloaded while holding hash_lock. One interleaving involves vxlan_fdb_offloaded_set(). Under hash_lock, it finds the rdst through vxlan_fdb_find_rdst() using the old (remote_ip, port, vni, remote_ifindex). Snoop on another CPU then writes the new remote and offloaded = false, and sends ADD_TO_DEVICE. After that, vxlan_fdb_offloaded_set() resumes: rdst->offloaded = fdb_info->offloaded; The entry now names the new remote but is marked offloaded for the old one. The flag stays wrong if the driver rejects the new remote, as in the mlxsw link-local case below. Another interleaving involves two RX CPUs that see the same inner source MAC, one from remote A (IPv6 link-local, ifindex X) and one from remote B (global, ifindex 0). Both enter the migration branch, and the remote_ip copy and remote_ifindex stores can interleave. That can leave A's address with B's ifindex of 0, or a torn address. vxlan_xmit_one() reads remote_ifindex and remote_ip with separate plain loads, so it would route a link-local destination with oif 0. The unlocked in-place remote_ip update predates this patch. These new stores extend it to the fields the commit message says it keeps consistent. Would it work to take hash_lock and re-check the state here, as the learn-new-entry branch already does? > vxlan_fdb_notify(vxlan, f, rdst, RTM_NEWNEIGH, true, NULL); [Severity: Medium] What happens here when a switchdev driver rejects the new remote_ifindex? With swdev_notify set, vxlan_fdb_notify() returns early when the notifier fails: case RTM_NEWNEIGH: err = vxlan_fdb_switchdev_call_notifiers(vxlan, fdb, rd, true, extack); if (err) return err; vxlan_snoop() ignores that return value. With this patch, a snooped IPv6 link-local source now passes a non-zero remote_ifindex to the notifier, and mlxsw_sp_switchdev_vxlan_work_prepare() in spectrum_switchdev.c rejects it: if (vxlan_fdb_info->remote_ifindex) { NL_SET_ERR_MSG_MOD(extack, "VxLAN: FDB: Local interface is not supported"); return -EOPNOTSUPP; } __vxlan_fdb_notify() then never runs, so no RTM_NEWNEIGH reaches userspace. The snoop path also keeps the in-place change. On the same error, vxlan_fdb_update_existing() restores the old rdst: if ((flags & NLM_F_REPLACE) && rc) *rd = oldrd; Wouldn't the software FDB then point the MAC at (link-local IP, ifindex X) with offloaded = false, while the hardware FDB still forwards to the old global remote? Nothing in netlink would report the mismatch. Before this patch, snoop never changed remote_ifindex, so this error path was effectively unreachable from snoop. Whether it is reachable now depends on such a packet reaching the software vxlan socket instead of being decapsulated in hardware. > } else { > /* learned new entry */ -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113155133.75090-1-ilskdw%40gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving a MAC 2026-11-13 15:51 [PATCH net v4 0/2] vxlan: reset the remote's dst cache when snooping moves a MAC Zhefu Peng 2026-11-13 15:51 ` [PATCH net v4 1/2] " Zhefu Peng @ 2026-11-13 15:51 ` Zhefu Peng 2026-11-17 16:14 ` netdev-bot+sashiko 1 sibling, 1 reply; 5+ messages in thread From: Zhefu Peng @ 2026-11-13 15:51 UTC (permalink / raw) To: netdev Cc: andrew+netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mschiffer, nicolas.dichtel, shuah, linux-kselftest Add a test for a learning VXLAN device that snoops a known MAC from another VTEP. The first case moves the MAC from an on-link IPv4 remote to a remote behind a router, and checks that traffic to the MAC still flows. This fails while the device keeps the route cached for the previous remote. The second case moves the MAC from a global IPv6 remote to a link-local one, and checks that the FDB entry records the new output interface. Both cases ping from CPU 0. The route cache is per CPU, and only the CPU that filled it hits the stale entry. This test was written with the help of an AI coding assistant. Signed-off-by: Zhefu Peng <ilskdw@gmail.com> --- tools/testing/selftests/net/Makefile | 1 + .../selftests/net/test_vxlan_snoop_move.sh | 161 ++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100755 tools/testing/selftests/net/test_vxlan_snoop_move.sh diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index baea3e7f0..69d440c5b 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -118,6 +118,7 @@ TEST_PROGS := \ test_vxlan_mdb.sh \ test_vxlan_nh.sh \ test_vxlan_nolocalbypass.sh \ + test_vxlan_snoop_move.sh \ test_vxlan_under_vrf.sh \ test_vxlan_vnifilter_notify.sh \ test_vxlan_vnifiltering.sh \ diff --git a/tools/testing/selftests/net/test_vxlan_snoop_move.sh b/tools/testing/selftests/net/test_vxlan_snoop_move.sh new file mode 100755 index 000000000..e8c91fbcc --- /dev/null +++ b/tools/testing/selftests/net/test_vxlan_snoop_move.sh @@ -0,0 +1,161 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Check that a learning VXLAN device fully updates a remote when snooping +# moves a known MAC to another VTEP: +# +# - The route cached for the old remote is dropped. The old remote is +# on-link and the new one is behind a router, so a stale cached route +# blackholes traffic to the moved MAC. +# - The output interface follows the new remote. The MAC moves from a +# global IPv6 address to a link-local one, which needs an interface. + +# shellcheck disable=SC2154,SC2329 # setup_ns sets the ns names; tests_run calls the tests +source lib.sh + +ALL_TESTS=" + test_move_behind_router + test_move_to_link_local +" + +MAC=02:00:c0:a8:00:0a + +ping_from_cpu0() +{ + local ns=$1; shift + + taskset -c 0 ip netns exec "$ns" ping -c 3 -W 1 -i 0.2 "$@" &> /dev/null +} + +add_sw_port() +{ + local ns=$1; shift + local dev=$1; shift + local port=$1; shift + + ip link add "$dev" netns "$ns" type veth peer name "$port" netns "$sw" + ip -n "$sw" link set "$port" master br0 up + ip -n "$ns" link set "$dev" up +} + +test_move_behind_router() +{ + RET=0 + + setup_ns sw ex a r b + defer cleanup_ns "$sw" "$ex" "$a" "$r" "$b" + + ip -n "$sw" link add br0 up type bridge + add_sw_port "$ex" e0 s-e + add_sw_port "$a" a0 s-a + add_sw_port "$r" r0 s-r + ip link add r1 netns "$r" type veth peer name b0 netns "$b" + ip -n "$r" link set r1 up + ip -n "$b" link set b0 up + + ip -n "$ex" addr add 10.0.1.1/24 dev e0 + ip -n "$ex" route add default via 10.0.1.254 + ip -n "$a" addr add 10.0.1.2/24 dev a0 + ip -n "$r" addr add 10.0.1.254/24 dev r0 + ip -n "$r" addr add 10.0.2.254/24 dev r1 + ip netns exec "$r" sysctl -wq net.ipv4.ip_forward=1 + ip -n "$b" addr add 10.0.2.2/24 dev b0 + ip -n "$b" route add default via 10.0.2.254 + + ip -n "$ex" link add vx0 type vxlan id 42 dstport 4789 \ + local 10.0.1.1 learning + bridge -n "$ex" fdb append 00:00:00:00:00:00 dev vx0 dst 10.0.1.2 + bridge -n "$ex" fdb append 00:00:00:00:00:00 dev vx0 dst 10.0.2.2 + ip -n "$ex" addr add 192.168.0.1/24 dev vx0 + ip -n "$ex" link set vx0 up + + ip -n "$a" link add vx0 address "$MAC" type vxlan id 42 dstport 4789 \ + local 10.0.1.2 remote 10.0.1.1 + ip -n "$b" link add vx0 address "$MAC" type vxlan id 42 dstport 4789 \ + local 10.0.2.2 remote 10.0.1.1 + ip -n "$a" addr add 192.168.0.10/24 dev vx0 + ip -n "$b" addr add 192.168.0.10/24 dev vx0 + ip -n "$a" link set vx0 up + + ping_from_cpu0 "$ex" 192.168.0.10 + check_err $? "ping before the move failed" + + ip -n "$a" link set vx0 down + ip -n "$b" link set vx0 up + ip netns exec "$b" ping -c 1 -W 1 192.168.0.1 &> /dev/null + + bridge -n "$ex" fdb show dev vx0 | grep -q "$MAC dst 10.0.2.2 " + check_err $? "fdb entry did not move to the new remote" + + ping_from_cpu0 "$ex" 192.168.0.10 + check_err $? "ping after the move failed" + + log_test "IPv4 move to a remote behind a router" +} + +test_move_to_link_local() +{ + local ns + + RET=0 + + setup_ns sw ex a b + defer cleanup_ns "$sw" "$ex" "$a" "$b" + + for ns in "$sw" "$ex" "$a" "$b"; do + ip netns exec "$ns" sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec "$ns" sysctl -wq net.ipv6.conf.default.accept_dad=0 + done + + ip -n "$sw" link add br0 up type bridge + add_sw_port "$ex" e0 s-e + add_sw_port "$a" a0 s-a + add_sw_port "$b" b0 s-b + + ip -n "$ex" addr add 2001:db8:1::1/64 dev e0 nodad + ip -n "$ex" addr add fe80::1/64 dev e0 nodad + ip -n "$a" addr add 2001:db8:1::2/64 dev a0 nodad + ip -n "$b" addr add fe80::b/64 dev b0 nodad + + ip -n "$ex" link add vx0 type vxlan id 42 dstport 4789 \ + local 2001:db8:1::1 learning + bridge -n "$ex" fdb append 00:00:00:00:00:00 dev vx0 dst 2001:db8:1::2 + bridge -n "$ex" fdb append 00:00:00:00:00:00 dev vx0 dst fe80::b via e0 + ip -n "$ex" addr add 192.168.0.1/24 dev vx0 + ip -n "$ex" link set vx0 up + + ip -n "$a" link add vx0 address "$MAC" type vxlan id 42 dstport 4789 \ + local 2001:db8:1::2 remote 2001:db8:1::1 + ip -n "$b" link add vx0 address "$MAC" type vxlan id 42 dstport 4789 \ + local fe80::b remote fe80::1 dev b0 nolearning + ip -n "$a" addr add 192.168.0.10/24 dev vx0 + ip -n "$b" addr add 192.168.0.10/24 dev vx0 + ip -n "$a" link set vx0 up + + ping_from_cpu0 "$ex" 192.168.0.10 + check_err $? "ping before the move failed" + + ip -n "$a" link set vx0 down + ip -n "$b" link set vx0 up + ip netns exec "$b" ping -c 1 -W 1 192.168.0.1 &> /dev/null + + bridge -n "$ex" fdb show dev vx0 | grep -q "$MAC dst fe80::b via e0 " + check_err $? "fdb entry did not move to the new remote and interface" + + ping_from_cpu0 "$ex" 192.168.0.10 + check_err $? "ping after the move failed" + + log_test "IPv6 move from a global to a link-local remote" +} + +cleanup() +{ + defer_scopes_cleanup +} + +require_command taskset + +trap cleanup EXIT +tests_run + +exit "$EXIT_STATUS" -- 2.54.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving a MAC 2026-11-13 15:51 ` [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving " Zhefu Peng @ 2026-11-17 16:14 ` netdev-bot+sashiko 0 siblings, 0 replies; 5+ messages in thread From: netdev-bot+sashiko @ 2026-11-17 16:14 UTC (permalink / raw) To: ilskdw Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms, kuniyu, mschiffer, nicolas.dichtel, shuah, linux-kselftest Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In tools/testing/selftests/net/test_vxlan_snoop_move.sh, ping_from_cpu0() (lines 23-28) runs every ping as `taskset -c 0 ip… - [Low] test_move_behind_router() (line 45, `setup_ns sw ex a r b`) and test_move_to_link_local() (line 102, `setup_ns sw ex a b`) ignore the… -- selftests: net: add a test for vxlan snooping moving a MAC This adds a selftest for a learning VXLAN device that snoops a known MAC moving to another VTEP. The first case moves the MAC from an on-link IPv4 remote to one behind a router. The second moves it from a global IPv6 remote to a link-local one. Both cases ping from CPU 0 because the route cache is per CPU. > diff --git a/tools/testing/selftests/net/test_vxlan_snoop_move.sh b/tools/testing/selftests/net/test_vxlan_snoop_move.sh > new file mode 100755 > index 0000000000000..e8c91fbccf6a3 > --- /dev/null > +++ b/tools/testing/selftests/net/test_vxlan_snoop_move.sh > @@ -0,0 +1,161 @@ [ ... ] > +ping_from_cpu0() > +{ > + local ns=$1; shift > + > + taskset -c 0 ip netns exec "$ns" ping -c 3 -W 1 -i 0.2 "$@" &> /dev/null > +} [Severity: Low] What happens in ping_from_cpu0() if CPU 0 is not in the allowed affinity mask? That can happen under a cpuset that limits the run to CPUs 2-3, or when CPU 0 is offline. In that case sched_setaffinity() would fail with EINVAL. taskset would then exit non-zero and ping would never run. Both tests do this: ping_from_cpu0 "$ex" 192.168.0.10 check_err $? "ping before the move failed" check_err() records ksft_fail, so log_test() reports FAIL instead of SKIP. The only precondition check is at the end of the script: require_command taskset That goes through check_command(), which only runs command -v taskset. Could the script probe first with something like taskset -c 0 true and skip if it fails? Another option is to pick a CPU from the current affinity mask. For what it's worth, srv6_iptunnel_cache.sh also hardcodes taskset -c 0. > + > +add_sw_port() [ ... ] > +test_move_behind_router() > +{ > + RET=0 > + > + setup_ns sw ex a r b > + defer cleanup_ns "$sw" "$ex" "$a" "$r" "$b" [Severity: Low] Should test_move_behind_router() check the return value of setup_ns here? If ip netns add fails, setup_ns() in lib.sh cleans up the namespaces it has already created and returns $ksft_skip: if ! ip netns add "${!ns_name}"; then echo "Failed to create namespace $ns_name" cleanup_ns "${ns_list[@]}" return $ksft_skip fi The test keeps going anyway, but $sw, $ex and the other variables now name namespaces that no longer exist. Every later ip -n, bridge -n and ip netns exec command fails. The ping and fdb checks then call check_err(), and log_test() reports FAIL instead of SKIP. test_move_to_link_local() has the same problem with setup_ns sw ex a b. A few existing tests, including bareudp.sh, fou_gre_gro.sh and nsh_gso.sh, check the setup_ns return value with ||. [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113155133.75090-1-ilskdw%40gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-17 16:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-13 15:51 [PATCH net v4 0/2] vxlan: reset the remote's dst cache when snooping moves a MAC Zhefu Peng 2026-11-13 15:51 ` [PATCH net v4 1/2] " Zhefu Peng 2026-11-17 16:14 ` netdev-bot+sashiko 2026-11-13 15:51 ` [PATCH net v4 2/2] selftests: net: add a test for vxlan snooping moving " Zhefu Peng 2026-11-17 16:14 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox