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