Skip to contentSkip to conversation

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

PATCH New Joerg Vehlow 2 participants 9 messages Nov 25, 2020 – Jan 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 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  |  40 ++++
 .../multicast/packet-flood/mcast-pktfld02.sh  |  55 +++++
 .../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, 99 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 +40 -0
new file mode 100755
index 000000000..648957161
@@ -0,0 +1,40 @@
+#!/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
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining an IPv${TST_IPVER} multicast group with a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION seconds"
+
+	local addr="$MCAST_IPV4_ADDR"
+	[ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR"
+
+	# Find the available consecutive ports
+	local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
+	[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."
+
+	# Run a receiver
+	ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
+
+	# Run a sender
+	tst_rhost_run -s -c "ns-udpsender -D $addr -f $TST_IPVER -p $port -s 32767 -m -I $(tst_iface rhost) -t $NS_DURATION"
+
+	tst_res TPASS "Test finished successfully."
+}
+
+tst_run
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +55 -0

55 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 v3 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 |  37 +++
 .../multicast/query-flood/mcast-queryfld02.sh |  38 +++
 .../multicast/query-flood/mcast-queryfld03.sh |  46 ++++
 .../multicast/query-flood/mcast-queryfld04.sh |  38 +++
 .../multicast/query-flood/mcast-queryfld05.sh |  57 +++++
 .../multicast/query-flood/mcast-queryfld06.sh |  65 ++++++
 .../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, 293 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 +37 -0
new file mode 100755
index 000000000..e54499864
@@ -0,0 +1,37 @@
+#!/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
+TST_NEEDS_TMPDIR=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of General Queries in $NS_DURATION seconds"
+
+	local prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $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 +38 -0
new file mode 100644
index 000000000..f1f2d062c
@@ -0,0 +1,38 @@
+#!/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
+TST_NEEDS_TMPDIR=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION seconds"
+
+	local prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $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 +46 -0

46 lines not on this page · raw message

testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh new file +38 -0
new file mode 100644
index 000000000..ede04980a
@@ -0,0 +1,38 @@
+#!/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
+TST_NEEDS_TMPDIR=1
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate socket, then receiving a large number of General Queries in $NS_DURATION seconds"
+
+	local prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $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 +57 -0

57 lines not on this page · raw message

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

65 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 v3 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    |  64 ++++++
 .../network/stress/route/route4-redirect      | 212 ------------------
 .../network/stress/route/route6-redirect      | 207 -----------------
 4 files changed, 66 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 +64 -0

64 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
#3 lore raw

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

Hi Joerg,

Quoted 1 line

+++ b/testcases/network/stress/route/route-redirect.sh

...

testcases/network/stress/route/route-redirect.sh line 45

Quoted 4 lines
testcases/network/stress/route/route-redirect.sh new file +4 -0
+do_cleanup()
+{
+	# Kill the redirector utility
+	tst_rhost_run -c "killall -SIGHUP ns-icmp_redirector"

FYI: route_cleanup is required (from route-lib.sh) otherwise next test in the runtest file (route6-change-dst) is broken:
route-change-dst 1 TFAIL: ping6 -c1 -I fd00:1:1:1::2 fd00:23:1::1 >/dev/null failed unexpectedly

But anyway, I've fixed everything and tested:
https://github.com/pevik/ltp/commits/joerg/multicast.v3.fixes

It might be merged before the release, or immediately after the release.

Kind regards,
Petr

#4 lore raw

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

In reply to Joerg Vehlow

Hi Joerg,

Minor comments, please update them if v4 needed.
Otherwise it can be fixed during merge.
Thanks for your work.

Kind regards,
Petr

Quoted 8 lines

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +6 -0
@@ -0,0 +1,55 @@
+#!/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]>
+#

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

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+# 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 $n_NORMAL

This should be (error during global replace):

mcast_setup $MCASTNUM_NORMAL

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

Quoted 7 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+	MCAST_LCMD=ns-mcast_receiver
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"

I'd prefer these drop boilerplate "Verify that the kernel is not crashed when"
+ the same in the description at the top of the file.

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

Quoted 7 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+
+	local n=0
+	while [ $n -lt $MCASTNUM_NORMAL ]; do
+		# Define the multicast address
+		if [ "$TST_IPV6" ]; then
+    		local n_hex=$(printf "%x" $n)
+    		local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}

nit: wrong indent

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

Quoted 8 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +8 -0
+		else
+			local x=$((n / 254))
+			local y=$((n % 254 + 1))
+			local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
+		fi
+
+		local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
+		[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."

nit: no dot please.

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

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +1 -0
+		tst_res TINFO Port: $port

This should be quoted.

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

Quoted 8 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +8 -0
+
+		# Run a receiver
+		ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
+	
+		# Run a sender
+		tst_rhost_run -s -c "ns-udpsender -D $addr -f $TST_IPVER -p $port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
+
+		: $((n += 1))

sure this works, but I'd prefer:
n=$((n += 1))

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

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +1 -0
+	done

The rest LGTM.

#5 lore raw

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

Hi Petr,

Quoted 6 lines · Petr Vorel

Hi Joerg,

Minor comments, please update them if v4 needed.
Otherwise it can be fixed during merge.
Thanks for your work.

I don't think I'll submit a v4, if you want to fix this during merge, it is ok to me.

Quoted 27 lines

Kind regards,
Petr

Quoted 8 lines

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +6 -0
@@ -0,0 +1,55 @@
+#!/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]>
+#

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

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+# 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 $n_NORMAL

This should be (error during global replace):

Quoted 1 line

mcast_setup $MCASTNUM_NORMAL

Yes sorry...

Quoted 10 lines

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

Quoted 8 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+	MCAST_LCMD=ns-mcast_receiver
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"

I'd prefer these drop boilerplate "Verify that the kernel is not crashed when"
+ the same in the description at the top of the file.

Do you want this completely removed? I added this, because you asked me to in v2?

Quoted 9 lines

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

Quoted 8 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+
+	local n=0
+	while [ $n -lt $MCASTNUM_NORMAL ]; do
+		# Define the multicast address
+		if [ "$TST_IPV6" ]; then
+    		local n_hex=$(printf "%x" $n)
+    		local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}

nit: wrong indent

Strange ;)

Quoted 11 lines

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

Quoted 9 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +8 -0
+		else
+			local x=$((n / 254))
+			local y=$((n % 254 + 1))
+			local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
+		fi
+
+		local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
+		[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."

nit: no dot please.

Quoted 2 lines

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

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +1 -0
+		tst_res TINFO Port: $port

This should be quoted.

Could also be removed. I guess this was for testing...

Quoted 11 lines

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

Quoted 9 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +8 -0
+
+		# Run a receiver
+		ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
+	
+		# Run a sender
+		tst_rhost_run -s -c "ns-udpsender -D $addr -f $TST_IPVER -p $port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
+
+		: $((n += 1))

sure this works, but I'd prefer:
n=$((n += 1))

I don't care

Quoted 2 lines

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

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +1 -0
+	done

The rest LGTM.

Thanks
J?rg

#6 lore raw

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

Hi Joerg,

Quoted 5 lines
Quoted 3 lines

Minor comments, please update them if v4 needed.
Otherwise it can be fixed during merge.
Thanks for your work.

I don't think I'll submit a v4, if you want to fix this during merge, it is ok to me.

Don't worry with v4, I'll fix all these tiny style issues.

I'll also implement restoring sysctl value in route-redirect.sh.

Quoted 26 lines
Quoted 25 lines

Kind regards,
Petr

Quoted 8 lines

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +6 -0
@@ -0,0 +1,55 @@
+#!/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]>
+#

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

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+# 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 $n_NORMAL

This should be (error during global replace):

Quoted 2 lines
Quoted 1 line

mcast_setup $MCASTNUM_NORMAL

Yes sorry...

np

Quoted 11 lines
Quoted 9 lines

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

Quoted 7 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+	MCAST_LCMD=ns-mcast_receiver
+	MCAST_RCMD=ns-udpsender
+}
+
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"

I'd prefer these drop boilerplate "Verify that the kernel is not crashed when"
+ the same in the description at the top of the file.

Do you want this completely removed? I added this, because you asked me to in v2?

I added into my version:

	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"

i.e. remove boilerplate "Verify that the kernel is not crashed when".

Quoted 9 lines
Quoted 8 lines

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

Quoted 7 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +7 -0
+
+	local n=0
+	while [ $n -lt $MCASTNUM_NORMAL ]; do
+		# Define the multicast address
+		if [ "$TST_IPV6" ]; then
+    		local n_hex=$(printf "%x" $n)
+    		local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}

nit: wrong indent

Strange ;)

It easily happens when you modify existing test (I had the same in my last patchset). Anyway, no problem.

Quoted 10 lines
Quoted 9 lines

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

Quoted 8 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +8 -0
+		else
+			local x=$((n / 254))
+			local y=$((n % 254 + 1))
+			local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
+		fi
+
+		local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
+		[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."

nit: no dot please.

Quoted 3 lines
Quoted 2 lines

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

Quoted 1 line
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +1 -0
+		tst_res TINFO Port: $port

This should be quoted.

Could also be removed. I guess this was for testing...

+1

Kind regards,
Petr

#7 lore raw

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

In reply to Joerg Vehlow

Hi Joerg,

Quoted 5 lines
Quoted 3 lines

Minor comments, please update them if v4 needed.
Otherwise it can be fixed during merge.
Thanks for your work.

I don't think I'll submit a v4, if you want to fix this during merge, it is ok to me.

Merged with 2 fixes (using route_cleanup in route-redirect.sh and typo $n_NORMAL) and few minor style formatting.

Thanks a lot for your work!

Kind regards,
Petr

#8 lore raw

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

In reply to Joerg Vehlow

Hi Joerg,

Quoted 1 line

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh

...

Quoted 20 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +20 -0
+do_test()
+{
+	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
+
+	local n=0
+	while [ $n -lt $MCASTNUM_NORMAL ]; do
+		# Define the multicast address
+		if [ "$TST_IPV6" ]; then
+    		local n_hex=$(printf "%x" $n)
+    		local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}
+		else
+			local x=$((n / 254))
+			local y=$((n % 254 + 1))
+			local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
+		fi
+
+		local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
+		[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."
+		tst_res TINFO Port: $port
+

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

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh new file +10 -0
+		# Run a receiver
+		ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
+	
+		# Run a sender
+		tst_rhost_run -s -c "ns-udpsender -D $addr -f $TST_IPVER -p $port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
+
+		: $((n += 1))
+	done
+
+	sleep $NS_DURATION

FYI: although this is in old tests, IMHO it's useless, thus I'll remove it.

Kind regards,
Petr