• 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
17SRC_ADDR_IPV4="10.10.10.1"
18SRC_ADDR_IPV6="fec0:100:100:100::1"
19FILTER_MODE="include"
20
21do_test()
22{
23	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"
24
25	local prefix="$MCAST_IPV4_ADDR_PREFIX"
26	local src_addr="$SRC_ADDR_IPV4"
27	if [ "$TST_IPV6" ]; then
28		prefix="$MCAST_IPV6_ADDR_PREFIX"
29		src_addr="$SRC_ADDR_IPV6"
30	fi
31
32	# Run a multicast join tool
33	local tmpfile=$$
34	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
35	tst_res TINFO "joined $(grep groups $tmpfile)"
36
37	# Send Multicast Address and Source Specific Queries from the remote host
38	local params="-m $MCAST_IPV4_ADDR -s $src_addr"
39	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR -a $src_addr"
40	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
41}
42
43. mcast-lib.sh
44tst_run
45