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 14set -e 15 16. ../conf.sh 17 18DIGOPTS="+tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd -p ${PORT}" 19 20status=0 21 22echo_i "test 2-element sortlist statement" 23cat <<EOF >test1.good 24a.example. 300 IN A 192.168.3.1 25a.example. 300 IN A 192.168.1.1 26a.example. 300 IN A 1.1.1.5 27a.example. 300 IN A 1.1.1.1 28a.example. 300 IN A 1.1.1.3 29a.example. 300 IN A 1.1.1.2 30a.example. 300 IN A 1.1.1.4 31EOF 32$DIG $DIGOPTS a.example. @10.53.0.1 -b 10.53.0.1 >test1.dig 33# Note that this can't use digcomp.pl because here, the ordering of the 34# result RRs is significant. 35diff test1.dig test1.good || status=1 36 37echo_i "test 1-element sortlist statement and undocumented BIND 8 features" 38cat <<EOF >test2.good 39b.example. 300 IN A 10.53.0.$n 40EOF 41 42$DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.2 | sed 1q \ 43 | grep -E '10.53.0.(2|3)$' >test2.out \ 44 && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.3 | sed 1q \ 45 | grep -E '10.53.0.(2|3)$' >>test2.out \ 46 && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.4 | sed 1q \ 47 | grep -E '10.53.0.4$' >>test2.out \ 48 && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.5 | sed 1q \ 49 | grep -E '10.53.0.5$' >>test2.out || status=1 50 51echo_i "exit status: $status" 52[ $status -eq 0 ] || exit 1 53