]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix stat_values test to work with dig that enables DNS cookies.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 18 Aug 2023 11:39:27 +0000 (13:39 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 18 Aug 2023 11:39:27 +0000 (13:39 +0200)
doc/Changelog
testdata/stat_values.tdir/stat_values.test

index 0940aafa68bbf8b2f37c21ae18102b08eeba96f5..54e3ae138681ffd2194c0cc830f197c0be327e32 100644 (file)
@@ -2,6 +2,7 @@
        - Fix for iter_dec_attempts that could cause a hang, part of
          capsforid and qname minimisation, depending on the settings.
        - Fix uninitialized memory passed in padding bytes of cmsg to sendmsg.
+       - Fix stat_values test to work with dig that enables DNS cookies.
 
 17 August 2023: Wouter
        - Merge PR #762: Downstream DNS Server Cookies a la RFC7873 and
index 8366ba88b926e479167e0d2206b66c0359d83a2d..22d55f1f0d31b13a7c43ddbb44cc2cb831286fdc 100644 (file)
@@ -52,6 +52,12 @@ REST_STATS_FILE=rest_stats.$$
 
 DEBUG=0
 
+if dig -h 2>&1 | grep "cookie" >/dev/null; then
+       nocookie="+nocookie"
+else
+       nocookie=""
+fi
+
 # Write stats to $STATS_FILE.
 # Call this when you want to get stats from unbound.
 get_stats () {
@@ -416,6 +422,9 @@ infra.cache.count=2"
 
 # Bring the downstream DNS Cookies configured Unbound up
 kill_pid $UNBOUND_PID  # kill current Unbound
+echo ""
+cat unbound.log
+echo ""
 $PRE/unbound -d -c ub_downstream_cookies.conf >unbound.log 2>&1 &
 UNBOUND_PID=$!
 echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
@@ -423,8 +432,8 @@ wait_unbound_up unbound.log
 
 echo
 echo "[ Get a DNS Cookie. ]"
-echo "> dig www.local.zone +tcp +ednsopt=10:0102030405060708"
-dig @127.0.0.1 -p $UNBOUND_PORT +tcp +ednsopt=10:0102030405060708 +retry=0 +time=1 www.local.zone. | tee outfile
+echo "> dig www.local.zone +tcp $nocookie +ednsopt=10:0102030405060708"
+dig @127.0.0.1 -p $UNBOUND_PORT +tcp $nocookie +ednsopt=10:0102030405060708 +retry=0 +time=1 www.local.zone. | tee outfile
 echo "> check answer"
 if grep "192.0.2.1" outfile; then
        echo "OK"
@@ -449,8 +458,8 @@ num.answer.rcode.NOERROR=1"
 
 echo
 echo "[ Present the valid DNS Cookie. ]"
-echo "> dig www.local.zone +ednsopt=10:valid_cookie"
-dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$valid_cookie +retry=0 +time=1 www.local.zone. | tee outfile
+echo "> dig www.local.zone $nocookie +ednsopt=10:valid_cookie"
+dig @127.0.0.1 -p $UNBOUND_PORT $nocookie +ednsopt=10:$valid_cookie +retry=0 +time=1 www.local.zone. | tee outfile
 echo "> check answer"
 if grep "192.0.2.1" outfile; then
        echo "OK"
@@ -471,8 +480,8 @@ num.answer.rcode.NOERROR=1"
 
 echo
 echo "[ Present an invalid DNS Cookie. ]"
-echo "> dig www.local.zone +ednsopt=10:invalid_cookie"
-dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$invalid_cookie +retry=0 +time=1 www.local.zone. | tee outfile
+echo "> dig www.local.zone $nocookie +ednsopt=10:invalid_cookie"
+dig @127.0.0.1 -p $UNBOUND_PORT $nocookie +ednsopt=10:$invalid_cookie +retry=0 +time=1 www.local.zone. | tee outfile
 echo "> check answer"
 if grep "192.0.2.1" outfile; then
        end 1
@@ -491,7 +500,7 @@ num.answer.rcode.YXRRSET=1"
 echo
 echo "[ Present no DNS Cookie. ]"
 echo "> dig www.local.zone +ignore"
-dig @127.0.0.1 -p $UNBOUND_PORT +ignore +retry=0 +time=1 www.local.zone. | tee outfile
+dig @127.0.0.1 -p $UNBOUND_PORT +ignore $nocookie +retry=0 +time=1 www.local.zone. | tee outfile
 echo "> check answer"
 if grep "192.0.2.1" outfile; then
        end 1
@@ -509,6 +518,9 @@ if test x$USE_CACHEDB = "x1"; then
 
 # Bring the cachedb configured Unbound up
 kill_pid $UNBOUND_PID  # kill current Unbound
+echo ""
+cat unbound.log
+echo ""
 $PRE/unbound -d -c ub_cachedb.conf >unbound.log 2>&1 &
 UNBOUND_PID=$!
 echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test