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 a multicast group 8f08c3bdfSopenharmony_ci# on a single socket, then receiving a large number of Multicast Address 9f08c3bdfSopenharmony_ci# and Source Specific Queries 10f08c3bdfSopenharmony_ci 11f08c3bdfSopenharmony_ciTST_NEEDS_ROOT=1 12f08c3bdfSopenharmony_ciTST_NEEDS_TMPDIR=1 13f08c3bdfSopenharmony_ciTST_SETUP="mcast_setup_normal" 14f08c3bdfSopenharmony_ciTST_CLEANUP="mcast_cleanup" 15f08c3bdfSopenharmony_ciTST_TESTFUNC="do_test" 16f08c3bdfSopenharmony_ci 17f08c3bdfSopenharmony_ciSRC_ADDR_IPV4="10.10.10.1" 18f08c3bdfSopenharmony_ciSRC_ADDR_IPV6="fec0:100:100:100::1" 19f08c3bdfSopenharmony_ciFILTER_MODE="include" 20f08c3bdfSopenharmony_ci 21f08c3bdfSopenharmony_cido_test() 22f08c3bdfSopenharmony_ci{ 23f08c3bdfSopenharmony_ci 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" 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci local prefix="$MCAST_IPV4_ADDR_PREFIX" 26f08c3bdfSopenharmony_ci local src_addr="$SRC_ADDR_IPV4" 27f08c3bdfSopenharmony_ci if [ "$TST_IPV6" ]; then 28f08c3bdfSopenharmony_ci prefix="$MCAST_IPV6_ADDR_PREFIX" 29f08c3bdfSopenharmony_ci src_addr="$SRC_ADDR_IPV6" 30f08c3bdfSopenharmony_ci fi 31f08c3bdfSopenharmony_ci 32f08c3bdfSopenharmony_ci # Run a multicast join tool 33f08c3bdfSopenharmony_ci local tmpfile=$$ 34f08c3bdfSopenharmony_ci EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile 35f08c3bdfSopenharmony_ci tst_res TINFO "joined $(grep groups $tmpfile)" 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ci # Send Multicast Address and Source Specific Queries from the remote host 38f08c3bdfSopenharmony_ci local params="-m $MCAST_IPV4_ADDR -s $src_addr" 39f08c3bdfSopenharmony_ci [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR -a $src_addr" 40f08c3bdfSopenharmony_ci EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params 41f08c3bdfSopenharmony_ci} 42f08c3bdfSopenharmony_ci 43f08c3bdfSopenharmony_ci. mcast-lib.sh 44f08c3bdfSopenharmony_citst_run 45