Thread (6 messages) 6 messages, 3 authors, 15d ago
COLD15d

[PATCH net 2/2] selftests: net: add RPL SRH loop test

From: Mark Amirkan via B4 Relay <devnull+markdamirkan.gmail.com@kernel.org>
Date: 2026-09-11 23:11:25
Also in: b4-sent, linux-kselftest, lkml
Subsystem: kernel selftest framework, networking [general], the rest · Maintainers: Shuah Khan, Shuah Khan, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Mark Amirkan <redacted>

Add two local addresses to a network namespace and exercise RPL route
validation. Verify that adjacent local addresses remain valid, while a
non-local address between them causes the route to be rejected.

Signed-off-by: Mark Amirkan <redacted>
Assisted-by: Symbolic
---
 tools/testing/selftests/net/Makefile        |  1 +
 tools/testing/selftests/net/rpl_srh_loop.sh | 38 +++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 3ee3378f8b26..7fe7e38b9c6c 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -80,6 +80,7 @@ TEST_PROGS := \
 	reuseport_addr_any.sh \
 	route_hint.sh \
 	route_localnet.sh \
+	rpl_srh_loop.sh \
 	rps_default_mask.sh \
 	rtnetlink.py \
 	rtnetlink.sh \
diff --git a/tools/testing/selftests/net/rpl_srh_loop.sh b/tools/testing/selftests/net/rpl_srh_loop.sh
new file mode 100755
index 000000000000..a2e9991d789d
--- /dev/null
+++ b/tools/testing/selftests/net/rpl_srh_loop.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source lib.sh
+
+cleanup()
+{
+	cleanup_ns "$NS"
+}
+
+trap cleanup EXIT
+
+require_command ip
+setup_ns NS || exit $?
+
+ip -n "$NS" -6 address add 2001:db8:1::1/128 dev lo nodad
+ip -n "$NS" -6 address add 2001:db8:3::1/128 dev lo nodad
+
+if ! ip -n "$NS" -6 route add 2001:db8:10::/64 \
+	encap rpl segs 2001:db8:4::1 dev lo 2>/dev/null; then
+	echo "SKIP: RPL lightweight tunnel support not available"
+	exit $ksft_skip
+fi
+
+RET=0
+ip -n "$NS" -6 route add 2001:db8:11::/64 \
+	encap rpl segs 2001:db8:1::1,2001:db8:3::1 dev lo
+check_err $? "Adjacent local addresses were rejected"
+log_test "RPL accepts adjacent local addresses"
+
+RET=0
+ip -n "$NS" -6 route add 2001:db8:12::/64 \
+	encap rpl segs 2001:db8:1::1,2001:db8:2::1,2001:db8:3::1 dev lo \
+	2>/dev/null
+check_fail $? "Separated local addresses were accepted"
+log_test "RPL rejects separated local addresses"
+
+exit $EXIT_STATUS
-- 
2.43.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help