1 #!/bin/sh 2 3 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. 4 # Copyright (c) International Business Machines Corp., 2005 5 # 6 # This program is free software; you can redistribute it and/or 7 # modify it under the terms of the GNU General Public License as 8 # published by the Free Software Foundation; either version 2 of 9 # the License, or (at your option) any later version. 10 # 11 # This program is distributed in the hope that it would be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License 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 the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 # 20 # Author: Mitsuru Chinen <mitch (at] jp.ibm.com> 21 22 TCID=dns-stress01-rmt 23 TST_TOTAL=1 24 25 . test.sh 26 27 # Check the arguments 28 if [ $# -ne 7 ]; then 29 tst_brkm TBROK "Usage: $0 ip_ver srv_ipaddr port domain \ 30 min_id max_id connect_quantity" 31 fi 32 33 ip_ver="$1" 34 srv_ipaddr="$2" 35 port="$3" 36 domain="$4" 37 min_id="$5" 38 max_id="$6" 39 connect_quantity="$7" 40 41 # Specify the record of dns accoring to the version of IP 42 case $ip_ver in 43 4) 44 record="A" ;; 45 6) 46 record="AAAA" ;; 47 *) 48 tst_brkm TBROK "$ver_opt is unknown IP version" ;; 49 esac 50 51 # Check the connectivity first 52 dig @$srv_ipaddr -p $port node${min_id}.${domain} $record > /dev/null || \ 53 tst_brkm TBROK "Failed to connect $srv_ipaddr" 54 55 # Loop for a large number of name lookup queries 56 num=0 57 id=$min_id 58 while [ $num -lt $connect_quantity ]; do 59 dig @$srv_ipaddr -p $port node${id}.${domain} $record > /dev/null 60 id=$(($id + 1)) 61 [ $id -gt $max_id ] && id=$min_id 62 num=$(($num + 1)) 63 done 64 65 # Check the connectivity again 66 dig @$srv_ipaddr -p $port node${min_id}.${domain} $record > /dev/null || \ 67 tst_brkm TBROK "Failed to connect $srv_ipaddr. dns server seems down." 68 69 tst_exit 70