mcast6-queryfld03 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. #!/bin/sh
  2. ################################################################################
  3. ## ##
  4. ## Copyright (c) International Business Machines Corp., 2006 ##
  5. ## ##
  6. ## This program is free software; you can redistribute it and#or modify ##
  7. ## it under the terms of the GNU General Public License as published by ##
  8. ## the Free Software Foundation; either version 2 of the License, or ##
  9. ## (at your option) any later version. ##
  10. ## ##
  11. ## This program is distributed in the hope that it will be useful, but ##
  12. ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
  13. ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
  14. ## for more details. ##
  15. ## ##
  16. ## You should have received a copy of the GNU General Public License ##
  17. ## along with this program; if not, write to the Free Software ##
  18. ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
  19. ## ##
  20. ## ##
  21. ################################################################################
  22. #
  23. # File:
  24. # mcast6-queryfld03
  25. #
  26. # Description:
  27. # Verify that the kernel is not crashed when joining an IPv6 multicast group
  28. # on a single socket, then receiving a large number of Multicast Address
  29. # and Source Specific Query
  30. #
  31. # Setup:
  32. # See testcases/network/stress/README
  33. #
  34. # Author:
  35. # Mitsuru Chinen <mitch@jp.ibm.com>
  36. #
  37. # History:
  38. # May 1 2006 - Created (Mitsuru Chinen)
  39. #
  40. #-----------------------------------------------------------------------
  41. # Uncomment line below for debug output.
  42. #trace_logic=${trace_logic:-"set -x"}
  43. $trace_logic
  44. # The test case ID, the test case count and the total number of test case
  45. TCID=mcast6-queryfld03
  46. TST_TOTAL=1
  47. TST_COUNT=1
  48. export TCID
  49. export TST_COUNT
  50. export TST_TOTAL
  51. # Make sure the value of LTPROOT
  52. LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
  53. export LTPROOT
  54. # Check the environmanet variable
  55. . check_envval || exit $TST_TOTAL
  56. # Dulation of the test [sec]
  57. NS_DURATION=${NS_DURATION:-3600} # 1 hour
  58. # The number of the test link where tests run
  59. LINK_NUM=${LINK_NUM:-0}
  60. # Network portion of the IPv6 address
  61. NETWORK_PART="fec0:1:1:1"
  62. # Host portion of the IPv6 address
  63. LHOST_HOST_PART=":2" # local host
  64. RHOST_HOST_PART=":1" # remote host
  65. # Prefix of the Multicast Address
  66. MCAST_ADDR_PREFIX=ff0e:
  67. # Multicast Address
  68. MCAST_ADDR=ff0e::1 # If you modify this, please refer ns-mcast_join.c
  69. # Source Address
  70. SRC_ADDR=fec0:100:100:100::1
  71. # Filter Mode
  72. FILTER_MODE="include"
  73. #-----------------------------------------------------------------------
  74. #
  75. # Function: do_cleanup
  76. #
  77. # Description:
  78. # Recover the system configuration
  79. #
  80. #-----------------------------------------------------------------------
  81. do_cleanup()
  82. {
  83. # Make sure to kill the multicast receiver and sender
  84. killall -SIGHUP ns-mcast_join >/dev/null 2>&1
  85. $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
  86. # Clean up each interface
  87. initialize_if lhost ${LINK_NUM}
  88. initialize_if rhost ${LINK_NUM}
  89. }
  90. #-----------------------------------------------------------------------
  91. #
  92. # Function: do_setup
  93. #
  94. # Description:
  95. # Configure the ssystem for the test
  96. #
  97. #-----------------------------------------------------------------------
  98. do_setup()
  99. {
  100. # Initialize the system configuration
  101. do_cleanup
  102. # Call do_cleanup function before exit
  103. trap do_cleanup 0
  104. # name of interface of the local/remote host
  105. lhost_ifname=`get_ifname lhost $LINK_NUM`
  106. if [ $? -ne 0 ]; then
  107. tst_resm TBROK "Failed to get the interface name at the local host"
  108. exit $TST_TOTAL
  109. fi
  110. rhost_ifname=`get_ifname rhost $LINK_NUM`
  111. if [ $? -ne 0 ]; then
  112. tst_resm TBROK "Failed to get the interface name at the remote host"
  113. exit $TST_TOTAL
  114. fi
  115. # Set IPv6 addresses to the interfaces
  116. add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
  117. if [ $? -ne 0 ]; then
  118. tst_resm TBROK "Failed to add any IP address at the local host"
  119. exit 1
  120. fi
  121. add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
  122. if [ $? -ne 0 ]; then
  123. tst_resm TBROK "Failed to add any IP address at the remote host"
  124. exit 1
  125. fi
  126. # IPv6 address of the local/remote host
  127. lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
  128. rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
  129. rhost_linklocal="fe80:${RHOST_HOST_PART}"
  130. # Make sure the connectvity
  131. check_icmpv6_connectivity $lhost_ifname $rhost_addr
  132. if [ $? -ne 0 ]; then
  133. tst_resm TBROK "There is no IPv6 connectivity."
  134. exit 1
  135. fi
  136. # Make sure the sysctl values
  137. sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
  138. if [ $? -ne 0 ]; then
  139. tst_resm TBROK "Failed to set the sysctl value regarding multicast"
  140. exit $TST_TOTAL
  141. fi
  142. sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
  143. sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
  144. }
  145. #-----------------------------------------------------------------------
  146. #
  147. # Main
  148. #
  149. #
  150. # Test description
  151. tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
  152. do_setup
  153. # Run a multicast join tool
  154. ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
  155. if [ $? -ne 0 ]; then
  156. tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
  157. exit 1
  158. fi
  159. # Send MLD Multicast Address and Source Specific Query from the remote host
  160. ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -a $SRC_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
  161. if [ $ret -ne 0 ]; then
  162. tst_resm TBROK "Failed to start MLD querier"
  163. exit 1
  164. fi
  165. #-----------------------------------------------------------------------
  166. #
  167. # Clean up
  168. #
  169. killall -SIGHUP ns-mcast_join >/dev/null 2>&1
  170. tst_resm TPASS "Test is finished successfully."
  171. exit 0