From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795059245; b=tH7Huxbl1jr/1qo5aqfgAjnG/GZMKrHEAjHocqvo4DQnnjxafxGcMVUZN9a3FM8F/P9n YGyDEbuQrIjp6bWYSwlVGUEujXzGoBC+kVd8ejgHPBT9PJFpbA309FPA7Qb44Pa74V+Eh ypjtC0+LfxxwnUocuhrTBFI5qeU4cURCO2v6WUX9m7LEWkTWV1X6GMDYnpGG7sdLUyzUq bE2CTgXfYC8ViqHjvOtog2fIO5Vcuu8Wt8986z4ASTTIp8SKTCfw/hZjROwNd3ue01qYl 7j3/wlVzrJTkY7ehaSYUYQVOGv8czuF04m26odVg7xRe7x3YAoWnldAczPTEHTW/ZZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795059245; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=VDVe/5VDTlkMroommGU96xPwazsStTVxzYkYVdYwN4U=; b=o49PEYgMI6f7ukXshAtfVE41ofPv/hC9rAIOcvg/mnQ91porJ+hD0QaN8SmU0WO791jq 9diFlWF+wuU7WTtivRL8rnzvQRlVSiG0+IgqZ9oC116aIktzmiZsRSpofY3VC5YI4tRNa fuUPSoSxSGl8Q2FLDeNw9GJquGmNrV8ABgkIDK+hhX55uQvJRsSG+3mw5OMmqOdYN3GuI S294xQKaBvRQOkB4PosY9SI4rMWj+C5dc0415PJGSUzJ2aoVSPRyHH3UDayvADD6YU9KS 9qD5lPwQ1UQOWzdk4XNlZJRpffMCaiKg5AoekC1xSeQ28AF7Eqluzx4zQO1waJKABfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hsBI0ZiE; arc=none smtp.remote-ip=100.103.45.18 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 64A92606A320; Thu, 19 Nov 2026 03:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hsBI0ZiE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67A371F000C4; Thu, 19 Nov 2026 03:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795059245; bh=VDVe/5VDTlkMroommGU96xPwazsStTVxzYkYVdYwN4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hsBI0ZiE5Fz6k6ACWD6UDQofZouzgiGl8jVq7KhnDyK6Oxo0D0UHInHB4/HpiCFX+ lxSZsi7EsBcGZmlPIQkikTPa4BiOQ5dzO3e9I/HbohcVfLcpxmzxKTT+PwwKpT5mQ/ psY4CJFAQ6pM16f1wrb6r0IMnTiqc7+/comvvW/k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sascha Frey , Ido Schimmel , Nikolay Aleksandrov , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 0773/1848] vxlan: Stop rejecting dynamic FDB entries with a nexthop ID Date: Wed, 18 Nov 2026 15:46:51 +0100 Message-ID: <20261118145948.730773874@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118145911.150052362@linuxfoundation.org> References: <20261118145911.150052362@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ido Schimmel [ Upstream commit 7308ef8b4a6779a39f68d053c19b53a5c584a663 ] Commit 98fc57d16744 ("vxlan: reject dynamic fdb entries that reference a nexthop id") started rejecting FDB entries that point to FDB nexthops unless they are configured as "permanent" or "static". The intent was to prevent such entries from being aged out by vxlan_cleanup(), which runs without RTNL and can therefore race with other VXLAN devices that modify the same per-nexthop FDB list. However, FRR installs remote MACs that are behind a multihomed Ethernet Segment (EVPN-MH) as dynamic FDB entries that point to an FDB nexthop group. Since the above commit, these entries are rejected and traffic towards the corresponding MACs is flooded to all the remote VTEPs. These entries are also marked as externally learned ("extern_learn") and are therefore skipped by vxlan_cleanup(), but exempting externally learned entries from the checks is not enough: vxlan_cleanup() reads the state and flags of an entry without the hash lock, so an entry that is concurrently changed from dynamic and externally learned to static can still be aged out. Instead, remove the checks added by the above commit and make vxlan_cleanup() skip FDB entries that point to FDB nexthops. Such entries can only be configured from user space, cannot be learned and cannot roam, so there is no reason to age them out. The nexthop pointer of an FDB entry is set before the entry is linked and is only cleared after it was unlinked and an RCU grace period has passed, so it can be checked without the hash lock. Adjust the test cases added by the above commit and add a test case that checks that dynamic FDB entries that point to FDB nexthops are not aged out. Without the fix: # ./fib_nexthops.sh -t "ipv4_fdb_grp_fcnal ipv6_fdb_grp_fcnal" IPv4 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [FAIL] TEST: Fdb mac add with nexthop group and extern_learn [FAIL] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [FAIL] [...] IPv6 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [FAIL] TEST: Fdb mac add with nexthop group and extern_learn [FAIL] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [FAIL] [...] Tests passed: 44 Tests failed: 6 Tests skipped: 0 With the fix: # ./fib_nexthops.sh -t "ipv4_fdb_grp_fcnal ipv6_fdb_grp_fcnal" IPv4 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [ OK ] TEST: Fdb mac add with nexthop group and extern_learn [ OK ] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [ OK ] [...] IPv6 fdb groups functional -------------------------- [...] TEST: Fdb mac add with nexthop group and dynamic state [ OK ] TEST: Fdb mac add with nexthop group and extern_learn [ OK ] TEST: Fdb mac without nexthop group aged out [ OK ] TEST: Fdb mac with nexthop group not aged out [ OK ] [...] Tests passed: 50 Tests failed: 0 Tests skipped: 0 Fixes: 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries") Fixes: 98fc57d16744 ("vxlan: reject dynamic fdb entries that reference a nexthop id") Cc: stable@vger.kernel.org Reported-by: Sascha Frey Closes: https://lore.kernel.org/netdev/20261028142928.GA8406@techfak.de/ Tested-by: Sascha Frey Signed-off-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov Link: https://patch.msgid.link/20261030133750.28668-1-idosch@nvidia.com Signed-off-by: Paolo Abeni [ idosch: fixed a small conflict in vxlan_fdb_add(), adjusted the vxlan_cleanup() hunk to the per-bucket FDB iteration in this tree and open-coded the wait in fdb_entry_aged() since slowwait() is not available to fib_nexthops.sh in this tree ] Signed-off-by: Ido Schimmel Signed-off-by: Sasha Levin --- drivers/net/vxlan/vxlan_core.c | 14 ++----- tools/testing/selftests/net/fib_nexthops.sh | 46 +++++++++++++++------ 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index f10bbdc1b8260..7c2b826f01aa5 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1069,12 +1069,6 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, return -EOPNOTSUPP; } - if (rcu_access_pointer(f->nh) && - !(state & (NUD_PERMANENT | NUD_NOARP))) { - NL_SET_ERR_MSG(extack, "Cannot make a nexthop fdb dynamic"); - return -EOPNOTSUPP; - } - /* Do not allow an externally learned entry to take over an entry added * by the user. */ @@ -1327,11 +1321,6 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], if (err) return err; - if (nhid && !(ndm->ndm_state & (NUD_PERMANENT | NUD_NOARP))) { - NL_SET_ERR_MSG(extack, "A nexthop fdb cannot be dynamic"); - return -EINVAL; - } - if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family) return -EAFNOSUPPORT; @@ -3030,6 +3019,9 @@ static void vxlan_cleanup(struct timer_list *t) if (f->flags & NTF_EXT_LEARNED) continue; + if (rcu_access_pointer(f->nh)) + continue; + timeout = READ_ONCE(f->used) + vxlan->cfg.age_interval * HZ; if (time_before_eq(timeout, jiffies)) { netdev_dbg(vxlan->dev, diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh index bd9448be9dfe6..54d9be192bffe 100755 --- a/tools/testing/selftests/net/fib_nexthops.sh +++ b/tools/testing/selftests/net/fib_nexthops.sh @@ -335,6 +335,20 @@ stop_ip_monitor() return $rc } +fdb_entry_aged() +{ + local mac=$1 + local dev=$2 + local i + + for i in $(seq 20); do + $BRIDGE fdb get to $mac dev $dev self &> /dev/null || return 0 + sleep 1 + done + + return 1 +} + check_nexthop_fdb_support() { $IP nexthop help 2>&1 | grep -q fdb @@ -410,14 +424,18 @@ ipv6_fdb_grp_fcnal() log_test $? 0 "Fdb mac add with nexthop group and static state" run_cmd "$BRIDGE fdb add 02:02:00:00:00:16 dev vx10 nhid 102 self dynamic" - log_test $? 255 "Fdb mac add with nexthop group and dynamic state" + log_test $? 0 "Fdb mac add with nexthop group and dynamic state" - run_cmd "$BRIDGE fdb add 02:02:00:00:00:17 dev vx10 nhid 102 self" - run_cmd "$BRIDGE fdb replace 02:02:00:00:00:17 dev vx10 dst 2001:db8:91::11 self dynamic" - log_test $? 255 "Fdb mac replace with nexthop group and dynamic state" + run_cmd "$BRIDGE fdb add 02:02:00:00:00:17 dev vx10 nhid 102 self dynamic extern_learn" + log_test $? 0 "Fdb mac add with nexthop group and extern_learn" - run_cmd "$BRIDGE fdb append 02:02:00:00:00:17 dev vx10 dst 2001:db8:91::11 self dynamic" - log_test $? 255 "Fdb mac append with nexthop group and dynamic state" + run_cmd "$IP link set dev vx10 up type vxlan ageing 1" + run_cmd "$BRIDGE fdb add 02:02:00:00:00:18 dev vx10 dst 2001:db8:91::11 self dynamic" + fdb_entry_aged 02:02:00:00:00:18 vx10 + log_test $? 0 "Fdb mac without nexthop group aged out" + + run_cmd "$BRIDGE fdb get to 02:02:00:00:00:16 dev vx10 self" + log_test $? 0 "Fdb mac with nexthop group not aged out" run_cmd "$IP -6 ro add 2001:db8:101::1/128 nhid 66" log_test $? 2 "Route add with fdb nexthop" @@ -504,14 +522,18 @@ ipv4_fdb_grp_fcnal() log_test $? 0 "Fdb mac add with nexthop group and static state" run_cmd "$BRIDGE fdb add 02:02:00:00:00:16 dev vx10 nhid 102 self dynamic" - log_test $? 255 "Fdb mac add with nexthop group and dynamic state" + log_test $? 0 "Fdb mac add with nexthop group and dynamic state" + + run_cmd "$BRIDGE fdb add 02:02:00:00:00:17 dev vx10 nhid 102 self dynamic extern_learn" + log_test $? 0 "Fdb mac add with nexthop group and extern_learn" - run_cmd "$BRIDGE fdb add 02:02:00:00:00:17 dev vx10 nhid 102 self" - run_cmd "$BRIDGE fdb replace 02:02:00:00:00:17 dev vx10 dst 10.0.0.3 self dynamic" - log_test $? 255 "Fdb mac replace with nexthop group and dynamic state" + run_cmd "$IP link set dev vx10 up type vxlan ageing 1" + run_cmd "$BRIDGE fdb add 02:02:00:00:00:18 dev vx10 dst 10.0.0.3 self dynamic" + fdb_entry_aged 02:02:00:00:00:18 vx10 + log_test $? 0 "Fdb mac without nexthop group aged out" - run_cmd "$BRIDGE fdb append 02:02:00:00:00:17 dev vx10 dst 10.0.0.3 self dynamic" - log_test $? 255 "Fdb mac append with nexthop group and dynamic state" + run_cmd "$BRIDGE fdb get to 02:02:00:00:00:16 dev vx10 self" + log_test $? 0 "Fdb mac with nexthop group not aged out" run_cmd "$IP ro add 172.16.0.0/22 nhid 16" log_test $? 2 "Route add with fdb nexthop" -- 2.53.0