OS resolver retry should respect the leak_on_upstream_failure config option

This commit is contained in:
Alex
2025-02-13 13:50:07 -05:00
committed by Cuong Manh Le
parent dc433f8dc9
commit 7929aafe2a

View File

@@ -640,19 +640,20 @@ func (p *prog) proxy(ctx context.Context, req *proxyRequest) *proxyResponse {
} else { } else {
mainLog.Load().Debug().Msg("One upstream is down but at least one is healthy; skipping recovery trigger") mainLog.Load().Debug().Msg("One upstream is down but at least one is healthy; skipping recovery trigger")
} }
}
// attempt query to OS resolver while as a retry catch all // attempt query to OS resolver while as a retry catch all
if upstreams[0] != upstreamOS { // we dont want this to happen if leakOnUpstreamFailure is false
ctrld.Log(ctx, mainLog.Load().Debug(), "attempting query to OS resolver as a retry catch all") if upstreams[0] != upstreamOS {
answer := resolve(upstreamOS, osUpstreamConfig, req.msg) ctrld.Log(ctx, mainLog.Load().Debug(), "attempting query to OS resolver as a retry catch all")
if answer != nil { answer := resolve(upstreamOS, osUpstreamConfig, req.msg)
ctrld.Log(ctx, mainLog.Load().Debug(), "OS resolver retry query successful") if answer != nil {
res.answer = answer ctrld.Log(ctx, mainLog.Load().Debug(), "OS resolver retry query successful")
res.upstream = osUpstreamConfig.Endpoint res.answer = answer
return res res.upstream = osUpstreamConfig.Endpoint
return res
}
ctrld.Log(ctx, mainLog.Load().Debug(), "OS resolver retry query failed")
} }
ctrld.Log(ctx, mainLog.Load().Debug(), "OS resolver retry query failed")
} }
answer := new(dns.Msg) answer := new(dns.Msg)