acce4b333de469c687908f3a04381f2897d242e9Tinderbox User# Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I: checking that named-checkconf detects error in $bad"
fd8d52fbdd14733534220270def95b6bf7875f97Evan Hunt echo "I: checking that named-checkconf detects no error in $good"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews$DIG +short @10.53.0.3 -p 5300 a.example > dig.out
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt# check three different dnstap reopen/roll methods:
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt# ns1: dnstap-reopen; ns2: dnstap -reopen; ns3: dnstap -roll
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsif [ -n "$FSTRM_CAPTURE" ] ; then
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $FSTRM_CAPTURE -t protobuf:dnstap.Dnstap -u ns4/dnstap.out \
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrews$RNDCCMD -s 10.53.0.1 dnstap-reopen | sed 's/^/I:ns1 /'
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt$RNDCCMD -s 10.53.0.2 dnstap -reopen | sed 's/^/I:ns2 /'
3525200d9fb0e70aec4f6a3c7e0ed5a7dd8398afEvan Hunt$RNDCCMD -s 10.53.0.3 dnstap -roll | sed 's/^/I:ns3 /'
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews$RNDCCMD -s 10.53.0.4 dnstap -reopen | sed 's/^/I:ns4 /'
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# XXX: file output should be flushed once a second according
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# to the libfstrm source, but it doesn't seem to happen until
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# enough data has accumulated. to get all the output, we stop
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# the name servers, forcing a flush on shutdown. it would be
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt# nice to find a better way to do this.
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrewsecho "I:checking initial message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp1=`$DNSTAPREAD ns1/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp1=`$DNSTAPREAD ns1/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar1=`$DNSTAPREAD ns1/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr1=`$DNSTAPREAD ns1/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq1=`$DNSTAPREAD ns1/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr1=`$DNSTAPREAD ns1/dnstap.out.save | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp2=`$DNSTAPREAD ns2/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp2=`$DNSTAPREAD ns2/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar2=`$DNSTAPREAD ns2/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr2=`$DNSTAPREAD ns2/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq2=`$DNSTAPREAD ns2/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr2=`$DNSTAPREAD ns2/dnstap.out.save | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp3=`$DNSTAPREAD ns3/dnstap.out.save | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp3=`$DNSTAPREAD ns3/dnstap.out.save | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar3=`$DNSTAPREAD ns3/dnstap.out.save | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr3=`$DNSTAPREAD ns3/dnstap.out.save | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq3=`$DNSTAPREAD ns3/dnstap.out.save | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr3=`$DNSTAPREAD ns3/dnstap.out.save | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking UDP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking TCP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_RESPONSE message counts"
7df3f06c0bf0b78a88221348d6af6704d9ece7efMark Andrewsecho "I:checking reopened message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp1=`$DNSTAPREAD ns1/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp1=`$DNSTAPREAD ns1/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq1=`$DNSTAPREAD ns1/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar1=`$DNSTAPREAD ns1/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq1=`$DNSTAPREAD ns1/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr1=`$DNSTAPREAD ns1/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq1=`$DNSTAPREAD ns1/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr1=`$DNSTAPREAD ns1/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp2=`$DNSTAPREAD ns2/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp2=`$DNSTAPREAD ns2/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq2=`$DNSTAPREAD ns2/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar2=`$DNSTAPREAD ns2/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq2=`$DNSTAPREAD ns2/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr2=`$DNSTAPREAD ns2/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq2=`$DNSTAPREAD ns2/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr2=`$DNSTAPREAD ns2/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsudp3=`$DNSTAPREAD ns3/dnstap.out | grep "UDP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewstcp3=`$DNSTAPREAD ns3/dnstap.out | grep "TCP " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsaq3=`$DNSTAPREAD ns3/dnstap.out | grep "AQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsar3=`$DNSTAPREAD ns3/dnstap.out | grep "AR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscq3=`$DNSTAPREAD ns3/dnstap.out | grep "CQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewscr3=`$DNSTAPREAD ns3/dnstap.out | grep "CR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrq3=`$DNSTAPREAD ns3/dnstap.out | grep "RQ " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsrr3=`$DNSTAPREAD ns3/dnstap.out | grep "RR " | wc -l`
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking UDP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking TCP message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking AUTH_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking CLIENT_RESPONSE message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_QUERY message counts"
7d262a3647a517a86d6d83058aedd18b7a6b06dfMark Andrewsecho "I: checking RESOLVER_RESPONSE message counts"
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpkif [ -n "$PYTHON" ] ; then
b498959ce2ab3d0d807ff7175c0607124e8b421dMark Andrews $PYTHON -c "import yaml" 2> /dev/null && HAS_PYYAML=1
b1866070ef4fb9e17bff16ad458f629bbc5a4accwpk echo "I:checking dnstap-read YAML output"
b089df4f8433e2deadec7aa7b50a1c80fa66fe48Mark Andrews $PYTHON ydump.py "$DNSTAPREAD" "ns3/dnstap.out.save" > ydump.out || ret=1
15bee593e70faca91a00331184fbbbc66080d422Mark Andrewsif [ -n "$FSTRM_CAPTURE" ] ; then
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $DIG +short @10.53.0.4 -p 5300 a.example > dig.out
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I:checking unix socket message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews udp4=`$DNSTAPREAD dnstap.out | grep "UDP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews tcp4=`$DNSTAPREAD dnstap.out | grep "TCP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews aq4=`$DNSTAPREAD dnstap.out | grep "AQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ar4=`$DNSTAPREAD dnstap.out | grep "AR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cq4=`$DNSTAPREAD dnstap.out | grep "CQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cr4=`$DNSTAPREAD dnstap.out | grep "CR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rq4=`$DNSTAPREAD dnstap.out | grep "RQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rr4=`$DNSTAPREAD dnstap.out | grep "RR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking UDP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking TCP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $FSTRM_CAPTURE -t protobuf:dnstap.Dnstap -u ns4/dnstap.out \
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $RNDCCMD -s 10.53.0.4 dnstap -reopen | sed 's/^/I:ns4 /'
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews $DIG +short @10.53.0.4 -p 5300 a.example > dig.out
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I:checking reopened unix socket message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews udp4=`$DNSTAPREAD dnstap.out | grep "UDP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews tcp4=`$DNSTAPREAD dnstap.out | grep "TCP " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews aq4=`$DNSTAPREAD dnstap.out | grep "AQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews ar4=`$DNSTAPREAD dnstap.out | grep "AR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cq4=`$DNSTAPREAD dnstap.out | grep "CQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews cr4=`$DNSTAPREAD dnstap.out | grep "CR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rq4=`$DNSTAPREAD dnstap.out | grep "RQ " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews rr4=`$DNSTAPREAD dnstap.out | grep "RR " | wc -l`
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking UDP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking TCP message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking AUTH_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking CLIENT_RESPONSE message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_QUERY message counts"
15bee593e70faca91a00331184fbbbc66080d422Mark Andrews echo "I: checking RESOLVER_RESPONSE message counts"
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Huntecho "I:exit status: $status"