From 657f9593ae1164d4da8a4e5c3a7433165e7457b4 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 2 Mar 2020 14:54:57 -0800 Subject: [PATCH] Reduce some logspam. --- ipn/local.go | 5 ++++- wgengine/userspace.go | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ipn/local.go b/ipn/local.go index 36bbdcd4f..83d521d1e 100644 --- a/ipn/local.go +++ b/ipn/local.go @@ -226,7 +226,10 @@ func (b *LocalBackend) Start(opts Options) error { if b.netMapCache != nil && b.cmpDiff != nil { s1 := strings.Split(b.netMapCache.Concise(), "\n") s2 := strings.Split(newSt.NetMap.Concise(), "\n") - b.logf("netmap diff:\n%v\n", b.cmpDiff(s1, s2)) + diff := b.cmpDiff(s1, s2) + if strings.TrimSpace(diff) != "" { + b.logf("netmap diff:\n%v\n", diff) + } } b.netMapCache = newSt.NetMap b.mu.Unlock() diff --git a/wgengine/userspace.go b/wgengine/userspace.go index c9c4f2838..7940900ac 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -353,8 +353,6 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, dnsDomains []string) error DNS: cfg.DNS, DNSDomains: dnsDomains, } - e.logf("Reconfiguring router. la=%v dns=%v dom=%v\n", - rs.LocalAddr, rs.DNS, rs.DNSDomains) // TODO(apenwarr): all the parts of RouteSettings should be "relevant." // We're checking only the "relevant" parts to see if they have @@ -364,15 +362,18 @@ func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, dnsDomains []string) error // a whole Cfg object as part of RouteSettings; instead, trim it to // just what's absolutely needed (the set of actual routes). rss := rs.OnlyRelevantParts() - e.logf("New routes: %v\n", rss) - if rss == e.lastRoutes { - e.logf("...unchanged routes, skipping.\n") - return nil + if rss != e.lastRoutes { + e.logf("Reconfiguring router. la=%v dns=%v dom=%v; new routes: %v\n", + rs.LocalAddr, rs.DNS, rs.DNSDomains, rss) + e.lastRoutes = rss + err = e.router.SetRoutes(rs) + if err != nil { + return err + } } - e.lastRoutes = rss - err = e.router.SetRoutes(rs) + e.logf("Reconfig() done.\n") - return err + return nil } func (e *userspaceEngine) SetFilter(filt *filter.Filter) {