mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 14:57:49 +00:00
ipn/local: differentiate Shields Up from Uninitialized in logs.
We were printing "Shields Up" when the netmap wasn't initialized yet, which while technically effectively true, turned out to be confusing when trying to debug things. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
This commit is contained in:
parent
64db026c8b
commit
d6c34368e8
12
ipn/local.go
12
ipn/local.go
@ -354,17 +354,21 @@ func (b *LocalBackend) Start(opts Options) error {
|
||||
func (b *LocalBackend) updateFilter(netMap *controlclient.NetworkMap) {
|
||||
// TODO(apenwarr): don't replace filter at all if unchanged.
|
||||
// TODO(apenwarr): print a diff instead of full filter.
|
||||
if netMap == nil || b.Prefs().ShieldsUp {
|
||||
// Not configured yet or shields up, block everything
|
||||
if netMap == nil {
|
||||
// Not configured yet, block everything
|
||||
b.logf("netmap packet filter: (not ready yet)")
|
||||
b.e.SetFilter(filter.NewAllowNone())
|
||||
} else if b.Prefs().ShieldsUp {
|
||||
// Shields up, block everything
|
||||
b.logf("netmap packet filter: (shields up)")
|
||||
b.e.SetFilter(filter.NewAllowNone())
|
||||
} else {
|
||||
now := time.Now()
|
||||
if now.Sub(b.lastFilterPrint) > 1*time.Minute {
|
||||
b.logf("netmap packet filter: %v", b.netMapCache.PacketFilter)
|
||||
b.logf("netmap packet filter: %v", netMap.PacketFilter)
|
||||
b.lastFilterPrint = now
|
||||
} else {
|
||||
b.logf("netmap packet filter: (suppressed)")
|
||||
b.logf("netmap packet filter: (length %d)", len(netMap.PacketFilter))
|
||||
}
|
||||
b.e.SetFilter(filter.New(netMap.PacketFilter, b.e.GetFilter()))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user