Netdev List
 help / color / mirror / Atom feed
From: Tim Menninger <tmenninger@everpuredata.com>
To: leon@kernel.org
Cc: jgg@ziepe.ca, bharat@chelsio.com, dsahern@kernel.org,
	idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	shuah@kernel.org, slingappa@everpuredata.com,
	rpatil@everpuredata.com, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Tim Menninger <tmenninger@everpuredata.com>
Subject: [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address
Date: Thu,  3 Dec 2026 23:47:19 +0000	[thread overview]
Message-ID: <20261203234720.2428689-3-tmenninger@everpuredata.com> (raw)
In-Reply-To: <20261203234720.2428689-1-tmenninger@everpuredata.com>

Extend ipv6_mpath_select to check that, for a destination hashed to each
member of a multipath nexthop group, the reported source address belongs
to the device of the selected nexthop. Without "ipv6: Use the selected
nexthop for source address selection", the source address always comes
from the first nexthop's device and the check fails for the other
member.

Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
---
Changes in v2:
- New patch

 tools/testing/selftests/net/fib_nexthops.sh | 35 +++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
index adbec51917eb..cdc8d53d87ac 100755
--- a/tools/testing/selftests/net/fib_nexthops.sh
+++ b/tools/testing/selftests/net/fib_nexthops.sh
@@ -387,6 +387,16 @@ get_route_dev()
 	fi
 }
 
+get_route_prefsrc()
+{
+	local pfx="$1"
+	local out
+
+	if out=$($IP -j route get "$pfx" | jq -re ".[0].prefsrc"); then
+		echo "$out"
+	fi
+}
+
 check_route_dev()
 {
 	local pfx="$1"
@@ -867,6 +877,31 @@ ipv6_mpath_select()
 	done
 	log_test $rc 0 "Use valid neighbor during multipath selection"
 
+	# The source address must belong to the selected nexthop's device,
+	# not the device of the group's first nexthop.
+	local -A srcs
+	srcs=([veth1]=2001:db8:91::1 [veth3]=2001:db8:92::1)
+	rc=0
+	for dev in veth1 veth3; do
+		match=0
+		for h in {1..65535}; do
+			addr=$(printf "2001:db8:101::%x" $h)
+			if [ "$(get_route_dev "$addr")" = "$dev" ]; then
+				match=1
+				break
+			fi
+		done
+		if (( match == 0 )); then
+			echo "SKIP: Did not find a route using device $dev"
+			return $ksft_skip
+		fi
+		if ! check_output "$(get_route_prefsrc "$addr")" "${srcs[$dev]}"; then
+			rc=1
+			break
+		fi
+	done
+	log_test $rc 0 "Source address of selected multipath nexthop"
+
 	run_cmd "$IP neigh add 2001:db8:91::2 dev veth1 nud incomplete"
 	run_cmd "$IP neigh add 2001:db8:92::2 dev veth3 nud incomplete"
 	run_cmd "$IP route get 2001:db8:101::1"
-- 
2.53.0


  parent reply	other threads:[~2026-12-03 23:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 23:47 [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths Tim Menninger
2026-12-03 23:47 ` [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Tim Menninger
2026-12-05  0:37   ` netdev-bot+sashiko
2026-12-03 23:47 ` Tim Menninger [this message]
2026-12-05  0:37   ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address netdev-bot+sashiko
2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger
2026-12-05  0:37   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203234720.2428689-3-tmenninger@everpuredata.com \
    --to=tmenninger@everpuredata.com \
    --cc=bharat@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rpatil@everpuredata.com \
    --cc=shuah@kernel.org \
    --cc=slingappa@everpuredata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox