mreed10 | 0be0dc3 | 2006-09-11 19:31:51 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | ################################################################################ |
| 4 | ## ## |
| 5 | ## Copyright (c) International Business Machines Corp., 2006 ## |
| 6 | ## ## |
| 7 | ## This program is free software; you can redistribute it and#or modify ## |
| 8 | ## it under the terms of the GNU General Public License as published by ## |
| 9 | ## the Free Software Foundation; either version 2 of the License, or ## |
| 10 | ## (at your option) any later version. ## |
| 11 | ## ## |
| 12 | ## This program is distributed in the hope that it will be useful, but ## |
| 13 | ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## |
| 14 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## |
| 15 | ## for more details. ## |
| 16 | ## ## |
| 17 | ## You should have received a copy of the GNU General Public License ## |
| 18 | ## along with this program; if not, write to the Free Software ## |
| 19 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## |
| 20 | ## ## |
| 21 | ## ## |
| 22 | ################################################################################ |
| 23 | # |
| 24 | # File: |
| 25 | # mcast6-queryfld05 |
| 26 | # |
| 27 | # Description: |
| 28 | # Verify that the kernel is not crashed when joining joining plural IPv6 |
| 29 | # multicast groups on separate socket, then receiving a large number of |
| 30 | # Multicast Address Specific Query |
| 31 | # |
| 32 | # Setup: |
| 33 | # See ltp-yyyymmdd/testcases/network/stress/README |
| 34 | # |
| 35 | # Author: |
| 36 | # Mitsuru Chinen <mitch@jp.ibm.com> |
| 37 | # |
| 38 | # History: |
| 39 | # May 7 2006 - Created (Mitsuru Chinen) |
| 40 | # |
| 41 | #----------------------------------------------------------------------- |
| 42 | # Uncomment line below for debug output. |
| 43 | #trace_logic=${trace_logic:-"set -x"} |
| 44 | $trace_logic |
| 45 | |
| 46 | # The test case ID, the test case count and the total number of test case |
| 47 | TCID=mcast6-queryfld05 |
| 48 | TST_TOTAL=1 |
| 49 | TST_COUNT=1 |
| 50 | export TCID |
| 51 | export TST_COUNT |
| 52 | export TST_TOTAL |
| 53 | |
| 54 | # Make sure the value of LTPROOT |
| 55 | LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`} |
| 56 | export LTPROOT |
| 57 | |
| 58 | # Check the environmanet variable |
vapier | dabc620 | 2008-10-06 03:30:34 +0000 | [diff] [blame] | 59 | . check_envval || exit $TST_TOTAL |
mreed10 | 0be0dc3 | 2006-09-11 19:31:51 +0000 | [diff] [blame] | 60 | |
| 61 | # Dulation of the test [sec] |
| 62 | NS_DURATION=${NS_DURATION:-3600} # 1 hour |
| 63 | |
| 64 | # Number of the multicast to join |
| 65 | MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20} |
| 66 | |
| 67 | # The number of the test link where tests run |
| 68 | LINK_NUM=${LINK_NUM:-0} |
| 69 | |
| 70 | # Network portion of the IPv6 address |
| 71 | NETWORK_PART="fec0:1:1:1" |
| 72 | |
| 73 | # Host portion of the IPv6 address |
| 74 | LHOST_HOST_PART=":2" # local host |
| 75 | RHOST_HOST_PART=":1" # remote host |
| 76 | |
| 77 | # Prefix of the Multicast Address |
| 78 | MCAST_ADDR_PREFIX=ff0e: |
| 79 | |
| 80 | #----------------------------------------------------------------------- |
| 81 | # |
| 82 | # Function: do_cleanup |
| 83 | # |
| 84 | # Description: |
| 85 | # Recover the system configuration |
| 86 | # |
| 87 | #----------------------------------------------------------------------- |
| 88 | do_cleanup() |
| 89 | { |
| 90 | # Make sure to kill the multicast receiver and sender |
| 91 | killall -SIGHUP ns-mcast_join >/dev/null 2>&1 |
| 92 | $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1 |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame^] | 93 | |
mreed10 | 0be0dc3 | 2006-09-11 19:31:51 +0000 | [diff] [blame] | 94 | # Clean up each interface |
| 95 | initialize_if lhost ${LINK_NUM} |
| 96 | initialize_if rhost ${LINK_NUM} |
| 97 | } |
| 98 | |
| 99 | |
| 100 | #----------------------------------------------------------------------- |
| 101 | # |
| 102 | # Function: do_setup |
| 103 | # |
| 104 | # Description: |
| 105 | # Configure the ssystem for the test |
| 106 | # |
| 107 | #----------------------------------------------------------------------- |
| 108 | do_setup() |
| 109 | { |
| 110 | # Initialize the system configuration |
| 111 | do_cleanup |
| 112 | |
| 113 | # Call do_cleanup function before exit |
| 114 | trap do_cleanup 0 |
| 115 | |
| 116 | # name of interface of the local/remote host |
| 117 | lhost_ifname=`get_ifname lhost $LINK_NUM` |
| 118 | if [ $? -ne 0 ]; then |
| 119 | tst_resm TBROK "Failed to get the interface name at the local host" |
| 120 | exit $TST_TOTAL |
| 121 | fi |
| 122 | |
| 123 | rhost_ifname=`get_ifname rhost $LINK_NUM` |
| 124 | if [ $? -ne 0 ]; then |
| 125 | tst_resm TBROK "Failed to get the interface name at the remote host" |
| 126 | exit $TST_TOTAL |
| 127 | fi |
| 128 | |
| 129 | # Set IPv6 addresses to the interfaces |
| 130 | add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART |
| 131 | if [ $? -ne 0 ]; then |
| 132 | tst_resm TBROK "Failed to add any IP address at the local host" |
| 133 | exit 1 |
| 134 | fi |
| 135 | |
| 136 | add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART |
| 137 | if [ $? -ne 0 ]; then |
| 138 | tst_resm TBROK "Failed to add any IP address at the remote host" |
| 139 | exit 1 |
| 140 | fi |
| 141 | |
| 142 | # IPv6 address of the local/remote host |
| 143 | lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}" |
| 144 | rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}" |
| 145 | rhost_linklocal="fe80:${RHOST_HOST_PART}" |
| 146 | |
| 147 | # Make sure the connectvity |
| 148 | check_icmpv6_connectivity $lhost_ifname $rhost_addr |
| 149 | if [ $? -ne 0 ]; then |
| 150 | tst_resm TBROK "There is no IPv6 connectivity." |
| 151 | exit 1 |
| 152 | fi |
| 153 | |
| 154 | # Make sure the sysctl values |
| 155 | sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null |
| 156 | if [ $? -ne 0 ]; then |
| 157 | tst_resm TBROK "Failed to set the sysctl value regarding multicast" |
| 158 | exit $TST_TOTAL |
| 159 | fi |
| 160 | |
| 161 | sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null |
| 162 | sysctl -w net.ipv6.mld_max_msf=10 >/dev/null |
| 163 | } |
| 164 | |
| 165 | |
| 166 | #----------------------------------------------------------------------- |
| 167 | # |
| 168 | # Main |
| 169 | # |
| 170 | # |
| 171 | |
| 172 | # Test description |
| 173 | tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]" |
| 174 | |
| 175 | do_setup |
| 176 | |
| 177 | # Run a multicast join tool |
| 178 | ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null |
| 179 | if [ $? -ne 0 ]; then |
| 180 | tst_resm TBROK "Failed to start multicast joining tool Please check the environment" |
| 181 | exit 1 |
| 182 | fi |
| 183 | |
| 184 | # Send MLD Multicast Address Specific Query from the remote host |
| 185 | querier_num=0 |
| 186 | while [ $querier_num -lt $MCASTNUM_NORMAL ]; do |
| 187 | # Define the multicast address |
| 188 | if [ $querier_num -gt 65535 ]; then |
| 189 | tst_resm TINFO "The number of the querier is less than 65535" |
| 190 | break |
| 191 | fi |
| 192 | querier_num_hex=`printf "%x" $querier_num` |
| 193 | mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex} |
| 194 | |
| 195 | $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -r 0 -t $NS_DURATION -b |
| 196 | |
| 197 | querier_num=`expr $querier_num + 1` |
| 198 | done |
| 199 | sleep $NS_DURATION |
| 200 | |
| 201 | #----------------------------------------------------------------------- |
| 202 | # |
| 203 | # Clean up |
| 204 | # |
| 205 | |
| 206 | do_cleanup |
| 207 | tst_resm TPASS "Test is finished successfully." |
| 208 | |
| 209 | exit 0 |