mcast-queryfld03.sh 1.4 KB

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