• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <joerg.vehlow@aox-tech.de>
5# Author: Mitsuru Chinen <mitch@jp.ibm.com>
6#
7# Verify that the kernel is not crashed when joining a multicast group
8# on a single socket, then receiving a large number of Multicast Address
9# and Source Specific Queries
10
11TST_NEEDS_ROOT=1
12TST_NEEDS_TMPDIR=1
13TST_SETUP="mcast_setup_normal"
14TST_CLEANUP="mcast_cleanup"
15TST_TESTFUNC="do_test"
16. mcast-lib.sh
17
18SRC_ADDR_IPV4="10.10.10.1"
19SRC_ADDR_IPV6="fec0:100:100:100::1"
20FILTER_MODE="include"
21
22do_test()
23{
24	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"
25
26	local prefix="$MCAST_IPV4_ADDR_PREFIX"
27	local src_addr="$SRC_ADDR_IPV4"
28	if [ "$TST_IPV6" ]; then
29		prefix="$MCAST_IPV6_ADDR_PREFIX"
30		src_addr="$SRC_ADDR_IPV6"
31	fi
32
33	# Run a multicast join tool
34	local tmpfile=$$
35	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
36	tst_res TINFO "joined $(grep groups $tmpfile)"
37
38	# Send Multicast Address and Source Specific Queries from the remote host
39	local params="-m $MCAST_IPV4_ADDR -s $src_addr"
40	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR -a $src_addr"
41	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
42}
43
44tst_run
45