From b1bf9719c06f9830ba55c086adf7f66ecd0b7c9c Mon Sep 17 00:00:00 2001 From: Lumpiasty Date: Mon, 26 Oct 2026 16:59:29 +0100 Subject: [PATCH] fix: enable udptransport/nattraversal feature tags Tailscale v1.104.0 split UDP peer transport and NAT traversal into new feature tags. The allowlist build omits any unknown tag, so since v1.104.0 magicsock never ran its UDP receive loops: all peer traffic was relayed over DERP and health reported "The MagicSock function ReceiveIPv4 is not running". portmapper and listenrawdisco depend on these tags as well. Also anchor the tag-stripping sed patterns on commas: ts_omit_dns was matching the prefix of the new ts_omit_dnsresolvecache, leaving a bogus "resolvecache" tag and enabling on-disk DNS caching (flash writes). Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 50 ++++++++++++++++++++++++++++++++++---------------- docs/DESIGN.md | 3 +++ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 05b0b6d..adbcdcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -90,8 +90,20 @@ COPY patches/stderr_verbosity_filter.go cmd/tailscaled/ # dns — MagicDNS; configure MikroTik DNS to forward # *.ts.net → 100.100.100.100; use --no-dns daemon # flag to skip writing /etc/resolv.conf +# udptransport — REQUIRED for direct (non-DERP) peer connections. Added +# as a separate tag in v1.104.0; when omitted, magicsock +# never runs its UDP receive loops and ALL peer traffic +# is relayed over DERP. Symptom on omission: health +# warning "The MagicSock function ReceiveIPv4 is not +# running" (magicsock-receive-func-error). +# nattraversal — STUN, disco hole punching, UDP peer relay client. Also +# new in v1.104.0; without it direct UDP only works to +# peers with directly reachable endpoints. Depends on +# udptransport. # portmapper — NAT-PMP / PCP / UPnP to punch through upstream NAT +# (depends on nattraversal) # listenrawdisco — raw sockets for more robust disco/NAT-traversal +# (depends on udptransport) # health — health subsystem required by 'tailscale status' # iptables — Linux iptables support for routing rules # unixsocketidentity — REQUIRED for the CLI to talk to the daemon. Without it, @@ -182,31 +194,37 @@ COPY patches/stderr_verbosity_filter.go cmd/tailscaled/ # which is exactly the flash wear we want to avoid. # logtail — no persistent log writes to flash; also pass # --no-logs-no-support at runtime +# dnsresolvecache — persists DNS resolutions to disk; flash writes for a +# marginal cold-start benefit # ssh — not needed; access via MikroTik SSH + tailscale CLI # all GUI/desktop/cloud/k8s features — irrelevant for a headless router # # NOTE: netstack/gro are NOT in this omit list — see the opted-in section above # for why MagicDNS quad-100 serving structurally requires them in v1.98.5. +# The omit list is wrapped in commas so each pattern matches a WHOLE tag +# (",ts_omit_dns," must not eat the prefix of ",ts_omit_dnsresolvecache,"). RUN mkdir -p /out && \ ALL_OMIT=$(GOOS= GOARCH= go run ./cmd/featuretags --min --add=osrouter) && \ - TAGS=$(echo "ts_include_cli,${ALL_OMIT}" | \ + TAGS=$(echo ",ts_include_cli,${ALL_OMIT}," | \ sed \ - -e 's/ts_omit_advertiseexitnode,\{0,1\}//g' \ - -e 's/ts_omit_advertiseroutes,\{0,1\}//g' \ - -e 's/ts_omit_useexitnode,\{0,1\}//g' \ - -e 's/ts_omit_useroutes,\{0,1\}//g' \ - -e 's/ts_omit_dns,\{0,1\}//g' \ - -e 's/ts_omit_portmapper,\{0,1\}//g' \ - -e 's/ts_omit_listenrawdisco,\{0,1\}//g' \ - -e 's/ts_omit_health,\{0,1\}//g' \ - -e 's/ts_omit_iptables,\{0,1\}//g' \ - -e 's/ts_omit_unixsocketidentity,\{0,1\}//g' \ - -e 's/ts_omit_ipnbus,\{0,1\}//g' \ - -e 's/ts_omit_netstack,\{0,1\}//g' \ - -e 's/ts_omit_gro,\{0,1\}//g' \ - -e 's/ts_omit_peerapiserver,\{0,1\}//g' \ - -e 's/,$//' \ + -e 's/,ts_omit_advertiseexitnode,/,/' \ + -e 's/,ts_omit_advertiseroutes,/,/' \ + -e 's/,ts_omit_useexitnode,/,/' \ + -e 's/,ts_omit_useroutes,/,/' \ + -e 's/,ts_omit_dns,/,/' \ + -e 's/,ts_omit_udptransport,/,/' \ + -e 's/,ts_omit_nattraversal,/,/' \ + -e 's/,ts_omit_portmapper,/,/' \ + -e 's/,ts_omit_listenrawdisco,/,/' \ + -e 's/,ts_omit_health,/,/' \ + -e 's/,ts_omit_iptables,/,/' \ + -e 's/,ts_omit_unixsocketidentity,/,/' \ + -e 's/,ts_omit_ipnbus,/,/' \ + -e 's/,ts_omit_netstack,/,/' \ + -e 's/,ts_omit_gro,/,/' \ + -e 's/,ts_omit_peerapiserver,/,/' \ + -e 's/^,//' -e 's/,$//' \ ) && \ echo "Build tags: ${TAGS}" && \ # Map Docker's TARGETARCH/TARGETVARIANT to Go's GOARCH/GOARM. diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 2b0d31e..f440e35 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -156,6 +156,8 @@ that's a separate build, not just a `--platform` change. | DNS / MagicDNS | Resolve `*.ts.net` names (resolver + resolv.conf manager). **Note:** serving `100.100.100.100` also requires `netstack` — see [Why netstack is required (even with a kernel TUN)](#why-netstack-is-required-even-with-a-kernel-tun) | | `netstack` + `gro` | gVisor userspace stack. Counter-intuitively **required** to serve MagicDNS on `100.100.100.100`, even though the router uses a real kernel TUN — see [Why netstack is required (even with a kernel TUN)](#why-netstack-is-required-even-with-a-kernel-tun) | | `peerapiserver` | Serves the PeerAPI, including the `/dns-query` DoH endpoint that lets **exit-node clients resolve public DNS automatically**. A declared dependency of `advertise-exit-node` that the allowlist didn't pull in — see [Why peerapiserver is required for exit-node DNS](#why-peerapiserver-is-required-for-exit-node-dns) | +| udptransport | **Required** for direct peer connections (split out in v1.104.0). Without it magicsock never runs its UDP receive loops, all traffic is relayed via DERP, and health reports "The MagicSock function ReceiveIPv4 is not running" | +| nattraversal | STUN, disco hole punching, UDP peer relay client (split out in v1.104.0). Without it direct UDP only works to peers with directly reachable endpoints | | portmapper (NAT-PMP/PCP/UPnP) | Punch through upstream NAT | | listenrawdisco | Raw socket disco for better NAT traversal | | health | Powers `tailscale status` output | @@ -172,6 +174,7 @@ that's a separate build, not just a `--platform` change. | `cachenetmap` | **Deliberately removed** — see [Why netmap disk-caching is removed](#why-netmap-disk-caching-is-removed) | | `logtail` | Would attempt persistent log writes; wear flash. Removing it also removes stderr verbosity filtering — restored by an injected filter, see [Log verbosity filtering](#log-verbosity-filtering) | | `netlog` | Network flow logging; separate concern | +| `dnsresolvecache` | Persists DNS resolutions to disk — flash writes for a marginal cold-start benefit | | `ssh` | Access via MikroTik SSH + `tailscale` CLI instead | | `linuxdnsfight` | inotify on `/etc/resolv.conf`; no systemd in container | | `networkmanager` / `resolved` / `dbus` / `sdnotify` | No systemd stack in container | -- 2.54.1