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 with 8# a single socket, then receiving a large number of UDP packets at the socket 9 10TST_NEEDS_ROOT=1 11TST_NEEDS_TMPDIR=1 12TST_SETUP="mcast_setup_normal_udp" 13TST_CLEANUP="mcast_cleanup" 14TST_TESTFUNC="do_test" 15. mcast-lib.sh 16 17do_test() 18{ 19 tst_res TINFO "joining an IPv${TST_IPVER} multicast group with a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION seconds" 20 21 local addr="$MCAST_IPV4_ADDR" 22 [ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR" 23 24 local port=$(tst_get_unused_port ipv${TST_IPVER} dgram) 25 [ $? -ne 0 ] && tst_brk TBROK "no free udp port available" 26 27 # Run a receiver 28 ROD $MCAST_LCMD -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b 29 30 # Run a sender 31 tst_rhost_run -s -c "$MCAST_RCMD -D $addr -f $TST_IPVER -p $port -s 32767 -m -I $(tst_iface rhost) -t $NS_DURATION" 32 33 tst_res TPASS "test finished successfully" 34} 35 36tst_run 37