Skip to content

Advanced kill switch blocks Tailscale's own transport traffic (fwmark 0x80000): route mesh-VPN-marked packets into the Proton table #42

Open

Description

@Lenoridev

Summary

With the advanced (permanent) kill switch on, Tailscale can't reach its coordination server or DERP relays, even though the Proton tunnel works.

Tailscale marks its own sockets with fwmark 0x80000/0xff0000, and its policy rules send that traffic to lookup main at priority 5210. Proton steers all other traffic into the tunnel with a later rule (32765, not fwmark 0xea13b2c lookup 245447468). That rule never sees Tailscale's packets. In main, the kill switch route via pvpnksintrf1 (metric 98) beats the real uplink (metric 100), so Tailscale's transport ends up in the dummy interface and times out.

The kill switch is working as designed, but any tool that routes "its own" traffic via main breaks. I'd like Proton to route that traffic into the tunnel, which keeps the kill switch guarantee.

Environment

  • Arch Linux, kernel 7.2.15, KDE Plasma 6
  • NetworkManager 1.58.1
  • proton-vpn-gtk-app 4.19.0, python-proton-vpn-api-core 6.1.1
  • WireGuard on proton0 (current connection: org.freedesktop.NetworkManager.protun), IPv6 disabled on the tunnel
  • Advanced kill switch: pvpn-killswitch-perm (dummy) on pvpnksintrf1
  • Tailscale 1.104.5 (also seen with 1.102.4), default netfilter mode, --accept-routes=false

Mechanism

IPv4 policy rules, without the local workaround below (this is the current ip rule show with rules 5190/5191 removed, not a fresh capture):

Priority Rule Installed by
0 from all lookup local kernel
5210 from all fwmark 0x80000/0xff0000 lookup main Tailscale
5230 from all fwmark 0x80000/0xff0000 lookup default Tailscale
5250 from all fwmark 0x80000/0xff0000 unreachable Tailscale
5270 from all lookup 52 (tailnet routes) Tailscale
32764 from all lookup main suppress_prefixlength 0 proto static Proton (nm-protun-service)
32765 not from all fwmark 0xea13b2c lookup 245447468 proto static Proton (nm-protun-service)
32766 from all lookup main kernel

Default routes:

default dev proton0 table 245447468 proto static metric 50
unreachable default table 245447468 proto static metric 100
default via 100.85.0.1 dev pvpnksintrf1 proto static metric 98      # kill switch (main)
default via <lan-gw> dev <lan-if> proto dhcp metric 100             # uplink (main)

IPv6 behaves the same way: main has default via fd…::1 dev pvpnksintrf1 metric 95 ahead of the RA default (metric 100).

A Tailscale control or DERP connection (mark 0x80000) matches 5210 and goes to main. There, the default route is pvpnksintrf1, so the packet is dropped. Rule 32765 is never consulted. Unmarked traffic misses 5210–5250 and reaches 32765 as intended. In an earlier session, Proton's rules were at 30906/30907 (no proto static). The ordering relative to 5210 was the same, and so was the failure.

Tailscale's logs while affected (shortened):

control: lite map update error after 22.572s: Post "https://controlplane.tailscale.com/machine/map": connection attempts aborted by context: context deadline exceeded
magicsock: derp.Recv(derp-4): derphttp.Client.Recv connect to region 4 (fra): dial tcp4 <derp-ip>:443: i/o timeout
health(warnable=no-derp-connection): error: Tailscale could not connect to the 'Frankfurt' relay server.

tailscale status reports: "Unable to connect to the Tailscale coordination server to synchronize the state of your tailnet." Peers show the host as offline.

Inferred from the rules, not tested: with the kill switch off and Proton connected, the same marked traffic would leave through the LAN default route, outside the tunnel. So exempting the mark to main (or allowing it in a firewall) is not the right fix. It has to go into the Proton table.

Impact

  • Tailscale on the Proton host is cut off from its control plane and relays. Anything that uses the tailnet stops working (SSH, remote dev tools, file sync, …).
  • Users who search for a fix tend to turn off the kill switch or try split tunneling. Split tunneling is documented as incompatible with the kill switch on Linux, and Tailscale's other-VPNs FAQ doesn't cover this case.

Current workaround (sketch)

A root service, triggered by a NetworkManager dispatcher hook and also polling, keeps two extra rules per address family:

# guard first, so the mark is never routed via main:
ip rule add priority 5191 fwmark 0x80000/0xff0000 unreachable
# while Proton is up: T = the table that holds "default dev proton0" and is
# referenced by Proton's "not fwmark T lookup T" rule
ip rule add priority 5190 fwmark 0x80000/0xff0000 lookup "$T"
# on disconnect or reconnect: delete or replace 5190; keep 5191 (fail closed)

With these rules, ip route get 1.1.1.1 mark 0x80000 returns dev proton0 table 245447468, and Tailscale reconnects through the tunnel (relayed through DERP). It works, but it's fragile. It has to guess Proton's table, which can change between connections, and track reconnects. It also depends on Tailscale's priorities never moving below 5190.

Proposed enhancement

  1. Preferred: while the tunnel is up, install a fwmark 0x80000/0xff0000 lookup <proton table> rule just below Tailscale's 5210, next to the existing fwmark/suppress rules. While the advanced kill switch is on, also keep a fail-closed unreachable rule for the same mark. Marked traffic then leaves via proton0 or not at all. That matches the kill switch's guarantee, and tailnet traffic (table 52 → tailscale0) is unaffected. Ideally the list of marks can be extended for other mesh VPNs that use the same pattern.
  2. Or add an opt-in toggle under the kill switch settings, such as "Allow Tailscale (route its traffic through the VPN)", that does the same.
  3. At minimum, document the conflict and a supported setup in the kill switch and Linux known-issues pages.

The feature-flagged nftables kill switch in api-core 6.1.1 wouldn't fix this on its own. Marked packets would still be routed via main, and they would either be dropped there or, if allowed, bypass the tunnel. A routing rule is still needed.

Side note

The kill switch dummy uses 100.85.0.0/24, which is inside Tailscale's CGNAT range (100.64.0.0/10). I haven't seen a conflict, since tailnet peers get /32 routes in table 52 ahead of main, but it may be worth avoiding.

Filed here because the rules come from nm-protun-service and the kill switch backends in this package; the user-facing toggle in option 2 would live in proton-vpn-gtk-app.

Related: ProtonVPN/proton-vpn-gtk-app#130 (the routing-based kill switch doesn't cover traffic that picks its own route). I found no existing Tailscale or fwmark reports in this repo or in proton-vpn-gtk-app.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions