summaryrefslogtreecommitdiffhomepage
path: root/wgengine/netstack/netstack.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2026-03-07 18:33:02 +0000
committerBrad Fitzpatrick <bradfitz@tailscale.com>2026-03-07 18:33:02 +0000
commit7b081a98bdbce817a2b3e7929d6a8c7f1c551b35 (patch)
tree5598f046f24c82fd16f8cca1379e380da1d06e92 /wgengine/netstack/netstack.go
parente400d5aa7b22ef131d2b05a1df89177f87dd3922 (diff)
downloadtailscale-dctp1.tar.xz
tailscale-dctp1.zip
all: add some experimental hooksdctp1dctp-1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'wgengine/netstack/netstack.go')
-rw-r--r--wgengine/netstack/netstack.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/wgengine/netstack/netstack.go b/wgengine/netstack/netstack.go
index 59c261345..1db9fb26f 100644
--- a/wgengine/netstack/netstack.go
+++ b/wgengine/netstack/netstack.go
@@ -604,14 +604,13 @@ type LocalBackend = any
// Start sets up all the handlers so netstack can start working. Implements
// wgengine.FakeImpl.
func (ns *Impl) Start(b LocalBackend) error {
- if b == nil {
- panic("nil LocalBackend interface")
- }
- lb := b.(*ipnlocal.LocalBackend)
- if lb == nil {
- panic("nil LocalBackend")
+ if b != nil {
+ lb, ok := b.(*ipnlocal.LocalBackend)
+ if !ok || lb == nil {
+ panic("non-nil LocalBackend is not *ipnlocal.LocalBackend")
+ }
+ ns.lb = lb
}
- ns.lb = lb
tcpFwd := tcp.NewForwarder(ns.ipstack, tcpRXBufDefSize, maxInFlightConnectionAttempts(), ns.acceptTCP)
udpFwd := udp.NewForwarder(ns.ipstack, ns.acceptUDPNoICMP)
ns.ipstack.SetTransportProtocolHandler(tcp.ProtocolNumber, ns.wrapTCPProtocolHandler(tcpFwd.HandlePacket))
@@ -906,7 +905,7 @@ func (ns *Impl) handleLocalPackets(p *packet.Parsed, t *tstun.Wrapper, gro *gro.
return filter.DropSilently, gro
}
-func (ns *Impl) DialContextTCP(ctx context.Context, ipp netip.AddrPort) (*gonet.TCPConn, error) {
+func (ns *Impl) DialContextTCP(ctx context.Context, ipp netip.AddrPort) (net.Conn, error) {
remoteAddress := tcpip.FullAddress{
NIC: nicID,
Addr: tcpip.AddrFromSlice(ipp.Addr().AsSlice()),