From: Tomas Krizek Date: Wed, 20 Oct 2021 14:49:48 +0000 (+0200) Subject: policy.rpz: test coverage for SOA-defined origin X-Git-Tag: v5.4.3~17^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02e6a4087bc71a692c5aed5444f2ca03b73b91a6;p=thirdparty%2Fknot-resolver.git policy.rpz: test coverage for SOA-defined origin --- diff --git a/modules/policy/policy.rpz.test.lua b/modules/policy/policy.rpz.test.lua index 047b27f5c..70ef9fb6f 100644 --- a/modules/policy/policy.rpz.test.lua +++ b/modules/policy/policy.rpz.test.lua @@ -44,13 +44,22 @@ local function test_rpz() {'2001:db8::2', '2001:db8::1'}) end +local function test_rpz_soa() + check_answer('"CNAME ." return NXDOMAIN (SOA origin)', + 'nxdomain-fqdn.', kres.type.A, kres.rcode.NXDOMAIN) + check_answer('"CNAME *." return NODATA (SOA origin)', + 'nodata-fqdn.', kres.type.A, kres.rcode.NOERROR, {}) +end + net.ipv4 = false net.ipv6 = false prepare_cache() policy.add(policy.rpz(policy.DENY, 'policy.test.rpz')) +policy.add(policy.rpz(policy.DENY, 'policy.test.rpz.soa')) return { test_rpz, + test_rpz_soa, } diff --git a/modules/policy/policy.test.rpz.soa b/modules/policy/policy.test.rpz.soa new file mode 100644 index 000000000..ad18aa49c --- /dev/null +++ b/modules/policy/policy.test.rpz.soa @@ -0,0 +1,5 @@ +test2domain. SOA nonexistent.test2domain. test2domain. 1 12h 15m 3w 2h + NS nonexistent.test2domain. + +nxdomain-fqdn.test2domain. CNAME . +nodata-fqdn.test2domain. CNAME *.