mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
wgengine: update comments, remove redundant code in forceFullWireguardConfig
Change-Id: I464a0bce36e3a362c7d7ace0e8d2dd77fa825ee2 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
d34dd43562
commit
33ee2c058e
@ -44,7 +44,6 @@
|
|||||||
"tailscale.com/util/clientmetric"
|
"tailscale.com/util/clientmetric"
|
||||||
"tailscale.com/util/deephash"
|
"tailscale.com/util/deephash"
|
||||||
"tailscale.com/util/mak"
|
"tailscale.com/util/mak"
|
||||||
"tailscale.com/version"
|
|
||||||
"tailscale.com/wgengine/filter"
|
"tailscale.com/wgengine/filter"
|
||||||
"tailscale.com/wgengine/magicsock"
|
"tailscale.com/wgengine/magicsock"
|
||||||
"tailscale.com/wgengine/monitor"
|
"tailscale.com/wgengine/monitor"
|
||||||
@ -537,12 +536,18 @@ func (e *userspaceEngine) pollResolver() {
|
|||||||
|
|
||||||
var debugTrimWireguard = envknob.OptBool("TS_DEBUG_TRIM_WIREGUARD")
|
var debugTrimWireguard = envknob.OptBool("TS_DEBUG_TRIM_WIREGUARD")
|
||||||
|
|
||||||
// forceFullWireguardConfig reports whether we should give wireguard
|
// forceFullWireguardConfig reports whether we should give wireguard our full
|
||||||
// our full network map, even for inactive peers
|
// network map, even for inactive peers.
|
||||||
//
|
//
|
||||||
// TODO(bradfitz): remove this after our 1.0 launch; we don't want to
|
// TODO(bradfitz): remove this at some point. We had a TODO to do it before 1.0
|
||||||
// enable wireguard config trimming quite yet because it just landed
|
// but it's still there as of 1.30. Really we should not do this wireguard lazy
|
||||||
// and we haven't got enough time testing it.
|
// peer config at all and just fix wireguard-go to not have so much extra memory
|
||||||
|
// usage per peer. That would simplify a lot of Tailscale code. OTOH, we have 50
|
||||||
|
// MB of memory on iOS now instead of 15 MB, so the other option is to just give
|
||||||
|
// up on lazy wireguard config and blow the memory and hope for the best on iOS.
|
||||||
|
// That's sad too. Or we get rid of these knobs (lazy wireguard config has been
|
||||||
|
// stable!) but I'm worried that a future regression would be easier to debug
|
||||||
|
// with these knobs in place.
|
||||||
func forceFullWireguardConfig(numPeers int) bool {
|
func forceFullWireguardConfig(numPeers int) bool {
|
||||||
// Did the user explicitly enable trimmming via the environment variable knob?
|
// Did the user explicitly enable trimmming via the environment variable knob?
|
||||||
if b, ok := debugTrimWireguard.Get(); ok {
|
if b, ok := debugTrimWireguard.Get(); ok {
|
||||||
@ -551,13 +556,6 @@ func forceFullWireguardConfig(numPeers int) bool {
|
|||||||
if opt := controlclient.TrimWGConfig(); opt != "" {
|
if opt := controlclient.TrimWGConfig(); opt != "" {
|
||||||
return !opt.EqualBool(true)
|
return !opt.EqualBool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// On iOS with large networks, it's critical, so turn on trimming.
|
|
||||||
// Otherwise we run out of memory from wireguard-go goroutine stacks+buffers.
|
|
||||||
// This will be the default later for all platforms and network sizes.
|
|
||||||
if numPeers > 50 && version.OS() == "iOS" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user