all: adjust some log verbosity

Updates #1548

Change-Id: Ia55f1b5dc7dfea09a08c90324226fb92cd10fa00
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/3922/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent adda2d2a51
commit 86a902b201

@ -266,9 +266,9 @@ func (c *Auto) authRoutine() {
goal := c.loginGoal goal := c.loginGoal
ctx := c.authCtx ctx := c.authCtx
if goal != nil { if goal != nil {
c.logf("authRoutine: %s; wantLoggedIn=%v", c.state, goal.wantLoggedIn) c.logf("[v1] authRoutine: %s; wantLoggedIn=%v", c.state, goal.wantLoggedIn)
} else { } else {
c.logf("authRoutine: %s; goal=nil paused=%v", c.state, c.paused) c.logf("[v1] authRoutine: %s; goal=nil paused=%v", c.state, c.paused)
} }
c.mu.Unlock() c.mu.Unlock()
@ -414,7 +414,7 @@ func (c *Auto) mapRoutine() {
} }
continue continue
} }
c.logf("mapRoutine: %s", c.state) c.logf("[v1] mapRoutine: %s", c.state)
loggedIn := c.loggedIn loggedIn := c.loggedIn
ctx := c.mapCtx ctx := c.mapCtx
c.mu.Unlock() c.mu.Unlock()
@ -445,9 +445,9 @@ func (c *Auto) mapRoutine() {
select { select {
case <-ctx.Done(): case <-ctx.Done():
c.logf("mapRoutine: context done.") c.logf("[v1] mapRoutine: context done.")
case <-c.newMapCh: case <-c.newMapCh:
c.logf("mapRoutine: new map needed while idle.") c.logf("[v1] mapRoutine: new map needed while idle.")
} }
} else { } else {
// Be sure this is false when we're not inside // Be sure this is false when we're not inside

@ -214,7 +214,7 @@ func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {
} }
c.hostinfo = hi.Clone() c.hostinfo = hi.Clone()
j, _ := json.Marshal(c.hostinfo) j, _ := json.Marshal(c.hostinfo)
c.logf("HostInfo: %s", j) c.logf("[v1] HostInfo: %s", j)
return true return true
} }
@ -245,10 +245,10 @@ func (c *Direct) GetPersist() persist.Persist {
} }
func (c *Direct) TryLogout(ctx context.Context) error { func (c *Direct) TryLogout(ctx context.Context) error {
c.logf("direct.TryLogout()") c.logf("[v1] direct.TryLogout()")
mustRegen, newURL, err := c.doLogin(ctx, loginOpt{Logout: true}) mustRegen, newURL, err := c.doLogin(ctx, loginOpt{Logout: true})
c.logf("TryLogout control response: mustRegen=%v, newURL=%v, err=%v", mustRegen, newURL, err) c.logf("[v1] TryLogout control response: mustRegen=%v, newURL=%v, err=%v", mustRegen, newURL, err)
c.mu.Lock() c.mu.Lock()
c.persist = persist.Persist{} c.persist = persist.Persist{}
@ -258,7 +258,7 @@ func (c *Direct) TryLogout(ctx context.Context) error {
} }
func (c *Direct) TryLogin(ctx context.Context, t *tailcfg.Oauth2Token, flags LoginFlags) (url string, err error) { func (c *Direct) TryLogin(ctx context.Context, t *tailcfg.Oauth2Token, flags LoginFlags) (url string, err error) {
c.logf("direct.TryLogin(token=%v, flags=%v)", t != nil, flags) c.logf("[v1] direct.TryLogin(token=%v, flags=%v)", t != nil, flags)
return c.doLoginOrRegen(ctx, loginOpt{Token: t, Flags: flags}) return c.doLoginOrRegen(ctx, loginOpt{Token: t, Flags: flags})
} }
@ -266,7 +266,7 @@ func (c *Direct) TryLogin(ctx context.Context, t *tailcfg.Oauth2Token, flags Log
// //
// On success, newURL and err will both be nil. // On success, newURL and err will both be nil.
func (c *Direct) WaitLoginURL(ctx context.Context, url string) (newURL string, err error) { func (c *Direct) WaitLoginURL(ctx context.Context, url string) (newURL string, err error) {
c.logf("direct.WaitLoginURL") c.logf("[v1] direct.WaitLoginURL")
return c.doLoginOrRegen(ctx, loginOpt{URL: url}) return c.doLoginOrRegen(ctx, loginOpt{URL: url})
} }
@ -469,7 +469,7 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
if resp.AuthURL != "" { if resp.AuthURL != "" {
c.logf("AuthURL is %v", resp.AuthURL) c.logf("AuthURL is %v", resp.AuthURL)
} else { } else {
c.logf("No AuthURL") c.logf("[v1] No AuthURL")
} }
c.mu.Lock() c.mu.Lock()
@ -520,7 +520,7 @@ func (c *Direct) newEndpoints(localPort uint16, endpoints []tailcfg.Endpoint) (c
for _, ep := range endpoints { for _, ep := range endpoints {
epStrs = append(epStrs, ep.Addr.String()) epStrs = append(epStrs, ep.Addr.String())
} }
c.logf("client.newEndpoints(%v, %v)", localPort, epStrs) c.logf("[v2] client.newEndpoints(%v, %v)", localPort, epStrs)
c.localPort = localPort c.localPort = localPort
c.endpoints = append(c.endpoints[:0], endpoints...) c.endpoints = append(c.endpoints[:0], endpoints...)
if len(endpoints) > 0 { if len(endpoints) > 0 {

@ -906,7 +906,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
timer := time.NewTimer(time.Second) timer := time.NewTimer(time.Second)
select { select {
case <-b.gotPortPollRes: case <-b.gotPortPollRes:
b.logf("got initial portlist info in %v", time.Since(t0).Round(time.Millisecond)) b.logf("[v1] got initial portlist info in %v", time.Since(t0).Round(time.Millisecond))
timer.Stop() timer.Stop()
case <-timer.C: case <-timer.C:
b.logf("timeout waiting for initial portlist") b.logf("timeout waiting for initial portlist")
@ -1054,17 +1054,17 @@ func (b *LocalBackend) updateFilter(netMap *netmap.NetworkMap, prefs *ipn.Prefs)
} }
if !haveNetmap { if !haveNetmap {
b.logf("netmap packet filter: (not ready yet)") b.logf("[v1] netmap packet filter: (not ready yet)")
b.setFilter(filter.NewAllowNone(b.logf, logNets)) b.setFilter(filter.NewAllowNone(b.logf, logNets))
return return
} }
oldFilter := b.e.GetFilter() oldFilter := b.e.GetFilter()
if shieldsUp { if shieldsUp {
b.logf("netmap packet filter: (shields up)") b.logf("[v1] netmap packet filter: (shields up)")
b.setFilter(filter.NewShieldsUpFilter(localNets, logNets, oldFilter, b.logf)) b.setFilter(filter.NewShieldsUpFilter(localNets, logNets, oldFilter, b.logf))
} else { } else {
b.logf("netmap packet filter: %v filters", len(packetFilter)) b.logf("[v1] netmap packet filter: %v filters", len(packetFilter))
b.setFilter(filter.New(packetFilter, localNets, logNets, oldFilter, b.logf)) b.setFilter(filter.New(packetFilter, localNets, logNets, oldFilter, b.logf))
} }
} }
@ -1503,19 +1503,19 @@ func (b *LocalBackend) loadStateLocked(key ipn.StateKey, prefs *ipn.Prefs) (err
} }
} }
b.logf("using backend prefs")
bs, err := b.store.ReadState(key) bs, err := b.store.ReadState(key)
switch { switch {
case errors.Is(err, ipn.ErrStateNotExist): case errors.Is(err, ipn.ErrStateNotExist):
b.prefs = ipn.NewPrefs() b.prefs = ipn.NewPrefs()
b.prefs.WantRunning = false b.prefs.WantRunning = false
b.logf("created empty state for %q: %s", key, b.prefs.Pretty()) b.logf("using backend prefs; created empty state for %q: %s", key, b.prefs.Pretty())
return nil return nil
case err != nil: case err != nil:
return fmt.Errorf("store.ReadState(%q): %v", key, err) return fmt.Errorf("backend prefs: store.ReadState(%q): %v", key, err)
} }
b.prefs, err = ipn.PrefsFromBytes(bs, false) b.prefs, err = ipn.PrefsFromBytes(bs, false)
if err != nil { if err != nil {
b.logf("using backend prefs for %q", key)
return fmt.Errorf("PrefsFromBytes: %v", err) return fmt.Errorf("PrefsFromBytes: %v", err)
} }
@ -1538,7 +1538,7 @@ func (b *LocalBackend) loadStateLocked(key ipn.StateKey, prefs *ipn.Prefs) (err
} }
} }
b.logf("backend prefs for %q: %s", key, b.prefs.Pretty()) b.logf("using backend prefs for %q: %s", key, b.prefs.Pretty())
b.sshAtomicBool.Set(b.prefs != nil && b.prefs.RunSSH) b.sshAtomicBool.Set(b.prefs != nil && b.prefs.RunSSH)
@ -1916,15 +1916,15 @@ func (b *LocalBackend) authReconfig() {
b.mu.Unlock() b.mu.Unlock()
if blocked { if blocked {
b.logf("authReconfig: blocked, skipping.") b.logf("[v1] authReconfig: blocked, skipping.")
return return
} }
if nm == nil { if nm == nil {
b.logf("authReconfig: netmap not yet valid. Skipping.") b.logf("[v1] authReconfig: netmap not yet valid. Skipping.")
return return
} }
if !prefs.WantRunning { if !prefs.WantRunning {
b.logf("authReconfig: skipping because !WantRunning.") b.logf("[v1] authReconfig: skipping because !WantRunning.")
return return
} }

@ -71,7 +71,7 @@ func (b *Backoff) BackOff(ctx context.Context, err error) {
d = time.Duration(float64(d) * (rand.Float64() + 0.5)) d = time.Duration(float64(d) * (rand.Float64() + 0.5))
if d >= b.LogLongerThan { if d >= b.LogLongerThan {
b.logf("%s: backoff: %d msec", b.name, d.Milliseconds()) b.logf("%s: [v1] backoff: %d msec", b.name, d.Milliseconds())
} }
t := b.NewTimer(d) t := b.NewTimer(d)
select { select {

@ -101,9 +101,21 @@ func (c *nlConn) Receive() (message, error) {
dst := netaddrIPPrefix(rmsg.Attributes.Dst, rmsg.DstLength) dst := netaddrIPPrefix(rmsg.Attributes.Dst, rmsg.DstLength)
gw := netaddrIP(rmsg.Attributes.Gateway) gw := netaddrIP(rmsg.Attributes.Gateway)
if msg.Header.Type == unix.RTM_NEWROUTE &&
(rmsg.Attributes.Table == 255 || rmsg.Attributes.Table == 254) &&
(dst.IP().IsMulticast() || dst.IP().IsLinkLocalUnicast()) {
// Normal Linux route changes on new interface coming up; don't log or react.
return ignoreMessage{}, nil
}
if rmsg.Table == tsTable && dst.IsSingleIP() { if rmsg.Table == tsTable && dst.IsSingleIP() {
// Don't log. Spammy and normal to see a bunch of these on start-up, // Don't log. Spammy and normal to see a bunch of these on start-up,
// which we make ourselves. // which we make ourselves.
} else if tsaddr.IsTailscaleIP(dst.IP()) {
// Verbose only.
c.logf("%s: [v1] src=%v, dst=%v, gw=%v, outif=%v, table=%v", typeStr,
condNetAddrPrefix(src), condNetAddrPrefix(dst), condNetAddrIP(gw),
rmsg.Attributes.OutIface, rmsg.Attributes.Table)
} else { } else {
c.logf("%s: src=%v, dst=%v, gw=%v, outif=%v, table=%v", typeStr, c.logf("%s: src=%v, dst=%v, gw=%v, outif=%v, table=%v", typeStr,
condNetAddrPrefix(src), condNetAddrPrefix(dst), condNetAddrIP(gw), condNetAddrPrefix(src), condNetAddrPrefix(dst), condNetAddrIP(gw),

Loading…
Cancel
Save