Article View: linux.kernel.netdev
Article #20888Re: [PATCH net v6 1/2] vxlan: reset the remote's dst cache when snooping moves a MAC
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 10:19
Date: Mon, 23 Nov 2026 10:19
165 lines
13495 bytes
13495 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1
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] The patch does not close the stale dst_cache problem it says
it fixes.
- [Low] The re-check under the lock in vxlan_snoop_move() runs its tests
in a different order from the lockless fast path in vxlan_snoop().
--
vxlan: reset the remote's dst cache when snooping moves a MAC
When vxlan_snoop() sees a known MAC arrive from a different remote, it
now resets the remote's dst_cache, updates remote_ifindex and clears
offloaded, matching what vxlan_fdb_replace() does. It compares
remote_ifindex only for IPv6 link-local sources. The remote update now
runs in a new helper, vxlan_snoop_move(), which holds vxlan->hash_lock
and checks the entry again once the lock is taken.
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index d11028b374721..8738be39e6019 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -1434,6 +1434,51 @@ static int vxlan_fdb_get(struct sk_buff *skb,
[ ... ]
> +static enum skb_drop_reason vxlan_snoop_move(struct net_device *dev,
> + struct vxlan_fdb *f,
> + const u8 *src_mac,
> + union vxlan_addr *src_ip,
> + u32 ifindex)
> +{
> + struct vxlan_dev *vxlan = netdev_priv(dev);
> + struct vxlan_rdst *rdst;
> +
> + lockdep_assert_held(&vxlan->hash_lock);
> +
> + /* The entry may have changed before the lock was taken */
> + if (hlist_unhashed(&f->fdb_node))
> + return SKB_NOT_DROPPED_YET;
> +
> + if (rcu_access_pointer(f->nh) ||
> + (f->state & (NUD_PERMANENT | NUD_NOARP)))
> + return SKB_DROP_REASON_VXLAN_ENTRY_EXISTS;
> +
> + rdst = first_remote_rcu(f);
> + if (vxlan_snoop_same_remote(rdst, src_ip, ifindex))
> + return SKB_NOT_DROPPED_YET;
[Severity: Low]
Is this check order intended? The lockless path in vxlan_snoop() calls
vxlan_snoop_same_remote() before the NUD_PERMANENT | NUD_NOARP test. Here
the static-state test runs first.
Consider this sequence:
CPU A in vxlan_snoop() sees a dynamic entry with a different remote and
calls spin_lock(&vxlan->hash_lock).
Before CPU A gets the lock, "bridge fdb replace <mac> dst <src_ip>
permanent" runs vxlan_fdb_update_existing() under hash_lock. That sets
f->state = NUD_PERMANENT, and vxlan_fdb_replace() sets
remote_ip = src_ip.
CPU A then takes the lock, and vxlan_snoop_move() returns
SKB_DROP_REASON_VXLAN_ENTRY_EXISTS.
The packet is dropped, even though it came from the remote the static
entry now points to. The lockless path would have accepted the same
packet.
Would it make sense to move the same-remote check ahead of the
static-state check? The nh check would have to stay first, since
first_remote_rcu() is not valid for nexthop entries.
> +
> + if (net_ratelimit())
> + netdev_info(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;
[Severity: Medium]
Does this fully close the stale dst_cache window the patch is meant to
fix?
vxlan_xmit_one() does not take hash_lock. It copies the remote into the
lookup key well before it looks at the dst_cache:
drivers/net/vxlan/vxlan_core.c:vxlan_xmit_one() {
...
ifindex = rdst->remote_ifindex;
if (addr_family == AF_INET) {
key.u.ipv4.src = cfg->saddr.sin.sin_addr.s_addr;
key.u.ipv4.dst = rdst->remote_ip.sin.sin_addr.s_addr;
...
}
Later it calls udp_tunnel_dst_lookup(), which does dst_cache_get_ip4(),
then ip_route_output_key() on a miss, then dst_cache_set_ip4().
Cache validity is purely time based:
net/core/dst_cache.c:dst_cache_per_cpu_get() {
...
if (unlikely(!time_after(idst->refresh_ts,
READ_ONCE(dst_cache->reset_ts)) ||
...
fail:
idst->refresh_ts = jiffies;
return NULL;
}
Here is a possible sequence:
CPU1 (vxlan_xmit_one) CPU2 (vxlan_snoop_move)
key.u.ipv4.dst = old remote A
dst_cache_reset() /* reset_ts = J0 */
rdst->remote_ip = B
<jiffy tick, now J0+1>
dst_cache_get_ip4()
miss, refresh_ts = J0+1
ip_route_output_key() for A
dst_cache_set_ip4(route for A)
After that, every later lookup on CPU1 passes the time_after(refresh_ts,
reset_ts) test. The IPv4 obsolete check only fails when the route genid
changes.
Would packets with outer daddr B then keep using the next hop chosen for
A? That is the blackhole the commit message describes, and it would
last until something like "ip route flush cache" or another reset.
Doing the stores before dst_cache_reset() does not seem to help, since
CPU1 can still read A before either of them. Would this need a re-check
or a generation check between the route lookup and dst_cache_set, or an
rdst replaced via RCU?
vxlan_fdb_replace() and the other dst_cache_reset() users follow the
same pattern.
> + rdst->offloaded = false;
> + vxlan_fdb_notify(vxlan, f, rdst, RTM_NEWNEIGH, true, NULL);
> +
> + return SKB_NOT_DROPPED_YET;
> +}
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119095256.42005-1-ilskdw%40gmail.com
Technical Details
Message-ID:
<179542917290.3135.7119976710700884013@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369240-linux-kernel-netdev=dewy.ruReferences:
<20261119095256.42005-2-ilskdw@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369240-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v6 1/2] vxlan: reset the remote's dst cache when snooping moves a MAC Date: Mon, 23 Nov 2026 10:19:32 +0000 Organization: Usenet Network Message-ID: <179542917290.3135.7119976710700884013@kernel.org> References: <20261119095256.42005-2-ilskdw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3850208"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Z8JkLhctP/N9IDWwgQ48w3XnwMk= sha256:9lWMNbGv3N8nDZf9HLG4OwSaXTMdE5MHaC0wGqwHyww= sha1:8v6FuKly6l8L4aKpKlWkkXaKbLA= sha256:+RERSZbk9CC2xXJ/UCnWjBguEj9YQDyuhbtG7qVsBtg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id DED28125D9A; Mon, 23 Nov 2026 13:19:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wny6jcx5TN0k; Mon, 23 Nov 2026 13:19:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-369240-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id CA860125D96; Mon, 23 Nov 2026 13:19:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 917BF27F5E; Mon, 23 Nov 2026 10:19:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795429175; b=rdAMaX1bbIkO6zAnbx0+6fgoRDeUjVJ8t6Pu5mvNtPTBYJtbkp702fJjie4evAG21YQx 10GNBmP2u2oXK4t/MGttUIT61mWxx3mWqwwTCpt7PQv76J/IbW+vgtdf4qOURBKjxvE/2 FGCWd1T4hITS2Pk4bT2UXUHPx6OoCQUruJpsYEint+crGXdB3ZEKbGT/W+PEbG7fDLqgd 5spA9CiMcVIxQfNIhQZhShRhGMt0hkTjrubrAne2uWn2Yk1kK5XZ5Gpp1VJ36KQYXybFR 6NyIuZHLaQBi80xdAY4sAqetzJ47W12qFuJmcd1ZU6/S2Lh8FSQiMVFYtxbi+vH/yyg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795429175; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=F8v/n8HAlGN35GNXNOZO9vza3hTM28edWtZoDu3Dyfk=; b=TOFqD6hbPRSmWY5lttli3F/dZg4FVXxAXlblJdi4xHfw8/KF/6awr71/LQ5W9XKed8Rc SiM2fufj94ZSt8cON2ziOSHvmDewQhjAqHF2vtLEf6qCmOWX3dhuptIsh+UpPe3lrZvL3 rZLUdFuFRXKFE8KyHCUSWl63NujmHp+4/WW0LIAaPr044DgqcFkipndzAd5BTBUl3KYIt nr5kHfspvFY2LPC4j/cUBAANIKDPNBeguEjG45E6pxK7CnU7qz8bLunTvsWs5FASTsjWJ 23SxIqLKRnsJhXITt/Y6fhbE+tKVD8ajrjoh/zS/y6VQJnYIt3aBnTXERGtiCbj6/Tw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Z5ez2xK/"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AD10606A32D; Mon, 23 Nov 2026 10:19:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z5ez2xK/ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795429174; b=BJXNpBxXl9QY/TkeoRVWGp2e+oPSZOgeqt/JKSSRpcwK9yNzj3SROofWta2qxQ+9QvQT 2XVOJKGpLGL4Vqa3Z9hUW9eHA8awQ48iHr58oTyZOWAIiT+K2uk/vWJ+++gEVtCg+Qnwb DXaeYcL/5sugyRnRDXNz99F6OMv4g195UtwobH7f2Q2Mxvct15GUSzSRXxgKDCGZgTVYR RpWki9zU+zRvblS0+gDBQDusj1UOfyjX2aGv4kjY9G2gb7XOSXYIfO7nFU1/s9/SDfRwD KR78RzA2zEySrxSRol05L/fDKDGs+07QhmeH/Qj5UNaoOEntEnrzFeU5+8xjxG+RYzg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795429174; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=F8v/n8HAlGN35GNXNOZO9vza3hTM28edWtZoDu3Dyfk=; b=iwP5+Dp2EzwhzyCIWxbbl/ni51Q1WSERTO2Cm0hKZ19YW7rKwMQQC65SSRcQuyDueA4n 7ySnFRmY0h8FFuBzGXWRiD94ZQs1YAzCXmXFnKhzgh1GHq0DY7x4vprRo4tQWl5Zz3UsX WESY81a4W9vQdVvM5yQrxHsO1PTUt54JYZHbbof8lyxNz2ybkoIufbUqbsUMFsAriEuG6 4M5LlGxAr7aSAnZi4hrUaixSo8hQzrXNX+AxwDDdqUpYq2ZmW52sUYt4p91YQI8mvROeO vB7n+B29yXaUTuR/m5+k6S77jtQyEJimJ7SGWAaHyXcezpXRd7T5Y6XIwmznBzNGwWA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Z5ez2xK/"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 760D1606A31A; Mon, 23 Nov 2026 10:19:34 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CF941F000C6; Mon, 23 Nov 2026 10:19:33 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795429174; bh=F8v/n8HAlGN35GNXNOZO9vza3hTM28edWtZoDu3Dyfk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Z5ez2xK/vqwV0tZavLQQZIYA/oXS5T7++ezWNmN5QyAk53WoRLb38ns2iajFu//Bq dfOLooumBywho0Oe7HQRkmD2Q/y4I8q3wGilEalvciQbk05haexQWxEWZBt2P/w2KC Tt4gUSPm0fUpPtOkKMUxDTOqxlWwBgp0EjmzOxE+ZV7eJxjTgm78d8BNxw62yW2s2t xHGqB88Wj0FI8lr7uBXwhOj/GvPDI8DzGr4oIY9PW1AW6Y9a8aWwxBm54iGjXXuXTw SxDu52AR0bmppIOJ0AmOFCar4nAtqj4VOjBTk13BJiavMryMqGZWGZ6eqoHCMxT6XW a4v6K44LDSnqA== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, kuniyu@google.com, mschiffer@universe-factory.net, nicolas.dichtel@6wind.com, shuah@kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261119095256.42005-2-ilskdw@gmail.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list