Skip to content

Commit

Permalink
dns64: Fall back to plain AAAA query with synthall but no A records
Browse files Browse the repository at this point in the history
Networks which only have tunneled IPv6 access but still want to go
IPv6-only internally can use unbound's DNS64 module together with the
dns64-synthall or dns64-ignore-aaaa options to direct most traffic (any
dualstack domain) to their NAT64.

There is only one problem with this setup, currently domains with only AAAA
records will fail to resolve.

To allow for this use-case arrange for the A sub-query to make the AAAA
super query advance along the module stack when no records are returned.

Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
  • Loading branch information
Daniel Gröber via Unbound-users authored and gthess committed Oct 18, 2023
1 parent dd086e5 commit c1e5e67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dns64/dns64.c
Expand Up @@ -982,6 +982,17 @@ dns64_inform_super(struct module_qstate* qstate, int id,
return;
}

/* When no A record is found for synthesis fall back to AAAA again. */
if (qstate->qinfo.qtype == LDNS_RR_TYPE_A &&
qstate->return_rcode == LDNS_RCODE_NOERROR &&
!( qstate->return_msg &&
qstate->return_msg->rep &&
reply_find_answer_rrset(&qstate->qinfo, qstate->return_msg->rep)))
{
super_dq->state = DNS64_INTERNAL_QUERY;
return;
}

/* Use return code from A query in response to client. */
if (super->return_rcode != LDNS_RCODE_NOERROR)
super->return_rcode = qstate->return_rcode;
Expand Down

0 comments on commit c1e5e67

Please sign in to comment.