• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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@jp.ibm.com>
20
21TCID=dns-stress01-rmt
22TST_TOTAL=1
23
24. dns-stress-lib.sh
25
26# Check the arguments
27if [ $# -ne 7 ]; then
28	tst_brkm TBROK "Usage: $0 ip_ver srv_ipaddr port domain \
29min_id max_id connect_quantity"
30fi
31
32ip_ver="$1"
33srv_ipaddr="$2"
34port="$3"
35domain="$4"
36min_id="$5"
37max_id="$6"
38connect_quantity="$7"
39
40# Specify the record of dns accoring to the version of IP
41case $ip_ver in
424)
43	record="A" ;;
446)
45	record="AAAA" ;;
46*)
47	tst_brkm TBROK "$ver_opt is unknown IP version" ;;
48esac
49
50# Check the connectivity first
51dig @$srv_ipaddr -p $port node${min_id}.${domain} $record > ans.log 2>&1 || \
52	tst_brkm TBROK "Failed to connect $srv_ipaddr"
53dns_check_answer ans.log
54
55# Loop for a large number of name lookup queries
56num=0
57id=$min_id
58while [ $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))
64done
65
66# Check the connectivity again
67dig @$srv_ipaddr -p $port node${id}.${domain} $record > ans.log 2>&1 || \
68	tst_brkm TBROK "Failed to connect $srv_ipaddr"
69dns_check_answer ans.log
70
71dns_check_send_requests
72
73tst_exit
74