~stepbrobd/tailscale

634cc2ba4a03714173f23915e933f9eed918c137 — Brad Fitzpatrick a month ago d09e9d9
wgengine/netstack: remove unused taildrive deps

A filesystem was plumbed into netstack in 993acf4475b22d693
but hasn't been used since 2d5d6f5403f3. Remove it.

Noticed while rebasing a Tailscale fork elsewhere.

Updates tailscale/corp#16827

Change-Id: Ib76deeda205ffe912b77a59b9d22853ebff42813
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
M cmd/tailscaled/tailscaled.go => cmd/tailscaled/tailscaled.go +0 -2
@@ 788,7 788,6 @@ func runDebugServer(mux *http.ServeMux, addr string) {
}

func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) {
	tfs, _ := sys.DriveForLocal.GetOK()
	ret, err := netstack.Create(logf,
		sys.Tun.Get(),
		sys.Engine.Get(),


@@ 796,7 795,6 @@ func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) {
		sys.Dialer.Get(),
		sys.DNSManager.Get(),
		sys.ProxyMapper(),
		tfs,
	)
	if err != nil {
		return nil, err

M cmd/tsconnect/wasm/wasm_js.go => cmd/tsconnect/wasm/wasm_js.go +1 -1
@@ 115,7 115,7 @@ func newIPN(jsConfig js.Value) map[string]any {
	}
	sys.Set(eng)

	ns, err := netstack.Create(logf, sys.Tun.Get(), eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper(), nil)
	ns, err := netstack.Create(logf, sys.Tun.Get(), eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper())
	if err != nil {
		log.Fatalf("netstack.Create: %v", err)
	}

M tsnet/tsnet.go => tsnet/tsnet.go +1 -1
@@ 546,7 546,7 @@ func (s *Server) start() (reterr error) {
	sys.HealthTracker().SetMetricsRegistry(sys.UserMetricsRegistry())

	// TODO(oxtoacart): do we need to support Taildrive on tsnet, and if so, how?
	ns, err := netstack.Create(tsLogf, sys.Tun.Get(), eng, sys.MagicSock.Get(), s.dialer, sys.DNSManager.Get(), sys.ProxyMapper(), nil)
	ns, err := netstack.Create(tsLogf, sys.Tun.Get(), eng, sys.MagicSock.Get(), s.dialer, sys.DNSManager.Get(), sys.ProxyMapper())
	if err != nil {
		return fmt.Errorf("netstack.Create: %w", err)
	}

M wgengine/netstack/netstack.go => wgengine/netstack/netstack.go +13 -16
@@ 32,7 32,6 @@ import (
	"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
	"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
	"gvisor.dev/gvisor/pkg/waiter"
	"tailscale.com/drive"
	"tailscale.com/envknob"
	"tailscale.com/ipn/ipnlocal"
	"tailscale.com/metrics"


@@ 174,19 173,18 @@ type Impl struct {
	// It can only be set before calling Start.
	ProcessSubnets bool

	ipstack       *stack.Stack
	linkEP        *linkEndpoint
	tundev        *tstun.Wrapper
	e             wgengine.Engine
	pm            *proxymap.Mapper
	mc            *magicsock.Conn
	logf          logger.Logf
	dialer        *tsdial.Dialer
	ctx           context.Context        // alive until Close
	ctxCancel     context.CancelFunc     // called on Close
	lb            *ipnlocal.LocalBackend // or nil
	dns           *dns.Manager
	driveForLocal drive.FileSystemForLocal // or nil
	ipstack   *stack.Stack
	linkEP    *linkEndpoint
	tundev    *tstun.Wrapper
	e         wgengine.Engine
	pm        *proxymap.Mapper
	mc        *magicsock.Conn
	logf      logger.Logf
	dialer    *tsdial.Dialer
	ctx       context.Context        // alive until Close
	ctxCancel context.CancelFunc     // called on Close
	lb        *ipnlocal.LocalBackend // or nil
	dns       *dns.Manager

	// loopbackPort, if non-nil, will enable Impl to loop back (dnat to
	// <address-family-loopback>:loopbackPort) TCP & UDP flows originally


@@ 288,7 286,7 @@ func setTCPBufSizes(ipstack *stack.Stack) error {
}

// Create creates and populates a new Impl.
func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager, pm *proxymap.Mapper, driveForLocal drive.FileSystemForLocal) (*Impl, error) {
func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager, pm *proxymap.Mapper) (*Impl, error) {
	if mc == nil {
		return nil, errors.New("nil magicsock.Conn")
	}


@@ 382,7 380,6 @@ func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magi
		connsInFlightByClient: make(map[netip.Addr]int),
		packetsInFlight:       make(map[stack.TransportEndpointID]struct{}),
		dns:                   dns,
		driveForLocal:         driveForLocal,
	}
	loopbackPort, ok := envknob.LookupInt("TS_DEBUG_NETSTACK_LOOPBACK_PORT")
	if ok && loopbackPort >= 0 && loopbackPort <= math.MaxUint16 {

M wgengine/netstack/netstack_test.go => wgengine/netstack/netstack_test.go +2 -2
@@ 65,7 65,7 @@ func TestInjectInboundLeak(t *testing.T) {
		t.Fatal(err)
	}

	ns, err := Create(logf, tunWrap, eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper(), nil)
	ns, err := Create(logf, tunWrap, eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper())
	if err != nil {
		t.Fatal(err)
	}


@@ 116,7 116,7 @@ func makeNetstack(tb testing.TB, config func(*Impl)) *Impl {
	tb.Cleanup(func() { eng.Close() })
	sys.Set(eng)

	ns, err := Create(logf, sys.Tun.Get(), eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper(), nil)
	ns, err := Create(logf, sys.Tun.Get(), eng, sys.MagicSock.Get(), dialer, sys.DNSManager.Get(), sys.ProxyMapper())
	if err != nil {
		tb.Fatal(err)
	}