1#!/bin/sh 2 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# SPDX-License-Identifier: MPL-2.0 6# 7# This Source Code Form is subject to the terms of the Mozilla Public 8# License, v. 2.0. If a copy of the MPL was not distributed with this 9# file, you can obtain one at https://mozilla.org/MPL/2.0/. 10# 11# See the COPYRIGHT file distributed with this work for additional 12# information regarding copyright ownership. 13 14SYSTEMTESTTOP=.. 15. $SYSTEMTESTTOP/conf.sh 16 17MDIGOPTS="-p ${PORT}" 18RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" 19 20status=0 21 22echo_i "check pipelined TCP queries" 23ret=0 24$PIPEQUERIES -p ${PORT} < input > raw || ret=1 25awk '{ print $1 " " $5 }' < raw > output 26sort < output > output-sorted 27$DIFF ref output-sorted || { ret=1 ; echo_i "diff sorted failed"; } 28$DIFF ref output > /dev/null && { ret=1 ; echo_i "diff out of order failed"; } 29if [ $ret != 0 ]; then echo_i "failed"; fi 30status=`expr $status + $ret` 31 32echo_i "check pipelined TCP queries using mdig" 33ret=0 34$RNDCCMD 10.53.0.4 flush 35sleep 1 36$MDIG $MDIGOPTS +noall +answer +vc -f input -b 10.53.0.4 @10.53.0.4 > raw.mdig 37awk '{ print $1 " " $5 }' < raw.mdig > output.mdig 38sort < output.mdig > output-sorted.mdig 39$DIFF ref output-sorted.mdig || { ret=1 ; echo_i "diff sorted failed"; } 40$DIFF ref output.mdig > /dev/null && { ret=1 ; echo_i "diff out of order failed"; } 41if [ $ret != 0 ]; then echo_i "failed"; fi 42status=`expr $status + $ret` 43 44echo_i "check keep-response-order" 45ret=0 46$RNDCCMD 10.53.0.4 flush 47sleep 1 48$PIPEQUERIES -p ${PORT} ++ < inputb > rawb || ret=1 49awk '{ print $1 " " $5 }' < rawb > outputb 50$DIFF refb outputb || ret=1 51if [ $ret != 0 ]; then echo_i "failed"; fi 52status=`expr $status + $ret` 53 54echo_i "check keep-response-order using mdig" 55ret=0 56$RNDCCMD 10.53.0.4 flush 57sleep 1 58$MDIG $MDIGOPTS +noall +answer +vc -f inputb -b 10.53.0.7 @10.53.0.4 > rawb.mdig 59awk '{ print $1 " " $5 }' < rawb.mdig > outputb.mdig 60$DIFF refb outputb.mdig || ret=1 61if [ $ret != 0 ]; then echo_i "failed"; fi 62status=`expr $status + $ret` 63 64echo_i "check mdig -4 -6" 65ret=0 66$RNDCCMD 10.53.0.4 flush 67sleep 1 68$MDIG $MDIGOPTS -4 -6 -f input @10.53.0.4 > output46.mdig 2>&1 && ret=1 69grep "only one of -4 and -6 allowed" output46.mdig > /dev/null || ret=1 70if [ $ret != 0 ]; then echo_i "failed"; fi 71status=`expr $status + $ret` 72 73echo_i "check mdig -4 with an IPv6 server address" 74ret=0 75$MDIG $MDIGOPTS -4 -f input @fd92:7065:b8e:ffff::2 > output4.mdig 2>&1 && ret=1 76grep "address family not supported" output4.mdig > /dev/null || ret=1 77if [ $ret != 0 ]; then echo_i "failed"; fi 78status=`expr $status + $ret` 79 80echo_i "exit status: $status" 81[ $status -eq 0 ] || exit 1 82