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
17DIGOPTS="-p ${PORT}"
18
19status=0
20
21echo_i "1000 A records"
22$DIG $DIGOPTS +tcp +norec 1000.example. @10.53.0.1 a > dig.out.1000 || status=1
23# $DIG $DIGOPTS 1000.example. @10.53.0.1 a > knowngood.dig.out.1000
24digcomp knowngood.dig.out.1000 dig.out.1000 || status=1
25
26echo_i "2000 A records"
27$DIG $DIGOPTS +tcp +norec 2000.example. @10.53.0.1 a > dig.out.2000 || status=1
28# $DIG $DIGOPTS 2000.example. @10.53.0.1 a > knowngood.dig.out.2000
29digcomp knowngood.dig.out.2000 dig.out.2000 || status=1
30
31echo_i "3000 A records"
32$DIG $DIGOPTS +tcp +norec 3000.example. @10.53.0.1 a > dig.out.3000 || status=1
33# $DIG $DIGOPTS 3000.example. @10.53.0.1 a > knowngood.dig.out.3000
34digcomp knowngood.dig.out.3000 dig.out.3000 || status=1
35
36echo_i "4000 A records"
37$DIG $DIGOPTS +tcp +norec 4000.example. @10.53.0.1 a > dig.out.4000 || status=1
38# $DIG $DIGOPTS 4000.example. @10.53.0.1 a > knowngood.dig.out.4000
39digcomp knowngood.dig.out.4000 dig.out.4000 || status=1
40
41echo_i "exactly maximum rrset"
42$DIG $DIGOPTS +tcp +norec +noedns a-maximum-rrset.example. @10.53.0.1 a > dig.out.a-maximum-rrset \
43	|| status=1
44# $DIG $DIGOPTS a-maximum-rrset.example. @10.53.0.1 a > knowngood.dig.out.a-maximum-rrset
45digcomp knowngood.dig.out.a-maximum-rrset dig.out.a-maximum-rrset || status=1
46
47echo_i "exceed maximum rrset (5000 A records)"
48$DIG $DIGOPTS +tcp +norec +noadd 5000.example. @10.53.0.1 a > dig.out.exceed || status=1
49# Look for truncation bit (tc).
50grep 'flags: .*tc.*;' dig.out.exceed > /dev/null || {
51    echo_i "TC bit was not set"
52    status=1
53}
54
55echo_i "exit status: $status"
56[ $status -eq 0 ] || exit 1
57