Skip to content

Commit

Permalink
network/stress/multicast/query-flood: Convert to new API
Browse files Browse the repository at this point in the history
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
[ pvorel: Remove sleep $NS_DURATION, style cleanup ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
MofX authored and pevik committed Jan 21, 2021
1 parent 6d6b9d9 commit ef227ac
Show file tree
Hide file tree
Showing 19 changed files with 292 additions and 2,465 deletions.
12 changes: 12 additions & 0 deletions runtest/net_stress.multicast
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ mcast4-group-same-group mcast-group-same-group.sh
mcast4-group-source-filter mcast-group-source-filter.sh
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.sh -6
mcast6-group-multiple-socket mcast-group-multiple-socket.sh -6
mcast6-group-same-group mcast-group-same-group.sh -6
mcast6-group-source-filter mcast-group-source-filter.sh -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
37 changes: 37 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
Original file line number Diff line number Diff line change
@@ -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 <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# 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 "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
38 changes: 38 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
Original file line number Diff line number Diff line change
@@ -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 <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# 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 "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
46 changes: 46 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2006 International Business Machines Corp.
# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# Verify that the kernel is not crashed when joining a multicast group
# on a single socket, then receiving a large number of Multicast Address
# and Source Specific Queries

TST_NEEDS_ROOT=1
TST_NEEDS_TMPDIR=1
. mcast-lib.sh

SRC_ADDR_IPV4="10.10.10.1"
SRC_ADDR_IPV6="fec0:100:100:100::1"
FILTER_MODE="include"

do_setup()
{
mcast_setup $MCASTNUM_NORMAL
}

do_test()
{
tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"

local prefix="$MCAST_IPV4_ADDR_PREFIX"
local src_addr="$SRC_ADDR_IPV4"
if [ "$TST_IPV6" ]; then
prefix="$MCAST_IPV6_ADDR_PREFIX"
src_addr="$SRC_ADDR_IPV6"
fi

# Run a multicast join tool
local tmpfile=$$
EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
tst_res TINFO "joined $(grep groups $tmpfile)"

# Send Multicast Address and Source Specific Queries from the remote host
local params="-m $MCAST_IPV4_ADDR -s $src_addr"
[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR -a $src_addr"
EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
}

tst_run
37 changes: 37 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh
Original file line number Diff line number Diff line change
@@ -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 <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# 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 "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
57 changes: 57 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2006 International Business Machines Corp.
# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# Verify that the kernel is not crashed when joining multiple
# multicast groups on separate sockets, then receiving a large number of
# Multicast Address Specific Queries

TST_NEEDS_ROOT=1
TST_NEEDS_TMPDIR=1
. mcast-lib.sh

do_setup()
{
mcast_setup $MCASTNUM_NORMAL
}

do_test()
{
tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address Specific 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 IGMP Multicast Address Specific Query from the remote host
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 params="-m $addr"
[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $addr"
tst_rhost_run -c "$MCAST_RCMD -t $NS_DURATION -r 0 -b $params"

n=$((n+1))
done

sleep $NS_DURATION

tst_res TPASS "test finished successfully"
}

tst_run
65 changes: 65 additions & 0 deletions testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2006 International Business Machines Corp.
# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
#
# Verify that the kernel is not crashed when joining multiple
# multicast groups on separate sockets, then receiving a large number of
# Multicast Address and Source Specific Queries

TST_NEEDS_ROOT=1
TST_NEEDS_TMPDIR=1
. mcast-lib.sh

SRC_ADDR_IPV4=10.10.10.1
SRC_ADDR_IPV6=fec0:100:100:100::1
FILTER_MODE="include"

do_setup()
{
mcast_setup $MCASTNUM_NORMAL
}

do_test()
{
tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"

local prefix="$MCAST_IPV4_ADDR_PREFIX"
local src_addr="$SRC_ADDR_IPV4"
if [ "$TST_IPV6" ]; then
prefix="$MCAST_IPV6_ADDR_PREFIX"
src_addr="$SRC_ADDR_IPV6"
fi

# Run a multicast join tool
local tmpfile=$$
EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
tst_res TINFO "joined $(grep groups $tmpfile)"

# Send Multicast Address Specific Queries from the remote host
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 params="-m $addr -s $src_addr"
[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $addr -a $src_addr"
tst_rhost_run -c "$MCAST_RCMD -t $NS_DURATION -r 0 -b $params"

n=$((n+1))
done

sleep $NS_DURATION

tst_res TPASS "test finished successfully"
}

tst_run

0 comments on commit ef227ac

Please sign in to comment.