Commit 5e74c14b authored by Marek Vavrusa's avatar Marek Vavrusa

nameserver: fixed query to wildcard expansion -> apex

Added test cases for this and previous commit.

Conflicts:
	src/libknot/nameserver/name-server.c
parent 4f783ff2
......@@ -35,8 +35,6 @@ static knot_dname_t *ns_next_closer(const knot_dname_t *closest_encloser,
int ce_labels = knot_dname_labels(closest_encloser, NULL);
int qname_labels = knot_dname_labels(name, NULL);
assert(ce_labels < qname_labels);
// the common labels should match
assert(knot_dname_matched_labels(closest_encloser, name)
== ce_labels);
......@@ -701,7 +699,8 @@ static int ns_put_nsec_nsec3_nodata(const knot_node_t *node,
closest_encloser, resp);
}
if (knot_dname_is_wildcard(node->owner)) {
/* Query for wildcard is not a RFC5155 7.2.6 'Wildcard Answer Response' */
if (!knot_dname_is_wildcard(qname) && knot_dname_is_wildcard(node->owner)) {
return ns_put_nsec_nsec3_wildcard_nodata(node, closest_encloser,
previous, zone, qname,
resp);
......
......@@ -23,3 +23,4 @@ xx.example. 3600 IN A 192.0.2.10
xx.example. 3600 IN HINFO "KLH-10" "TOPS-20"
xx.example. 3600 IN AAAA 2001:db8::f00:baaa
x.w.example. 3600 IN MX 1 xx.example.
*.to-apex.example. 3600 IN CNAME example. ; Wildcard expansion leading to apex
......@@ -51,7 +51,22 @@ resp = knot.dig("a.z.w.example", "AAAA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B8. DS Child Zone No Data Error.
# B8. Wildcard Expansion to apex
resp = knot.dig("a.to-apex.example", "SOA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B9. Direct wildcard query (positive)
resp = knot.dig("*.w.example", "MX", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B10. Direct wildcard query (no data)
resp = knot.dig("*.w.example", "AAAA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B11. DS Child Zone No Data Error.
resp = knot.dig("example", "DS", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
......
......@@ -51,7 +51,22 @@ resp = knot.dig("a.z.w.example", "AAAA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B8. DS Child Zone No Data Error.
# B8. Wildcard Expansion to apex
resp = knot.dig("a.to-apex.example", "SOA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B9. Direct wildcard query (positive)
resp = knot.dig("*.w.example", "MX", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B10. Direct wildcard query (no data)
resp = knot.dig("*.w.example", "AAAA", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
# B11. DS Child Zone No Data Error.
resp = knot.dig("example", "DS", dnssec=True)
resp.check(rcode="NOERROR", flags="QR AA", eflags="DO")
resp.cmp(bind)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment