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-android/libtailscale
kari-ts c10aca720b
android: don't set vpnService to nil when state is Stopped (#523)
We are currently setting vpnService.service to nil:
-any time there’s an error with updateTUN
-when we exit out of runBackend
-if the config is the default config (aka when the ipn state is Stopped)

When it gets set to nil, we don’t handle state or config updates by calling updateTUN until after startVPN is called again.
The second case never happens because there’s no condition to break out of the loop in runBackend and ctx is uncancelable per the doc for context.Background()
In the third case, we should not establish the VPN; the state is already in the correct Stopped state, but there’s no need to set the service to nil and prevent updateTUN from being called. The quick settings tile bug is caused by this third case, where because the saved prefs starts the app up in the Stopped state, the config is set to the default config, and the service is set to nil, and we can't updateTUN until there’s another startVPN call.

This PR:
-cleans up the updateTUN error handling to be more consistent
-removes the IPNService parameter from updateTUN so that vpnService.service is not set to nil in the third case
-updates IPNService to use stopSelf and not stopForeground when we disconnect the VPN; the latter only disconnects if there is a memory need

Fixes tailscale/tailscale#12489

Signed-off-by: kari-ts <kari@tailscale.com>
4 weeks ago
..
backend.go android: don't set vpnService to nil when state is Stopped (#523) 4 weeks ago
callbacks.go android: send Android logs to logz (#515) 1 month ago
interfaces.go android: don't set vpnService to nil when state is Stopped (#523) 4 weeks ago
localapi.go libtailscale, mdm: allow syspolicy to subscribe to policy change notifications (#462) 3 months ago
log.go android: switch to using gomobile 7 months ago
multitun.go android: switch to using gomobile 7 months ago
net.go android: don't set vpnService to nil when state is Stopped (#523) 4 weeks ago
notifier.go android: switch to using gomobile 7 months ago
store.go android: switch to using gomobile 7 months ago
syspolicy_handler.go libtailscale, mdm: allow syspolicy to subscribe to policy change notifications (#462) 3 months ago
tailscale.go android: send Android logs to logz (#515) 1 month ago
vpnfacade.go android: only reconfigure VPN when ready 7 months ago