From 7fab244614f1660daab400ab4261cfcdbe5137a6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 20 Apr 2021 18:54:15 -0700 Subject: [PATCH] net/dns/resolver: don't spam logs on EHOSTUNREACH. Fixes #1719. Signed-off-by: David Anderson --- net/dns/resolver/forwarder.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/dns/resolver/forwarder.go b/net/dns/resolver/forwarder.go index 4f5c46095..10854f802 100644 --- a/net/dns/resolver/forwarder.go +++ b/net/dns/resolver/forwarder.go @@ -14,6 +14,7 @@ "math/rand" "net" "sync" + "syscall" "time" dns "golang.org/x/net/dns/dnsmessage" @@ -371,6 +372,12 @@ func (c *fwdConn) send(packet []byte, dst netaddr.IPPort) { backOff(err) continue } + if errors.Is(err, syscall.EHOSTUNREACH) { + // "No route to host." The network stack is fine, but + // can't talk to this destination. Not much we can do + // about that, don't spam logs. + return + } if networkIsDown(err) { // Fail. c.logf("send: network is down")