net/netns: set the bypass socket mark on linux.

This allows tailscaled's own traffic to bypass Tailscale-managed routes,
so that things like tailscale-provided default routes don't break
tailscaled itself.

Progress on #144.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-05-29 00:43:15 +00:00
committed by Dave Anderson
parent 3fa58303d0
commit 5114df415e
8 changed files with 92 additions and 8 deletions
+5
View File
@@ -26,6 +26,7 @@ import (
"tailscale.com/derp"
"tailscale.com/derp/derphttp"
"tailscale.com/derp/derpmap"
"tailscale.com/net/netns"
"tailscale.com/net/stun/stuntest"
"tailscale.com/tailcfg"
"tailscale.com/tstest"
@@ -35,6 +36,10 @@ import (
"tailscale.com/wgengine/tstun"
)
func init() {
netns.TestOnlySkipPrivilegedOps()
}
// WaitReady waits until the magicsock is entirely initialized and connected
// to its home DERP server. This is normally not necessary, since magicsock
// is intended to be entirely asynchronous, but it helps eliminate race
+3
View File
@@ -44,6 +44,9 @@ const (
tailscaleSubnetRouteMark = "0x10000"
// Packet was originated by tailscaled itself, and must not be
// routed over the Tailscale network.
//
// Keep this in sync with tailscaleBypassMark in
// net/netns/netns_linux.go.
tailscaleBypassMark = "0x20000"
)
+5
View File
@@ -11,10 +11,15 @@ import (
"testing"
"time"
"tailscale.com/net/netns"
"tailscale.com/wgengine/router"
"tailscale.com/wgengine/tstun"
)
func init() {
netns.TestOnlySkipPrivilegedOps()
}
func TestWatchdog(t *testing.T) {
t.Parallel()