mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
net/interfaces: don't send over zt* interfaces
Fixes #1208 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
692a011b54
commit
35e10c78fc
@ -10,6 +10,7 @@
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -63,6 +64,18 @@ func maybeTailscaleInterfaceName(s string) bool {
|
|||||||
func isUp(nif *net.Interface) bool { return nif.Flags&net.FlagUp != 0 }
|
func isUp(nif *net.Interface) bool { return nif.Flags&net.FlagUp != 0 }
|
||||||
func isLoopback(nif *net.Interface) bool { return nif.Flags&net.FlagLoopback != 0 }
|
func isLoopback(nif *net.Interface) bool { return nif.Flags&net.FlagLoopback != 0 }
|
||||||
|
|
||||||
|
func isProblematicInterface(nif *net.Interface) bool {
|
||||||
|
name := nif.Name
|
||||||
|
// Don't try to send disco/etc packets over zerotier; they effectively
|
||||||
|
// DoS each other by doing traffic amplification, both of them
|
||||||
|
// preferring/trying to use each other for transport. See:
|
||||||
|
// https://github.com/tailscale/tailscale/issues/1208
|
||||||
|
if strings.HasPrefix(name, "zt") || (runtime.GOOS == "windows" && strings.Contains(name, "ZeroTier")) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// LocalAddresses returns the machine's IP addresses, separated by
|
// LocalAddresses returns the machine's IP addresses, separated by
|
||||||
// whether they're loopback addresses.
|
// whether they're loopback addresses.
|
||||||
func LocalAddresses() (regular, loopback []string, err error) {
|
func LocalAddresses() (regular, loopback []string, err error) {
|
||||||
@ -73,8 +86,10 @@ func LocalAddresses() (regular, loopback []string, err error) {
|
|||||||
}
|
}
|
||||||
for i := range ifaces {
|
for i := range ifaces {
|
||||||
iface := &ifaces[i]
|
iface := &ifaces[i]
|
||||||
if !isUp(iface) {
|
if !isUp(iface) || isProblematicInterface(iface) {
|
||||||
// Down interfaces don't count
|
// Skip down interfaces and ones that are
|
||||||
|
// problematic that we don't want to try to
|
||||||
|
// send Tailscale traffic over.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ifcIsLoopback := isLoopback(iface)
|
ifcIsLoopback := isLoopback(iface)
|
||||||
|
Loading…
Reference in New Issue
Block a user