Check that dig/host/nslookup handle a UPDATE response.

Additionally check that "delete $qname SOA" in the update
reponse doesn't trigger a insertion in nslookup.

(cherry picked from commit 6593cf0b5a)
This commit is contained in:
Mark Andrews
2020-03-11 15:15:08 +11:00
parent 087cd378c4
commit 0cf72a9414
5 changed files with 118 additions and 0 deletions

View File

@@ -67,8 +67,56 @@ if [ -n "$PYTHON" ] ; then
$PYTHON -c "import yaml" 2> /dev/null && HAS_PYYAML=1
fi
#
# test whether ans7/ans.pl will be able to send a UPDATE response.
# if it can't, we will log that below.
#
if "$PERL" -e 'use Net::DNS; use Net::DNS::Packet; my $p = new Net::DNS::Packet; $p->header->opcode(5);' > /dev/null 2>&1
then
checkupdate=1
else
checkupdate=0
fi
if [ -x "$NSLOOKUP" -a $checkupdate -eq 1 ] ; then
n=$((n+1))
echo_i "check nslookup handles UPDATE response ($n)"
ret=0
"$NSLOOKUP" -q=CNAME "-port=$PORT" foo.bar 10.53.0.7 > nslookup.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" nslookup.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
fi
if [ -x "$HOST" -a $checkupdate -eq 1 ] ; then
n=$((n+1))
echo_i "check host handles UPDATE response ($n)"
ret=0
"$HOST" -t CNAME -p $PORT foo.bar 10.53.0.7 > host.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" host.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
fi
if [ -x "$DIG" ] ; then
if [ $checkupdate -eq 1 ] ; then
n=$((n+1))
echo_i "check dig handles UPDATE response ($n)"
ret=0
dig_with_opts @10.53.0.7 cname foo.bar > dig.out.test$n 2>&1 && ret=1
grep "Opcode mismatch" dig.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
else
echo_i "Skipped UPDATE handling test"
fi
n=$((n+1))
echo_i "checking dig short form works ($n)"
ret=0