Skip to contentSkip to conversation

network/stress/multicast/packet-flood: Update to new API

PATCH Superseded Joerg Vehlow 3 participants 9 messages Nov 17, 2020 – Nov 19, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 network/stress/multicast/packet-flood: Update to new API

From: Joerg Vehlow <[email protected]>

---
 runtest/net_stress.multicast                  |   4 +
 .../multicast/packet-flood/mcast-pktfld01.sh  |  43 ++++
 .../multicast/packet-flood/mcast-pktfld02.sh  |  60 +++++
 .../multicast/packet-flood/mcast4-pktfld01    | 207 ----------------
 .../multicast/packet-flood/mcast4-pktfld02    | 225 ------------------
 .../multicast/packet-flood/mcast6-pktfld01    | 203 ----------------
 .../multicast/packet-flood/mcast6-pktfld02    | 220 -----------------
 7 files changed, 107 insertions(+), 855 deletions(-)
 create mode 100755 testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh
 create mode 100755 testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh
 delete mode 100644 testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
 delete mode 100644 testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
 delete mode 100644 testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
 delete mode 100644 testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
runtest/net_stress.multicast +4 -0
index 463fe17ab..fff5133f6 100644
@@ -6,8 +6,12 @@ mcast4-group-single-socket mcast-group-single-socket
 mcast4-group-multiple-socket mcast-group-multiple-socket
 mcast4-group-same-group mcast-group-same-group
 mcast4-group-source-filter mcast-group-source-filter
+mcast4-pktfld01 mcast-pktfld01.sh
+mcast4-pktfld02 mcast-pktfld02.sh
 
 mcast6-group-single-socket mcast-group-single-socket -6
 mcast6-group-multiple-socket mcast-group-multiple-socket -6
 mcast6-group-same-group mcast-group-same-group -6
 mcast6-group-source-filter mcast-group-source-filter -6
+mcast6-pktfld01 mcast-pktfld01.sh -6
+mcast6-pktfld02 mcast-pktfld02.sh -6
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +43 -0

43 lines not on this page · raw message

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +60 -0

60 lines not on this page · raw message

testcases/network/stress/multicast/packet-flood/mcast4-pktfld01 deleted +0 -207

207 lines not on this page · raw message

testcases/network/stress/multicast/packet-flood/mcast4-pktfld02 deleted +0 -225

225 lines not on this page · raw message

testcases/network/stress/multicast/packet-flood/mcast6-pktfld01 deleted +0 -203

203 lines not on this page · raw message

testcases/network/stress/multicast/packet-flood/mcast6-pktfld02 deleted +0 -220

220 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 2/3 network/stress/multicast/query-flood: Convert to new API

From: Joerg Vehlow <[email protected]>

---
 runtest/net_stress.multicast                  |  12 +
 .../multicast/query-flood/mcast-queryfld01.sh |  34 +++
 .../multicast/query-flood/mcast-queryfld02.sh |  35 +++
 .../multicast/query-flood/mcast-queryfld03.sh |  43 ++++
 .../multicast/query-flood/mcast-queryfld04.sh |  35 +++
 .../multicast/query-flood/mcast-queryfld05.sh |  54 +++++
 .../multicast/query-flood/mcast-queryfld06.sh |  63 +++++
 .../multicast/query-flood/mcast4-queryfld01   | 199 ----------------
 .../multicast/query-flood/mcast4-queryfld02   | 202 ----------------
 .../multicast/query-flood/mcast4-queryfld03   | 208 -----------------
 .../multicast/query-flood/mcast4-queryfld04   | 202 ----------------
 .../multicast/query-flood/mcast4-queryfld05   | 213 -----------------
 .../multicast/query-flood/mcast4-queryfld06   | 219 ------------------
 .../multicast/query-flood/mcast6-queryfld01   | 197 ----------------
 .../multicast/query-flood/mcast6-queryfld02   | 199 ----------------
 .../multicast/query-flood/mcast6-queryfld03   | 205 ----------------
 .../multicast/query-flood/mcast6-queryfld04   | 199 ----------------
 .../multicast/query-flood/mcast6-queryfld05   | 209 -----------------
 .../multicast/query-flood/mcast6-queryfld06   | 213 -----------------
 19 files changed, 276 insertions(+), 2465 deletions(-)
 create mode 100755 testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
 create mode 100644 testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
 create mode 100644 testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh
 create mode 100644 testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh
 create mode 100644 testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh
 create mode 100644 testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld01
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld02
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld03
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld04
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld05
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast4-queryfld06
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld01
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld02
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld03
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld04
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld05
 delete mode 100644 testcases/network/stress/multicast/query-flood/mcast6-queryfld06
runtest/net_stress.multicast +12 -0
index fff5133f6..0d61db289 100644
@@ -8,6 +8,12 @@ mcast4-group-same-group mcast-group-same-group
 mcast4-group-source-filter mcast-group-source-filter
 mcast4-pktfld01 mcast-pktfld01.sh
 mcast4-pktfld02 mcast-pktfld02.sh
+mcast4-queryfld01 mcast-queryfld01.sh
+mcast4-queryfld02 mcast-queryfld02.sh
+mcast4-queryfld03 mcast-queryfld03.sh
+mcast4-queryfld04 mcast-queryfld04.sh
+mcast4-queryfld05 mcast-queryfld05.sh
+mcast4-queryfld06 mcast-queryfld06.sh
 
 mcast6-group-single-socket mcast-group-single-socket -6
 mcast6-group-multiple-socket mcast-group-multiple-socket -6
@@ -15,3 +21,9 @@ mcast6-group-same-group mcast-group-same-group -6
 mcast6-group-source-filter mcast-group-source-filter -6
 mcast6-pktfld01 mcast-pktfld01.sh -6
 mcast6-pktfld02 mcast-pktfld02.sh -6
+mcast6-queryfld01 mcast-queryfld01.sh -6
+mcast6-queryfld02 mcast-queryfld02.sh -6
+mcast6-queryfld03 mcast-queryfld03.sh -6
+mcast6-queryfld04 mcast-queryfld04.sh -6
+mcast6-queryfld05 mcast-queryfld05.sh -6
+mcast6-queryfld06 mcast-queryfld06.sh -6
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +34 -0
new file mode 100755
index 000000000..c569548c9
@@ -0,0 +1,34 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2006 International Business Machines  Corp.
+# Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Author: Mitsuru Chinen <[email protected]>
+#
+# Verify that the kernel is not crashed when joining a multicast group
+# on a single socket, then receiving a large number of General Queries
+
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	local mcast_addr_prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && mcast_addr_prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $mcast_addr_prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	# Send General Query from the remote host
+	local params=""
+	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
+	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
+}
+
+tst_run
testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh new file +35 -0
new file mode 100644
index 000000000..0b6a2aa5a
@@ -0,0 +1,35 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2006 International Business Machines  Corp.
+# Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Author: Mitsuru Chinen <[email protected]>
+#
+# Verify that the kernel is not crashed when joining a multicast group
+# on a single socket, then receiving a large number of Multicast Address
+# Specific Query
+
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	local mcast_addr_prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && mcast_addr_prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $mcast_addr_prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	# Send IGMP Multicast Address Specific Query from the remote host
+	local params="-m $MCAST_IPV4_ADDR"
+	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR"
+	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
+}
+
+tst_run
testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh new file +43 -0

43 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh new file +35 -0
new file mode 100644
index 000000000..367b05e28
@@ -0,0 +1,35 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2006 International Business Machines  Corp.
+# Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Author: Mitsuru Chinen <[email protected]>
+#
+# Verify that the kernel is not crashed when joining multiple multicast
+# groups on separate socket, then receiving a large number of General Queries
+
+
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	local mcast_addr_prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && mcast_addr_prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $mcast_addr_prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	# Send General Queries from the remote host
+	local params=""
+	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
+	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
+}
+
+tst_run
testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh new file +54 -0

54 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh new file +63 -0

63 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld01 deleted +0 -199

199 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld02 deleted +0 -202

202 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld03 deleted +0 -208

208 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld04 deleted +0 -202

202 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld05 deleted +0 -213

213 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast4-queryfld06 deleted +0 -219

219 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld01 deleted +0 -197

197 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld02 deleted +0 -199

199 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld03 deleted +0 -205

205 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld04 deleted +0 -199

199 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld05 deleted +0 -209

209 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast6-queryfld06 deleted +0 -213

213 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/3 network/stress/multicast/query-flood: Convert to new API

Hi Joerg,

Thanks for v2!

Main info are reported by Alexey, few more notes below.

...

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 8

Quoted 2 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +2 -0
+# Verify that the kernel is not crashed when joining a multicast group
+# on a single socket, then receiving a large number of General Queries

nit: some sort of the description could be in
tst_test TINFO message in do_setup() / do_test()

...

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 21

Quoted 12 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +12 -0
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	local mcast_addr_prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && mcast_addr_prefix="$MCAST_IPV6_ADDR_PREFIX"

nit: maybe just $prefix is enough.

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 24

Quoted 3 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +3 -0
+
+	# Run a multicast join tool
+	local tmpfile=$$

Please, when you need temporary files, use
TST_NEEDS_TMPDIR=1

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 29

Quoted 5 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +5 -0
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $mcast_addr_prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	# Send General Query from the remote host
+	local params=""

nit: no need to add =""

...

Kind regards,
Petr

#3 lore raw

PATCH v2 2/3 network/stress/multicast/query-flood: Convert to new API

Hi Petr,

Quoted 4 lines

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 8

Quoted 2 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +2 -0
+# Verify that the kernel is not crashed when joining a multicast group
+# on a single socket, then receiving a large number of General Queries

nit: some sort of the description could be in
tst_test TINFO message in do_setup() / do_test()

I removed this, because I though it was useless, but will add it back in.

Quoted 5 lines
Quoted 5 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +5 -0
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
Quoted 8 lines

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 21

Quoted 7 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +7 -0
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	local mcast_addr_prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && mcast_addr_prefix="$MCAST_IPV6_ADDR_PREFIX"

nit: maybe just $prefix is enough.

ACK

Quoted 5 lines

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 24

Quoted 3 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +3 -0
+
+	# Run a multicast join tool
+	local tmpfile=$$

Please, when you need temporary files, use
TST_NEEDS_TMPDIR=1

That's actually set in mcast-lib.sh, but duplication makes sense here I guess.

Quoted 6 lines

testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh line 29

Quoted 5 lines
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh new file +5 -0
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $mcast_addr_prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	# Send General Query from the remote host
+	local params=""

nit: no need to add =""

ACK

J?rg

#4 lore raw

PATCH v2 3/3 network/stress/route-change: Convert to new API

In reply to Joerg Vehlow

From: Joerg Vehlow <[email protected]>

---
 runtest/net_stress.route                      |   2 +
 .../network/stress/route/route-redirect.sh    |  63 ++++++
 .../network/stress/route/route4-redirect      | 212 ------------------
 .../network/stress/route/route6-redirect      | 207 -----------------
 4 files changed, 65 insertions(+), 419 deletions(-)
 create mode 100644 testcases/network/stress/route/route-redirect.sh
 delete mode 100644 testcases/network/stress/route/route4-redirect
 delete mode 100644 testcases/network/stress/route/route6-redirect
runtest/net_stress.route +2 -0
index b60e55bd6..5590ef023 100644
@@ -5,6 +5,7 @@ route4-change-if route-change-if.sh
 route4-change-netlink-dst route-change-netlink-dst.sh
 route4-change-netlink-gw route-change-netlink-gw.sh
 route4-change-netlink-if route-change-netlink-if.sh
+route4-redirect route-redirect.sh
 
 route6-change-dst route-change-dst.sh -6
 route6-change-gw route-change-gw.sh -6
@@ -12,3 +13,4 @@ route6-change-if route-change-if.sh -6
 route6-change-netlink-dst route-change-netlink-dst.sh -6
 route6-change-netlink-gw route-change-netlink-gw.sh -6
 route6-change-netlink-if route-change-netlink-if.sh -6
+route6-redirect route-redirect.sh -6
testcases/network/stress/route/route-redirect.sh new file +63 -0

63 lines not on this page · raw message

testcases/network/stress/route/route4-redirect deleted +0 -212

212 lines not on this page · raw message

testcases/network/stress/route/route6-redirect deleted +0 -207

207 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 1/3 network/stress/multicast/packet-flood: Update to new API

In reply to Joerg Vehlow
Quoted 4 lines · Joerg Vehlow

From: Joerg Vehlow <[email protected]>

---

...

Quoted 19 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +16 -0
@@ -0,0 +1,43 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2006 International Business Machines  Corp.
+# Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Author: Mitsuru Chinen <[email protected]>
+#
+# Verify that the kernel is not crashed when joining a multicast group with
+# a single socket, then receiving a large number of UDP packets at the socket
+
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+	MCAST_LCMD=ns-mcast_receiver

testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh line 26

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +10 -0
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()
+{
+	local mcast_addr="$MCAST_IPV4_ADDR"
+	[ "$TST_IPV6" ] && mcast_addr="$MCAST_IPV6_ADDR"
+
+	# Find the available consecutive ports
+	local mcast_port=$(find_portbundle udp 1025 1)

Hi Joerg,

The following command should support both udp/udp6:

local mcast_port=$(tst_get_unused_port ipv${TST_IPVER} dgram)

testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh line 35

Quoted 9 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +9 -0
+	if [ $? -ne 0 ]; then
+		tst_brk TBROK "No free udp port available."
+	fi
+
+	# Run a receiver
+	ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $mcast_addr -p $mcast_port -b
+	if [ $? -ne 0 ]; then
+		tst_brk TBROK "Failed to start multicast receiver"
+	fi

This check can be replaced with

ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $mcast_addr -p $mcast_port -b

testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh line 39

Quoted 4 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +4 -0
+
+	# Run a sender
+	tst_rhost_run -s -c "ns-udpsender -D $mcast_addr -f $TST_IPVER -p $mcast_port -s 32767 -m -I $(tst_iface rhost) -t $NS_DURATION"
+

What if we swap sender and receiver, i.e.

local ns_opts="-f $TST_IPVER -p $mcast_port"

tst_rhost_run -s -c "ns-mcast_receiver $ns_opts -I $(tst_iface rhost) -m $mcast_addr -b" EXPECT_PASS ns-udpsender -D $mcast_addr $ns_opts -s 32767 -m -I $(tst_iface) -t $NS_DURATION

By default, ltp is using network namespace, so it's probably better to run the background service there.

testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh line 40

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +1 -0
+	tst_res TPASS "Test finished successfully."

No need for it if using EXPECT_PASS as above.

Quoted 30 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh new file +3 -0
+}
+
+tst_run
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +21 -0
new file mode 100755
index 000000000..4ffde186b
@@ -0,0 +1,60 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2006 International Business Machines  Corp.
+# Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Author: Mitsuru Chinen <[email protected]>
+#
+# Verify that the kernel is not crashed when joining multiple multicast
+# groups on separate sockets, then receiving a large number of UDP
+# packets at each socket
+
+TST_NEEDS_ROOT=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+	MCAST_LCMD=ns-mcast_receiver
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 31

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+{
+	local mcast_port_range=$(find_portbundle udp 1025 $MCASTNUM_NORMAL)
+	if [ $? -ne 0 ]; then
+		tst_brk TBROK "Failed to find enough consecutive free udp ports."
+	fi
+	local mcast_port_top=$(echo $mcast_port_range | cut -f 1 -d '-')
+
+	local mcastnum=0
+	while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
+		local mcast_port=$((mcast_port_top + mcastnum))
                                       ^

I guess it's fine to use $(tst_get_unused_port ipv${TST_IPVER} dgram) here, and removing getting the port range.

Quoted 11 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +11 -0
+
+		# Define the multicast address
+		if [ "$TST_IPV6" ]; then
+    		local mcastnum_hex=$(printf "%x" $mcastnum)
+    		local mcast_addr=${MCAST_IPV6_ADDR_PREFIX}:${mcastnum_hex}
+		else
+			local x=$((mcastnum / 254))
+			local y=$((mcastnum % 254 + 1))
+			local mcast_addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
+		fi
+

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 52

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+		# Run a receiver
+		ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $mcast_addr -p $mcast_port -b
+		if [ $? -ne 0 ]; then
+			tst_brk TBROK "Failed to start multicast receiver"
+		fi
+
+		# Run a sender
+		tst_rhost_run -s -c "ns-udpsender -D $mcast_addr -f $TST_IPVER -p $mcast_port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
+
+		: $((mcastnum += 1))

The same, better swap sender/receiver.

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 55

Quoted 3 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +3 -0
+	done
+
+	sleep $NS_DURATION

It would be nice to have a small loop instead of a single 'sleep' and periodically check that the background senders are really running...

Quoted 5 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +5 -0
+
+	tst_res TPASS "Test finished successfully."
+}
+
+tst_run
#6 lore raw

PATCH v2 1/3 network/stress/multicast/packet-flood: Update to new API

Hi Alexey,

Quoted 3 lines

The following command should support both udp/udp6:

local mcast_port=$(tst_get_unused_port ipv${TST_IPVER} dgram)

Actually find_portbundle doesn't distinguish between ipv6 and ipv4 when looking for a window of free ports, so it works for both variants. The only thing that can happen, is that it finds no free ports at all, even if there are some free ports, but that is probably highly unlikely. Still I would say: Let's get rid of this function and remove usage as we
go: I will change it anyway, because I don't like this.

Quoted 3 lines

This check can be replaced with

ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $mcast_addr -p $mcast_port -b

ACK

Quoted 9 lines

What if we swap sender and receiver, i.e.

local ns_opts="-f $TST_IPVER -p $mcast_port"

tst_rhost_run -s -c "ns-mcast_receiver $ns_opts -I $(tst_iface rhost) -m $mcast_addr -b" EXPECT_PASS ns-udpsender -D $mcast_addr $ns_opts -s 32767 -m -I $(tst_iface) -t $NS_DURATION

By default, ltp is using network namespace, so it's probably better to run the background service there.

I think the "thing-under-test" here is the receiver, not the sender. I don't see any benefit swapping this, it will only move the test to the wrong machine, if network namespaces are not in us

Quoted 7 lines

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 55

Quoted 4 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +3 -0
+	done
+
+	sleep $NS_DURATION

It would be nice to have a small loop instead of a single 'sleep' and periodically check that the background senders are really running...

I also don't normally like sleeps, but? actually the way the test is implemented at the moment it would make little sense to add all the complexity required, to collect pids, to check the senders and implement a timeout Right after the last ns-udpsender is started, that runs for NS_DURATION, the sleep is executed for NS_DURATION. Even if the sleep exits before ns-udpsender, it doesn't matter, because it is just a bit earlier and the test time is actually variable. I wouldn't change this to be more complex, although I would design it differently, if I would implement the this as a new test.
An alternative would be to not background the last ns-udpsender execution, but that could be a bit obscure

J?rg

#7 lore raw

PATCH v2 1/3 network/stress/multicast/packet-flood: Update to new API

Quoted 3 lines · Joerg Vehlow

Hi Alexey,

Quoted 2 lines

The following command should support both udp/udp6:

Hi Joerg,

Quoted 3 lines
Quoted 1 line

local mcast_port=$(tst_get_unused_port ipv${TST_IPVER} dgram)

Actually find_portbundle doesn't distinguish between ipv6 and ipv4 when looking for a window of free ports, so it works for both variants. The

I see, find_portbundle is just a wrapper for netstat and it's not setting any address family, so netstat list all.

Quoted 12 lines

only thing that can happen, is that it finds no free ports at all, even if there are some free ports, but that is probably highly unlikely. Still I would say: Let's get rid of this function and remove usage as we
go: I will change it anyway, because I don't like this.

Quoted 3 lines

This check can be replaced with

ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $mcast_addr -p $mcast_port -b

ACK

Quoted 4 lines

What if we swap sender and receiver, i.e.

local ns_opts="-f $TST_IPVER -p $mcast_port"

Quoted 9 lines
Quoted 5 lines

tst_rhost_run -s -c "ns-mcast_receiver $ns_opts -I $(tst_iface rhost) -m $mcast_addr -b" EXPECT_PASS ns-udpsender -D $mcast_addr $ns_opts -s 32767 -m -I $(tst_iface) -t $NS_DURATION

By default, ltp is using network namespace, so it's probably better to run the background service there.

I think the "thing-under-test" here is the receiver, not the sender. I don't see any benefit swapping this, it will only move the test to the wrong machine, if network namespaces are not in us

Quoted 1 line

Both machines are under test.

Quoted 6 lines
Quoted 6 lines

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 55

Quoted 3 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +3 -0
+	done
+
+	sleep $NS_DURATION

It would be nice to have a small loop instead of a single 'sleep' and periodically check that the background senders are really running...

Quoted 11 lines

I also don't normally like sleeps, but? actually the way the test is implemented at the moment it would make little sense to add all the complexity required, to collect pids, to check the senders and implement a timeout Right after the last ns-udpsender is started, that runs for NS_DURATION, the sleep is executed for NS_DURATION. Even if the sleep exits before ns-udpsender, it doesn't matter, because it is just a bit earlier and the test time is actually variable. I wouldn't change this to be more complex, although I would design it differently, if I would implement the this as a new test.
An alternative would be to not background the last ns-udpsender execution, but that could be a bit obscure

OK

#8 lore raw

PATCH v2 1/3 network/stress/multicast/packet-flood: Update to new API

Hi,

Quoted 2 lines

I see, find_portbundle is just a wrapper for netstat and it's not setting any address family, so netstat list all.

That's what I was talking about. It lists all used ports and selects only ports, that are free on ipv4 and ipv6. For that reason it was "good enough". But I already changed it for the next version of the patch.

Quoted 5 lines
Quoted 5 lines

I think the "thing-under-test" here is the receiver, not the sender. I don't see any benefit swapping this, it will only move the test to the wrong machine, if network namespaces are not in us

Both machines are under test.

According to the test description, the test is about testing, if the kernel crashes, if a huge number of udp packets is RECEIVED. To me this sounds like the receiver should be under test and the sender is just some dummy. Of course both is tested here if it runs on the same system with namespaces. What I still don't see is the benefit of changing sender and receiver.

J?rg