xref: /aosp_15_r20/external/ltp/testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2006 International Business Machines  Corp.
4# Copyright (c) 2020 Joerg Vehlow <[email protected]>
5# Author: Mitsuru Chinen <[email protected]>
6#
7# Verify that the kernel is not crashed when joining multiple multicast
8# groups on separate socket, then receiving a large number of General Queries
9
10TST_NEEDS_ROOT=1
11TST_NEEDS_TMPDIR=1
12TST_SETUP="mcast_setup_normal"
13TST_CLEANUP="mcast_cleanup"
14TST_TESTFUNC="do_test"
15
16do_test()
17{
18	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"
19
20	local prefix="$MCAST_IPV4_ADDR_PREFIX"
21	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
22
23	# Run a multicast join tool
24	local tmpfile=$$
25	EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix \> $tmpfile
26	tst_res TINFO "joined $(grep groups $tmpfile)"
27
28	# Send General Queries from the remote host
29	local params
30	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
31	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
32}
33
34. mcast-lib.sh
35tst_run
36