cmd/tailscale/cli: don't let up change prefs based on implicit flag values

This changes the behavior of "tailscale up".

Previously "tailscale up" always did a new Start and reset all the settings.

Now "tailscale up" with no flags just brings the world [back] up.
(The opposite of "tailscale down").

But with flags, "tailscale up" now only is allowed to change
preferences if they're explicitly named in the flags. Otherwise it's
an error. Or you need to use --reset to explicitly nuke everything.

RELNOTE=tailscale up change

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-10 21:56:18 -07:00
committed by Brad Fitzpatrick
parent 9aa33b43e6
commit 9972c02b60
4 changed files with 404 additions and 68 deletions

View File

@@ -1331,8 +1331,14 @@ func (b *LocalBackend) EditPrefs(mp *ipn.MaskedPrefs) (*ipn.Prefs, error) {
b.mu.Unlock()
return p1, nil
}
cc := b.cc
b.logf("EditPrefs: %v", mp.Pretty())
b.setPrefsLockedOnEntry("EditPrefs", p1)
b.setPrefsLockedOnEntry("EditPrefs", p1) // does a b.mu.Unlock
if !p0.WantRunning && p1.WantRunning {
b.logf("EditPrefs: transitioning to running; doing Login...")
cc.Login(nil, controlclient.LoginDefault)
}
return p1, nil
}