mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 05:07:33 +00:00
envknob: support changing envknobs post-init
Updates #5114 Change-Id: Ia423fc7486e1b3f3180a26308278be0086fae49b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
33ee2c058e
commit
74674b110d
@@ -20,7 +20,7 @@ import (
|
||||
"tailscale.com/types/logger"
|
||||
)
|
||||
|
||||
var debugNetlinkMessages = envknob.Bool("TS_DEBUG_NETLINK")
|
||||
var debugNetlinkMessages = envknob.RegisterBool("TS_DEBUG_NETLINK")
|
||||
|
||||
// unspecifiedMessage is a minimal message implementation that should not
|
||||
// be ignored. In general, OS-specific implementations should use better
|
||||
@@ -96,7 +96,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
|
||||
nip := netaddrIP(rmsg.Attributes.Address)
|
||||
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
typ := "RTM_NEWADDR"
|
||||
if msg.Header.Type == unix.RTM_DELADDR {
|
||||
typ = "RTM_DELADDR"
|
||||
@@ -125,7 +125,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
}
|
||||
|
||||
if addrs[nip] {
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
c.logf("ignored duplicate RTM_NEWADDR for %s", nip)
|
||||
}
|
||||
return ignoreMessage{}, nil
|
||||
@@ -147,7 +147,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
Addr: nip,
|
||||
Delete: msg.Header.Type == unix.RTM_DELADDR,
|
||||
}
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
c.logf("%+v", nam)
|
||||
}
|
||||
return nam, nil
|
||||
@@ -169,7 +169,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
(rmsg.Attributes.Table == 255 || rmsg.Attributes.Table == 254) &&
|
||||
(dst.Addr().IsMulticast() || dst.Addr().IsLinkLocalUnicast()) {
|
||||
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
c.logf("%s ignored", typeStr)
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
Dst: dst,
|
||||
Gateway: gw,
|
||||
}
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
c.logf("%+v", nrm)
|
||||
}
|
||||
return nrm, nil
|
||||
@@ -225,7 +225,7 @@ func (c *nlConn) Receive() (message, error) {
|
||||
table: rmsg.Table,
|
||||
priority: rmsg.Attributes.Priority,
|
||||
}
|
||||
if debugNetlinkMessages {
|
||||
if debugNetlinkMessages() {
|
||||
c.logf("%+v", rdm)
|
||||
}
|
||||
return rdm, nil
|
||||
|
Reference in New Issue
Block a user