diff --git a/core/dnsserver/listen_go111.go b/core/dnsserver/listen_go111.go index 3d730df8e..d71c9292b 100644 --- a/core/dnsserver/listen_go111.go +++ b/core/dnsserver/listen_go111.go @@ -8,19 +8,17 @@ import ( "net" "syscall" + "github.com/coredns/coredns/plugin/pkg/log" "golang.org/x/sys/unix" ) -const supportsReusePort = true - -func reuseportControl(network, address string, c syscall.RawConn) (opErr error) { - err := c.Control(func(fd uintptr) { - opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) +func reuseportControl(network, address string, c syscall.RawConn) error { + c.Control(func(fd uintptr) { + if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil { + log.Warningf("Failed to set SO_REUSEPORT on socket: %s", err) + } }) - if err != nil { - return err - } - return opErr + return nil } func listen(network, addr string) (net.Listener, error) {