Pass unmatched queries on configured domain to recursive erver.

pull/21784/head
Travis Dent 2 months ago
parent bfc25b1757
commit 3798b738b8

@ -577,11 +577,20 @@ func (d *DNSServer) handleQuery(resp dns.ResponseWriter, req *dns.Msg) {
default: default:
err = d.dispatch(resp.RemoteAddr(), req, m, cfg, maxRecursionLevelDefault) err = d.dispatch(resp.RemoteAddr(), req, m, cfg, maxRecursionLevelDefault)
rCode := rCodeFromError(err) if errors.Is(err, errNameNotFound) {
if rCode == dns.RcodeNameError || errors.Is(err, errNoData) { // Name matches the configured (root) domain, but doesn't match any nodes.
d.addSOAToMessage(cfg, m, q.Name) // Pass upstream to be handled by recursion server, if available.
if m.RecursionAvailable {
d.logger.Debug("request passed to recursor", "name", q.Name)
d.handleRecurse(resp, req)
}
} else {
rCode := rCodeFromError(err)
if rCode == dns.RcodeNameError || errors.Is(err, errNoData) {
d.addSOAToMessage(cfg, m, q.Name)
}
m.SetRcode(req, rCode)
} }
m.SetRcode(req, rCode)
} }
setEDNS(req, m, !errors.Is(err, errECSNotGlobal)) setEDNS(req, m, !errors.Is(err, errECSNotGlobal))

Loading…
Cancel
Save