mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
8b11937eaf
This raises the maximum DNS response message size from 512 to 4095. This should be large enough for almost all situations that do not need TCP. We still do not recognize EDNS, so we will still forward requests that claim support for a larger response size than 4095 (that will be solved later). For now, when a response comes back that is too large to fit in our receive buffer, we now set the truncation flag in the DNS header, which is an improvement from before but will prompt attempts to use TCP which isn't supported yet. On Windows, WSARecvFrom into a buffer that's too small returns an error in addition to the data. On other OSes, the extra data is silently discarded. In this case, we prefer the latter so need to catch the error on Windows. Partially addresses #1123 Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
31 lines
816 B
Go
31 lines
816 B
Go
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package resolver
|
|
|
|
import (
|
|
"errors"
|
|
"syscall"
|
|
)
|
|
|
|
// Avoid allocation when calling errors.Is below
|
|
// by converting syscall.Errno to error here.
|
|
var (
|
|
networkDown error = syscall.ENETDOWN
|
|
networkUnreachable error = syscall.ENETUNREACH
|
|
)
|
|
|
|
func networkIsDown(err error) bool {
|
|
return errors.Is(err, networkDown)
|
|
}
|
|
|
|
func networkIsUnreachable(err error) bool {
|
|
return errors.Is(err, networkUnreachable)
|
|
}
|
|
|
|
// packetWasTruncated returns true if err indicates truncation but the RecvFrom
|
|
// that generated err was otherwise successful. It always returns false on this
|
|
// platform.
|
|
func packetWasTruncated(err error) bool { return false }
|