tailscale/ipn
Brad Fitzpatrick 49808ae6ea ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up
The ipn.NewPrefs func returns a populated ipn.Prefs for historical
reasons. It's not used or as important as it once was, but it hasn't
yet been removed. Meanwhile, it contains some default values that are
used on some platforms. Notably, for this bug (#1725), Windows/Mac use
its Prefs.RouteAll true value (to accept subnets), but Linux users
have always gotten a "false" value for that, because that's what
cmd/tailscale's CLI default flag is _for all operating systems_.  That
meant that "tailscale up" was rightfully reporting that the user was
changing an implicit setting: RouteAll was changing from true with
false with the user explicitly saying so.

An obvious fix might be to change ipn.NewPrefs to return
Prefs.RouteAll == false on some platforms, but the logic is
complicated by darwin: we want RouteAll true on windows, android, ios,
and the GUI mac app, but not the CLI tailscaled-on-macOS mode. But
even if we used build tags (e.g. the "redo" build tag) to determine
what the default is, that then means we have duplicated and differing
"defaults" between both the CLI up flags and ipn.NewPrefs. Furthering
that complication didn't seem like a good idea.

So, changing the NewPrefs defaults is too invasive at this stage of
the release, as is removing the NewPrefs func entirely.

Instead, tweak slightly the semantics of the ipn.Prefs.ControlURL
field. This now defines that a ControlURL of the empty string means
both "we're uninitialized" and also "just use the default".

Then, once we have the "empty-string-means-unintialized" semantics,
use that to suppress "tailscale up"'s recent implicit-setting-revert
checking safety net, if we've never initialized Tailscale yet.

And update/add tests.

Fixes #1725

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-18 08:12:18 -07:00
..
ipnlocal ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 2021-04-18 08:12:18 -07:00
ipnserver ipn, paths, cmd/tailscaled: remove LegacyConfigPath, relaynode migration 2021-04-07 10:15:45 -07:00
ipnstate ipn/ipnlocal, etc: require file sharing capability to send/recv files 2021-04-16 10:58:19 -07:00
localapi ipn/ipnlocal, etc: require file sharing capability to send/recv files 2021-04-16 10:58:19 -07:00
policy ipn/policy: mark peerapi4 and peerapi6 as interesting services 2021-04-01 11:57:24 -07:00
backend.go ipn/ipnlocal: add LocalBackend.SetDirectFileRoot 2021-04-12 14:29:45 -07:00
doc.go Move Linux client & common packages into a public repo. 2020-02-09 09:32:57 -08:00
fake_test.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 2021-04-18 08:12:18 -07:00
handle.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 2021-04-18 08:12:18 -07:00
message.go ipn: set BackendServer's notify earlier; don't require Start 2021-04-12 10:38:51 -07:00
message_test.go ipn: move Options.Notify to its own method 2021-04-06 22:12:40 -07:00
prefs.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 2021-04-18 08:12:18 -07:00
prefs_clone.go ipn/ipnlocal,wgengine/router,cmd/tailscale: add flag to allow local lan access when routing traffic via an exit node. 2021-04-12 17:29:01 -07:00
prefs_test.go ipn/ipnlocal,wgengine/router,cmd/tailscale: add flag to allow local lan access when routing traffic via an exit node. 2021-04-12 17:29:01 -07:00
store.go wgkey: new package 2020-12-30 17:33:02 -08:00
store_test.go Add tstest.PanicOnLog(), and fix various problems detected by this. 2020-05-13 23:12:35 -04:00