mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-24 00:18:20 -05:00
net/netns: remove spammy logs for interface binding caps
fixes tailscale/tailscale#17990 The logging for the netns caps is spammy. Log only on changes to the values and don't log Darwin specific stuff on non Darwin clients. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
7d19813618
commit
682172ca2d
@@ -17,6 +17,7 @@
|
||||
"context"
|
||||
"net"
|
||||
"net/netip"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
|
||||
"tailscale.com/net/netknob"
|
||||
@@ -40,8 +41,9 @@ func SetEnabled(on bool) {
|
||||
//
|
||||
// Currently, this only changes the behaviour on macOS and Windows.
|
||||
func SetBindToInterfaceByRoute(logf logger.Logf, v bool) {
|
||||
logf("netns: bindToInterfaceByRoute to %v", v)
|
||||
bindToInterfaceByRoute.Store(v)
|
||||
if bindToInterfaceByRoute.Swap(v) != v {
|
||||
logf("netns: bindToInterfaceByRoute changed to %v", v)
|
||||
}
|
||||
}
|
||||
|
||||
var disableBindConnToInterface atomic.Bool
|
||||
@@ -54,8 +56,9 @@ func SetBindToInterfaceByRoute(logf logger.Logf, v bool) {
|
||||
// SetDisableBindConnToInterfaceAppleExt which will disable explicit interface
|
||||
// binding only when tailscaled is running inside a network extension process.
|
||||
func SetDisableBindConnToInterface(logf logger.Logf, v bool) {
|
||||
logf("netns: disableBindConnToInterface set to %v", v)
|
||||
disableBindConnToInterface.Store(v)
|
||||
if disableBindConnToInterface.Swap(v) != v {
|
||||
logf("netns: disableBindConnToInterface changed to %v", v)
|
||||
}
|
||||
}
|
||||
|
||||
var disableBindConnToInterfaceAppleExt atomic.Bool
|
||||
@@ -64,8 +67,9 @@ func SetDisableBindConnToInterface(logf logger.Logf, v bool) {
|
||||
// connections to the default network interface but only on Apple clients where
|
||||
// tailscaled is running inside a network extension.
|
||||
func SetDisableBindConnToInterfaceAppleExt(logf logger.Logf, v bool) {
|
||||
logf("netns: disableBindConnToInterfaceAppleExt set to %v", v)
|
||||
disableBindConnToInterfaceAppleExt.Store(v)
|
||||
if runtime.GOOS == "darwin" && disableBindConnToInterfaceAppleExt.Swap(v) != v {
|
||||
logf("netns: disableBindConnToInterfaceAppleExt changed to %v", v)
|
||||
}
|
||||
}
|
||||
|
||||
// Listener returns a new net.Listener with its Control hook func
|
||||
|
||||
Reference in New Issue
Block a user