]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix ip_ratelimit test to work with dig that enables DNS cookies.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 17 Aug 2023 13:43:14 +0000 (15:43 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 17 Aug 2023 13:43:14 +0000 (15:43 +0200)
doc/Changelog
testdata/ip_ratelimit.tdir/ip_ratelimit.test

index 28534141751931edb05654075ec23aae3ca00258..15625c23cd16b350530111b14751bc627845b42a 100644 (file)
@@ -10,6 +10,7 @@
          `queries_cookie_invalid` information. The `ip\-ratelimit\-cookie:`
          value determines a rate limit for queries with cookies, if desired.
        - Fix regional_alloc_init for potential unaligned source of the copy.
+       - Fix ip_ratelimit test to work with dig that enables DNS cookies.
 
 2 August 2023: George
        - Move a cache reply callback in worker.c closer to the cache reply
index 7af7d108c31180c4ec30cccae28ea7dba5532ff7..f58b7edcbe2a88d976689fc8b067fa820e884166 100644 (file)
@@ -15,8 +15,14 @@ get_make
 total_runs=6
 success_threshold=4  # 2/3*total_runs
 
+if dig -h 2>&1 | grep "cookie" >/dev/null; then
+       nocookie="+nocookie"
+else
+       nocookie=""
+fi
+
 echo "> First get a valid cookie"
-dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:0102030405060708 +tcp +retry=0 +time=1 test. TXT >outfile 2>&1
+dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:0102030405060708 $nocookie +tcp +retry=0 +time=1 test. TXT >outfile 2>&1
 if test "$?" -ne 0; then
        echo "exit status not OK"
        echo "> cat logfiles"
@@ -56,7 +62,7 @@ for i in $(seq 1 $total_runs); do
                exit 1
        fi
        # Expect no answer because of limit
-       dig @127.0.0.1 -p $UNBOUND_PORT +retry=0 +time=1 test. TXT >outfile 2>&1
+       dig @127.0.0.1 -p $UNBOUND_PORT $nocookie +retry=0 +time=1 test. TXT >outfile 2>&1
        if test "$?" -eq 0; then
                continue
        fi
@@ -71,7 +77,7 @@ for i in $(seq 1 $total_runs); do
                exit 1
        fi
        # Expect answer because of DNS cookie
-       dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$cookie +retry=0 +time=1 test. TXT >outfile 2>&1
+       dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$cookie $nocookie +retry=0 +time=1 test. TXT >outfile 2>&1
        if test "$?" -ne 0; then
                continue
        fi
@@ -118,7 +124,7 @@ for i in $(seq 1 $total_runs); do
                exit 1
        fi
        # Expect no answer because of limit
-       dig @127.0.0.1 -p $UNBOUND_PORT +retry=0 +time=1 test. TXT >outfile 2>&1
+       dig @127.0.0.1 -p $UNBOUND_PORT $nocookie +retry=0 +time=1 test. TXT >outfile 2>&1
        if test "$?" -eq 0; then
                continue
        fi
@@ -133,7 +139,7 @@ for i in $(seq 1 $total_runs); do
                exit 1
        fi
        # Expect no answer because of ip-ratelimit-cookie
-       dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$cookie +retry=0 +time=1 test. TXT >outfile 2>&1
+       dig @127.0.0.1 -p $UNBOUND_PORT +ednsopt=10:$cookie $nocookie +retry=0 +time=1 test. TXT >outfile 2>&1
        if test "$?" -eq 0; then
                continue
        fi