[LTP] [PATCH v3 1/3] network/stress/multicast/packet-flood: Update to new API

Petr Vorel pvorel@suse.cz
Wed Jan 13 01:23:24 CET 2021


Hi Joerg,

> +++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh
...
> +do_test()
> +{
> +	tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
> +
> +	local n=0
> +	while [ $n -lt $MCASTNUM_NORMAL ]; do
> +		# Define the multicast address
> +		if [ "$TST_IPV6" ]; then
> +    		local n_hex=$(printf "%x" $n)
> +    		local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}
> +		else
> +			local x=$((n / 254))
> +			local y=$((n % 254 + 1))
> +			local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
> +		fi
> +
> +		local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
> +		[ $? -ne 0 ] && tst_brk TBROK "No free udp port available."
> +		tst_res TINFO Port: $port
> +
> +		# Run a receiver
> +		ROD ns-mcast_receiver -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
> +	
> +		# Run a sender
> +		tst_rhost_run -s -c "ns-udpsender -D $addr -f $TST_IPVER -p $port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
> +
> +		: $((n += 1))
> +	done
> +
> +	sleep $NS_DURATION
FYI: although this is in old tests, IMHO it's useless, thus I'll remove it.

Kind regards,
Petr


More information about the ltp mailing list