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/cmd/tailscale/cli
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>
3 years ago
..
bugreport.go cmd/tailscale, ipn/localapi: add "tailscale bugreport" subcommand 3 years ago
cli.go cmd/tailscale/cli: avoid a spammy log message on SIGINT 3 years ago
cli_test.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 3 years ago
debug.go ipn/localapi, cmd/tailscale: add API to get prefs, CLI debug command to show 3 years ago
down.go ipn/localapi: move EditPrefs to localapi 3 years ago
ip.go cmd/tailscale/cli: let ip take a peername 3 years ago
logout.go cmd/tailscale: fix command descriptions (#1710) 3 years ago
netcheck.go net/portmapper: add NAT-PMP client, move port mapping service probing 3 years ago
ping.go ipn/ipnstate: add PeerStatus.TailscaleIPs slice, deprecate TailAddr 3 years ago
push.go cmd/tailscale/cli: make push get peerapi base via localapi, not TSMP ping 3 years ago
status.go ipn/ipnstate: add PeerStatus.TailscaleIPs slice, deprecate TailAddr 3 years ago
up.go ipn{,/ipnlocal}, cmd/tailscale/cli: don't check pref reverts on initial up 3 years ago
version.go cmd/tailscale, ipn/localapi: get daemon version from localapi status 3 years ago
web.css cmd/tailscale/cli: split out web.css file 3 years ago
web.go ipn: add DefaultControlURL const, replace few literals with it 3 years ago
web.html cmd/tailscale/cli: split out web.css file 3 years ago