paths: return an absolute default socket path on Android

Android has no /var, so DefaultTailscaledSocket fell through to the
cwd-relative "tailscaled.sock": the daemon created its socket wherever
it was started and the CLI looked for one wherever it was started, and
the two only agreed by coincidence (reproduced on Termux in #21161).

Return os.TempDir()/tailscaled.sock on Android - the shared per-app
temp directory, following the same pattern as the existing QNAP /tmp
default - so daemon and CLI agree on an absolute path.

Fixes #21161

Signed-off-by: breken <[email protected]>
This commit is contained in:
breken authored and Brad Fitzpatrick committed 2026-09-08 18:40:37 -07:00
1 parent 1e95ec8ad5
commit 3945b82f8a
1 file changed
+8
+8
View File
@@ -31,6 +31,14 @@ func DefaultTailscaledSocket() string {
if runtime.GOOS == "plan9" {
return "/srv/tailscaled.sock"
}
if runtime.GOOS == "android" {
// Android (e.g. a userspace tailscaled under Termux) has no /var,
// and the cwd-relative fallback below only works when the daemon
// and the CLI happen to be started from the same directory
// (see #21161). Use the shared per-app temp directory so both
// agree on an absolute path.
return filepath.Join(os.TempDir(), "tailscaled.sock")
}
switch distro.Get() {
case distro.Synology:
if distro.DSMVersion() == 6 {