mcast-pktfld01.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. TST_NEEDS_ROOT=1
  10. TST_NEEDS_TMPDIR=1
  11. TST_SETUP="mcast_setup_normal_udp"
  12. TST_CLEANUP="mcast_cleanup"
  13. TST_TESTFUNC="do_test"
  14. . mcast-lib.sh
  15. do_test()
  16. {
  17. 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"
  18. local addr="$MCAST_IPV4_ADDR"
  19. [ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR"
  20. local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
  21. [ $? -ne 0 ] && tst_brk TBROK "no free udp port available"
  22. # Run a receiver
  23. ROD $MCAST_LCMD -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
  24. # Run a sender
  25. tst_rhost_run -s -c "$MCAST_RCMD -D $addr -f $TST_IPVER -p $port -s 32767 -m -I $(tst_iface rhost) -t $NS_DURATION"
  26. tst_res TPASS "test finished successfully"
  27. }
  28. tst_run