Fix RPZ CIDR tree insertion bug (#43035)

(cherry picked from commit 131307a70e)
This commit is contained in:
Mukund Sivaraman
2016-08-15 14:17:02 +05:30
parent d6a0e00dc3
commit 4e9a1ad226
6 changed files with 75 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
; Copyright (C) 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
$TTL 60
@ IN SOA root.ns ns 1996072700 3600 1800 86400 60
NS ns
ns A 127.0.0.1
32.3.0.53.10.rpz-client-ip A 10.53.0.1
31.2.0.53.10.rpz-client-ip CNAME .

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
# common configuration
include "named.conf.header";
view "recursive" {
zone "." {
type hint;
file "root.hint";
};
servfail-ttl 0;
# policy configuration to be tested
response-policy {
zone "clientip21";
} qname-wait-recurse no;
# policy zones to be tested
zone "clientip21" { type master; file "db.clientip21"; };
};

View File

@@ -237,6 +237,35 @@ grep "^l2.l1.l0.[ ]*[0-9]*[ ]*IN[ ]*A[ ]*10.53.0.2" dig.out.${t} > /dev/null
status=1
}
# Check CLIENT-IP behavior #2
t=`expr $t + 1`
echo "I:testing CLIENT-IP behavior #2 (${t})"
run_server clientip2
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.1 > dig.out.${t}.1
grep "status: SERVFAIL" dig.out.${t}.1 > /dev/null 2>&1 || {
echo "I:test $t failed: query failed"
status=1
}
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 > dig.out.${t}.2
grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null 2>&1 || {
echo "I:test $t failed: query failed"
status=1
}
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 > dig.out.${t}.3
grep "status: NOERROR" dig.out.${t}.3 > /dev/null 2>&1 || {
echo "I:test $t failed: query failed"
status=1
}
grep "^l2.l1.l0.[ ]*[0-9]*[ ]*IN[ ]*A[ ]*10.53.0.1" dig.out.${t}.3 > /dev/null 2>&1 || {
echo "I:test $t failed: didn't get expected answer"
status=1
}
$DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}.4
grep "status: SERVFAIL" dig.out.${t}.4 > /dev/null 2>&1 || {
echo "I:test $t failed: query failed"
status=1
}
# Check RPZ log clause
t=`expr $t + 1`
echo "I:testing RPZ log clause (${t})"