mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 11:35:35 +00:00
171ec9f8f4
From integration tests elsewhere: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x845c9b] goroutine 226 [running]: tailscale.com/control/controlclient.(*Direct).sendMapRequest(0xc00053e1e0, 0x16670f0, 0xc000353780, 0xffffffffffffffff, 0xc0003e5f10, 0x0, 0x0) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:803 +0x19bb tailscale.com/control/controlclient.(*Direct).PollNetMap(...) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:574 tailscale.com/control/controlclient.(*Auto).mapRoutine(0xc00052a1e0) /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:464 +0x571 created by tailscale.com/control/controlclient.(*Auto).Start /home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:151 +0x65 exit status 2 Also remove types/opt.Bool API addition which is now unnecessary. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
35 lines
912 B
Go
35 lines
912 B
Go
// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package controlknobs contains client options configurable from control which can be turned on
|
|
// or off. The ability to turn options on and off is for incrementally adding features in.
|
|
package controlknobs
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
|
|
"tailscale.com/syncs"
|
|
)
|
|
|
|
// disableUPnP indicates whether to attempt UPnP mapping.
|
|
var disableUPnP syncs.AtomicBool
|
|
|
|
func init() {
|
|
v, _ := strconv.ParseBool(os.Getenv("TS_DISABLE_UPNP"))
|
|
SetDisableUPnP(v)
|
|
}
|
|
|
|
// DisableUPnP reports the last reported value from control
|
|
// whether UPnP portmapping should be disabled.
|
|
func DisableUPnP() bool {
|
|
return disableUPnP.Get()
|
|
}
|
|
|
|
// SetDisableUPnP sets whether control says that UPnP should be
|
|
// disabled.
|
|
func SetDisableUPnP(v bool) {
|
|
disableUPnP.Set(v)
|
|
}
|