ipnlocal: in Start() fast path, don't forget to send Prefs.

The resulting empty Prefs had AllowSingleHosts=false and
Routeall=false, so that on iOS if you did these steps:
- Login and leave running
- Terminate the frontend
- Restart the frontend (fast path restart, missing prefs)
- Set WantRunning=false
- Set WantRunning=true
...then you would have Tailscale running, but with no routes. You would
also accidentally disable the ExitNodeID/IP prefs (symptom: the current
exit node setting didn't appear in the UI), but since nothing
else worked either, you probably didn't notice.

The fix was easy enough. It turns out we already knew about the
problem, so this also fixes one of the BUG entries in state_test.

Fixes: #1918 (BUG-1) and some as-yet-unreported bugs with exit nodes.
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
This commit is contained in:
Avery Pennarun 2021-05-20 03:10:55 -04:00
parent ee19c53063
commit f308995edf
2 changed files with 2 additions and 4 deletions

View File

@ -714,6 +714,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
b.send(ipn.Notify{ b.send(ipn.Notify{
State: &state, State: &state,
NetMap: nm, NetMap: nm,
Prefs: b.prefs,
LoginFinished: new(empty.Message), LoginFinished: new(empty.Message),
}) })
return nil return nil

View File

@ -550,10 +550,7 @@ func TestStateMachine(t *testing.T) {
c.Assert(nn[0].State, qt.Not(qt.IsNil)) c.Assert(nn[0].State, qt.Not(qt.IsNil))
c.Assert(nn[0].LoginFinished, qt.Not(qt.IsNil)) c.Assert(nn[0].LoginFinished, qt.Not(qt.IsNil))
c.Assert(nn[0].NetMap, qt.Not(qt.IsNil)) c.Assert(nn[0].NetMap, qt.Not(qt.IsNil))
// BUG: Prefs should be sent too, or the UI could end up in c.Assert(nn[0].Prefs, qt.Not(qt.IsNil))
// a bad state. (iOS, the only current user of this feature,
// probably wouldn't notice because it happens to not display
// any prefs. Maybe exit nodes will look weird?)
} }
// undo the state hack above. // undo the state hack above.