1#!/bin/sh 2# Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved. 3# Copyright (c) International Business Machines Corp., 2006 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@jp.ibm.com> 20 21TCID=dns-stress02-rmt 22TST_TOTAL=1 23 24. dns-stress-lib.sh 25 26if [ $# -ne 7 ]; then 27 tst_brkm TBROK "Usage: $0 ip_ver srv_ipaddr port net \ 28min_id max_id connect_quantity" 29fi 30 31ip_ver="$1" 32srv_ipaddr="$2" 33port="$3" 34net="$4" 35min_id="$5" 36max_id="$6" 37connect_quantity="$7" 38 39# Specify the option of dns according to the version of IP 40case $ip_ver in 414) 42 opt="" 43 sep="." 44;; 456) 46 opt="-n" 47 sep="::" 48;; 49*) 50 tst_brkm TBROK "$ver_opt is unknown IP version" ;; 51esac 52 53# Check the connectivity first 54dig @$srv_ipaddr $opt -p $port -x ${net}${sep}${min_id} $record \ 55 > ans.log 2>&1 || \ 56 tst_brkm TBROK "Failed to connect $srv_ipaddr" 57dns_check_answer ans.log 58 59# Loop for a large number of reverse name lookup queries 60num=0 61id=$min_id 62while [ $num -lt $connect_quantity ]; do 63 dig @$srv_ipaddr $opt -p $port -x ${net}${sep}${id} $record \ 64 > /dev/null || break 65 id=$(($id + 1)) 66 [ $id -gt $max_id ] && id=$min_id 67 num=$(($num + 1)) 68done 69 70# Check the connectivity again 71dig @$srv_ipaddr $opt -p $port -x ${net}${sep}${min_id} $record \ 72 > ans.log 2>&1 || \ 73 tst_brkm TBROK "Failed to connect $srv_ipaddr" 74dns_check_answer ans.log 75 76dns_check_send_requests 77 78tst_exit 79