Thread (36 messages) 36 messages, 5 authors, 2025-06-12
STALE411d
Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH net-next 13/14] selftests: forwarding: adf_mcd_start(): Allow configuring custom interfaces

From: Petr Machata <petrm@nvidia.com>
Date: 2025-06-09 20:52:48
Also in: linux-kselftest
Subsystem: kernel selftest framework, networking [general], networking [ipv4/ipv6], the rest · Maintainers: Shuah Khan, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

Tests may wish to add other interfaces to listen on. Notably locally
generated traffic uses dummy interfaces. The multicast daemon needs to know
about these so that it allows forming rules that involve these interfaces,
and so that net.ipv4.conf.X.mc_forwarding is set for the interfaces.

To that end, allow passing in a list of interfaces to configure in addition
to all the physical ones.

Signed-off-by: Petr Machata <petrm@nvidia.com>
---

Notes:
CC: Shuah Khan <shuah@kernel.org>
CC: linux-kselftest@vger.kernel.org

 tools/testing/selftests/net/forwarding/lib.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 88e63562f5c5..5f144d75167a 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1760,6 +1760,8 @@ mc_send()
 
 adf_mcd_start()
 {
+	local ifs=("$@")
+	local if
 	local i
 
 	check_command $MCD || return 1
@@ -1775,6 +1777,16 @@ adf_mcd_start()
 			$smcroutedir/$table_name.conf
 	done
 
+	for if in ${ifs[@]}; do
+		if ! ip_link_has_flag "$if" MULTICAST; then
+			ip link set dev "$if" multicast on
+			defer ip link set dev "$if" multicast off
+		fi
+
+		echo "phyint $if enable" >> \
+			$smcroutedir/$table_name.conf
+	done
+
 	$MCD -N -I $table_name -f $smcroutedir/$table_name.conf \
 		-P $smcroutedir/$table_name.pid
 	busywait "$BUSYWAIT_TIMEOUT" test -e $smcroutedir/$table_name.pid
-- 
2.49.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