You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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>
5 years ago
..
ipnlocal ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 5 years ago
ipnserver ipn, paths, cmd/tailscaled: remove LegacyConfigPath, relaynode migration 5 years ago
ipnstate ipn/ipnlocal, etc: require file sharing capability to send/recv files 5 years ago
localapi ipn/ipnlocal, etc: require file sharing capability to send/recv files 5 years ago
policy ipn/policy: mark peerapi4 and peerapi6 as interesting services 5 years ago
backend.go ipn/ipnlocal: add LocalBackend.SetDirectFileRoot 5 years ago
doc.go Move Linux client & common packages into a public repo. 6 years ago
fake_test.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 5 years ago
handle.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 5 years ago
message.go ipn: set BackendServer's notify earlier; don't require Start 5 years ago
message_test.go ipn: move Options.Notify to its own method 5 years ago
prefs.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 5 years ago
prefs_clone.go ipn/ipnlocal,wgengine/router,cmd/tailscale: add flag to allow local lan access when routing traffic via an exit node. 5 years ago
prefs_test.go ipn/ipnlocal,wgengine/router,cmd/tailscale: add flag to allow local lan access when routing traffic via an exit node. 5 years ago
store.go wgkey: new package 5 years ago
store_test.go Add tstest.PanicOnLog(), and fix various problems detected by this. 6 years ago