Commit 59d110fc authored by Daniel Salzman's avatar Daniel Salzman

internet: skip empty non-terminal parents during delegation lookup

parent f31e128e
......@@ -454,9 +454,16 @@ static int name_not_found(knot_pkt_t *pkt, struct query_data *qdata)
return follow_cname(pkt, KNOT_RRTYPE_DNAME, qdata);
}
/* Look up an authoritative encloser or its parent. */
const zone_node_t *node = qdata->encloser;
while (node->rrset_count == 0 || node->flags & NODE_FLAGS_NONAUTH) {
node = node->parent;
assert(node);
}
/* Name is below delegation. */
if ((qdata->encloser->flags & NODE_FLAGS_DELEG)) {
qdata->node = qdata->encloser;
if ((node->flags & NODE_FLAGS_DELEG)) {
qdata->node = node;
return DELEG;
}
......
......@@ -19,6 +19,8 @@ mail A 192.0.2.3
; Delegation of a subdomain
sub NS ns.sub
sub NS sub
sub A 192.0.0.1
ns.sub A 192.0.2.4
; CNAME to A record
......@@ -56,7 +58,6 @@ cname-mx-wc MX 10 cname-wildcard
; MX record leading to CNAME (outside zone)
cname-mx-out MX 10 cname-out
; DNAME subtree
dname DNAME dname-tree
dname-tree A 1.2.3.4
......
......@@ -56,6 +56,11 @@ resp = knot.dig("ns.sub.flags", "A", udp=True)
resp.check(rcode="NOERROR", flags="QR", noflags="AA TC AD RA")
resp.cmp(bind, additional=True)
# Positive (REFERRAL, below delegation, ignoring empty-nonterminal during lookup)
resp = knot.dig("bellow.ns.sub.flags", "A", udp=True)
resp.check(rcode="NOERROR", flags="QR", noflags="AA TC AD RA")
resp.cmp(bind, additional=True)
''' ANY query type. '''
# ANY to SOA record
......
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