1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later
3f08c3bdfSopenharmony_ci# Copyright (c) 2006 International Business Machines  Corp.
4f08c3bdfSopenharmony_ci# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
5f08c3bdfSopenharmony_ci# Author: Mitsuru Chinen <mitch@jp.ibm.com>
6f08c3bdfSopenharmony_ci#
7f08c3bdfSopenharmony_ci# Verify that the kernel is not crashed when joining multiple multicast
8f08c3bdfSopenharmony_ci# groups on separate socket, then receiving a large number of General Queries
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_ciTST_NEEDS_ROOT=1
11f08c3bdfSopenharmony_ciTST_NEEDS_TMPDIR=1
12f08c3bdfSopenharmony_ciTST_SETUP="mcast_setup_normal"
13f08c3bdfSopenharmony_ciTST_CLEANUP="mcast_cleanup"
14f08c3bdfSopenharmony_ciTST_TESTFUNC="do_test"
15f08c3bdfSopenharmony_ci
16f08c3bdfSopenharmony_cido_test()
17f08c3bdfSopenharmony_ci{
18f08c3bdfSopenharmony_ci	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"
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci	local prefix="$MCAST_IPV4_ADDR_PREFIX"
21f08c3bdfSopenharmony_ci	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_ci	# Run a multicast join tool
24f08c3bdfSopenharmony_ci	local tmpfile=$$
25f08c3bdfSopenharmony_ci	EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix \> $tmpfile
26f08c3bdfSopenharmony_ci	tst_res TINFO "joined $(grep groups $tmpfile)"
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ci	# Send General Queries from the remote host
29f08c3bdfSopenharmony_ci	local params
30f08c3bdfSopenharmony_ci	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
31f08c3bdfSopenharmony_ci	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
32f08c3bdfSopenharmony_ci}
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ci. mcast-lib.sh
35f08c3bdfSopenharmony_citst_run
36