wgengine/magicsock: delete unused stuff

Updates tailscale/corp#13464

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/8717/head
David Anderson 1 year ago committed by Dave Anderson
parent 9edb848505
commit c2831f6614

@ -9,8 +9,6 @@ import (
"tailscale.com/envknob" "tailscale.com/envknob"
) )
const linkDebug = true
// Various debugging and experimental tweakables, set by environment // Various debugging and experimental tweakables, set by environment
// variable. // variable.
var ( var (

@ -3983,30 +3983,6 @@ func simpleDur(d time.Duration) time.Duration {
return d.Round(time.Minute) return d.Round(time.Minute)
} }
func sbPrintAddr(sb *strings.Builder, a netip.AddrPort) {
is6 := a.Addr().Is6()
if is6 {
sb.WriteByte('[')
}
fmt.Fprintf(sb, "%s", a.Addr())
if is6 {
sb.WriteByte(']')
}
fmt.Fprintf(sb, ":%d", a.Port())
}
func (c *Conn) derpRegionCodeOfAddrLocked(ipPort string) string {
_, portStr, err := net.SplitHostPort(ipPort)
if err != nil {
return ""
}
regionID, err := strconv.Atoi(portStr)
if err != nil {
return ""
}
return c.derpRegionCodeOfIDLocked(regionID)
}
func (c *Conn) derpRegionCodeOfIDLocked(regionID int) string { func (c *Conn) derpRegionCodeOfIDLocked(regionID int) string {
if c.derpMap == nil { if c.derpMap == nil {
return "" return ""
@ -4074,13 +4050,6 @@ func (c *Conn) SetStatistics(stats *connstats.Statistics) {
c.stats.Store(stats) c.stats.Store(stats)
} }
func ippDebugString(ua netip.AddrPort) string {
if ua.Addr() == derpMagicIPAddr {
return fmt.Sprintf("derp-%d", ua.Port())
}
return ua.String()
}
// endpointSendFunc is a func that writes encrypted Wireguard payloads from // endpointSendFunc is a func that writes encrypted Wireguard payloads from
// WireGuard to a peer. It might write via UDP, DERP, both, or neither. // WireGuard to a peer. It might write via UDP, DERP, both, or neither.
// //
@ -4113,7 +4082,6 @@ type endpoint struct {
// atomically accessed; declared first for alignment reasons // atomically accessed; declared first for alignment reasons
lastRecv mono.Time lastRecv mono.Time
numStopAndResetAtomic int64 numStopAndResetAtomic int64
sendFunc syncs.AtomicValue[endpointSendFunc] // nil or unset means unused
debugUpdates *ringbuffer.RingBuffer[EndpointChange] debugUpdates *ringbuffer.RingBuffer[EndpointChange]
// These fields are initialized once and never modified. // These fields are initialized once and never modified.
@ -4146,7 +4114,6 @@ type endpoint struct {
// implementation that's a WIP as of 2022-10-20. // implementation that's a WIP as of 2022-10-20.
// See #540 for background. // See #540 for background.
heartbeatDisabled bool heartbeatDisabled bool
pathFinderRunning bool
expired bool // whether the node has expired expired bool // whether the node has expired
isWireguardOnly bool // whether the endpoint is WireGuard only isWireguardOnly bool // whether the endpoint is WireGuard only
@ -4539,23 +4506,12 @@ var (
) )
func (de *endpoint) send(buffs [][]byte) error { func (de *endpoint) send(buffs [][]byte) error {
if fn := de.sendFunc.Load(); fn != nil {
return fn(buffs)
}
de.mu.Lock() de.mu.Lock()
if de.expired { if de.expired {
de.mu.Unlock() de.mu.Unlock()
return errExpired return errExpired
} }
// if heartbeat disabled, kick off pathfinder
if de.heartbeatDisabled {
if !de.pathFinderRunning {
de.startPathFinder()
}
}
now := mono.Now() now := mono.Now()
udpAddr, derpAddr, startWGPing := de.addrForSendLocked(now) udpAddr, derpAddr, startWGPing := de.addrForSendLocked(now)
@ -4912,9 +4868,6 @@ func (de *endpoint) updateFromNode(n *tailcfg.Node, heartbeatDisabled bool) {
de.deleteEndpointLocked("updateFromNode", ep) de.deleteEndpointLocked("updateFromNode", ep)
} }
} }
// Node changed. Invalidate its sending fast path, if any.
de.sendFunc.Store(nil)
} }
// addCandidateEndpoint adds ep as an endpoint to which we should send // addCandidateEndpoint adds ep as an endpoint to which we should send

@ -31,10 +31,6 @@ func getGSOSizeFromControl(control []byte) (int, error) {
func setGSOSizeInControl(control *[]byte, gso uint16) {} func setGSOSizeInControl(control *[]byte, gso uint16) {}
func errShouldDisableOffload(err error) bool {
return false
}
const ( const (
controlMessageSize = 0 controlMessageSize = 0
) )

@ -1,12 +0,0 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package magicsock
// startPathFinder initializes the atomicSendFunc, and
// will eventually kick off a goroutine that monitors whether
// that sendFunc is still the best option for the endpoint
// to use and adjusts accordingly.
func (de *endpoint) startPathFinder() {
de.pathFinderRunning = true
}
Loading…
Cancel
Save