#3502·headscale

[Bug] A node never receives its own approved exit routes (Self.ExitNodeOption stays false after approve-routes); 0.29.4 also broke the re-advertise workaround

Author: SarcouyCreated Sep 27, 2026Updated Sep 27, 2026

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

A node that advertises exit routes never receives its own updated self node after the routes are approved with headscale nodes approve-routes. On the node, tailscale status --json keeps .Self.ExitNodeOption = false and .Self.AllowedIPs without 0.0.0.0/0 and ::/0, tailscale status does not print "offers exit node", and tailscale debug netmap shows SelfNode.Hostinfo.RoutableIPs = ["0.0.0.0/0", "::/0"] next to SelfNode.AllowedIPs = ["100.64.0.1/32", "fd7a:115c:a1e0::1/128"]. Nothing changes over time: the node only learns its approved routes when it opens a new map session (systemctl restart tailscaled, tailscale down && tailscale up).

Up to v0.29.3, withdrawing and re-advertising the routes on the node (tailscale set --advertise-exit-node=false && tailscale set --advertise-exit-node) made headscale send the node its self node, which was a usable workaround. Since v0.29.4 that no longer has any effect: Self.ExitNodeOption stays false after the toggle too.

With headscale logging at trace, both the gRPC approval and each half of the toggle end in node change processing started node.id=1 reason="policy change" followed by update sent on the node's stream, and the node's self stays unchanged (full log below).

Expected Behavior

After headscale nodes approve-routes, the approved node receives a map response carrying its updated self node, so Self.AllowedIPs contains the approved exit routes and Self.ExitNodeOption is true on its live map session, without restarting tailscaled. Re-advertising the routes should keep refreshing the node's self as it did on v0.29.3.

Steps To Reproduce

  1. headscale v0.29.4, one user, no policy.
  2. On a node (tailscale 1.102.4): tailscale up --login-server https://<headscale> --auth-key <key> --advertise-exit-node.
  3. headscale nodes approve-routes --identifier <id> --routes 0.0.0.0/0,::/0.
  4. On the node, wait a minute, then tailscale status --json | jq .Self.ExitNodeOption → false; tailscale debug netmap | jq '.SelfNode | {AllowedIPs, Hostinfo: {RoutableIPs: .Hostinfo.RoutableIPs}}' shows the routes announced but absent from AllowedIPs.
  5. tailscale set --advertise-exit-node=false && tailscale set --advertise-exit-node, wait → still false (on v0.29.3 this step flips it to true).
  6. systemctl restart tailscaled → true.

Environment

  • OS: Debian 13 (headscale container and the tailscale node)
  • Headscale version: 0.29.4 (image headscale/headscale:v0.29.4); the first part also reproduces on 0.29.3
  • Tailscale version: 1.102.4
  • Number of nodes: 1 (the exit node itself; no other node needed to observe it)
  • Policy: none

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Where it comes from (from the v0.29.4 source)

The mapper only adds the self node to a response when the change's OriginNode is the receiving node: isSelfUpdate := r.OriginNode != 0 && r.OriginNode == nodeID (batcher.go:106), passed as includeSelf to policyChangeResponse (batcher.go:128, mapper.go:353-355).

  1. State.SetApprovedRoutes always ends with if routeChange || !c.IsFull() { c = change.PolicyChange() } (state.go:1053-1055). c is never IsFull() there, so the gRPC/CLI approval always fans out a bare PolicyChange() with OriginNode == 0, and the approved node never gets its self. This part is the same on v0.29.3 and on main.
  2. Since v0.29.4, NodeView.HasPolicyChange also compares ExitRoutes() (node.go:1233, commit 4411264e, cherry-pick of 905ab92f from #3450, backported in #3467). A node re-advertising its already-approved exit routes therefore makes PolicyManager.SetNodes return true even when the filter hashes match (policy.go:900, the "all hashes match" line in the trace), updatePolicyManagerNodes returns change.PolicyChange() (state.go:2899), and UpdateNodeFromMapRequest returns it before buildMapRequestChangeResponse could produce change.NodeAdded(id) with its OriginNode (state.go:3265-3276). On v0.29.3 the same request ended in NodeAdded(id) and selfMapResponse, which is why the toggle used to work.

From the code, peers are not affected: the policy response still sends them the node with its routes. Only the node's own view is stale, and nothing refreshes it while its map session stays up.

#2978 / #2996 fixed the same omission for tags by setting c.OriginNode = nodeID in SetNodeTags (state.go:1018). Doing the same for the change returned by SetApprovedRoutes, and for the policy change returned from a node's own map request in UpdateNodeFromMapRequest, makes the node receive its self node in both cases; I will open a PR. The open draft #3501 rewrites these lines but still returns a bare PolicyChange() for an announced route, so it does not change this behaviour.

Debug information

tailscale debug netmap on the node after the approval and the toggle (self still without the exit routes):

netmap.json
json
{
	"AllCaps": [
		"default-auto-update",
		"https://tailscale.com/cap/file-sharing",
		"https://tailscale.com/cap/is-admin",
		"https://tailscale.com/cap/ssh"
	],
	"Cached": false,
	"CollectServices": false,
	"DERPMap": {
		"Regions": {
			"999": {
				"Nodes": [
					{
						"DERPPort": 443,
						"HostName": "hs.ci.test",
						"Name": "999",
						"RegionID": 999,
						"STUNPort": 3478
					}
				],
				"RegionCode": "headscale",
				"RegionID": 999,
				"RegionName": "Headscale embedded DERP"
			}
		}
	},
	"DNS": {
		"Domains": [
			"ts.ci.test"
		],
		"ExtraRecords": [
			{
				"Name": "mdm.ci.test",
				"Type": "A",
				"Value": "100.64.0.1"
			}
		],
		"Proxied": true,
		"Resolvers": [
			{
				"Addr": "100.64.0.1"
			}
		],
		"Routes": {
			"0.e.1.a.c.5.1.1.a.7.d.f.ip6.arpa": [],
			"100.100.in-addr.arpa": [],
			"101.100.in-addr.arpa": [],
			"102.100.in-addr.arpa": [],
			"103.100.in-addr.arpa": [],
			"104.100.in-addr.arpa": [],
			"105.100.in-addr.arpa": [],
			"106.100.in-addr.arpa": [],
			"107.100.in-addr.arpa": [],
			"108.100.in-addr.arpa": [],
			"109.100.in-addr.arpa": [],
			"110.100.in-addr.arpa": [],
			"111.100.in-addr.arpa": [],
			"112.100.in-addr.arpa": [],
			"113.100.in-addr.arpa": [],
			"114.100.in-addr.arpa": [],
			"115.100.in-addr.arpa": [],
			"116.100.in-addr.arpa": [],
			"117.100.in-addr.arpa": [],
			"118.100.in-addr.arpa": [],
			"119.100.in-addr.arpa": [],
			"120.100.in-addr.arpa": [],
			"121.100.in-addr.arpa": [],
			"122.100.in-addr.arpa": [],
			"123.100.in-addr.arpa": [],
			"124.100.in-addr.arpa": [],
			"125.100.in-addr.arpa": [],
			"126.100.in-addr.arpa": [],
			"127.100.in-addr.arpa": [],
			"64.100.in-addr.arpa": [],
			"65.100.in-addr.arpa": [],
			"66.100.in-addr.arpa": [],
			"67.100.in-addr.arpa": [],
			"68.100.in-addr.arpa": [],
			"69.100.in-addr.arpa": [],
			"70.100.in-addr.arpa": [],
			"71.100.in-addr.arpa": [],
			"72.100.in-addr.arpa": [],
			"73.100.in-addr.arpa": [],
			"74.100.in-addr.arpa": [],
			"75.100.in-addr.arpa": [],
			"76.100.in-addr.arpa": [],
			"77.100.in-addr.arpa": [],
			"78.100.in-addr.arpa": [],
			"79.100.in-addr.arpa": [],
			"80.100.in-addr.arpa": [],
			"81.100.in-addr.arpa": [],
			"82.100.in-addr.arpa": [],
			"83.100.in-addr.arpa": [],
			"84.100.in-addr.arpa": [],
			"85.100.in-addr.arpa": [],
			"86.100.in-addr.arpa": [],
			"87.100.in-addr.arpa": [],
			"88.100.in-addr.arpa": [],
			"89.100.in-addr.arpa": [],
			"90.100.in-addr.arpa": [],
			"91.100.in-addr.arpa": [],
			"92.100.in-addr.arpa": [],
			"93.100.in-addr.arpa": [],
			"94.100.in-addr.arpa": [],
			"95.100.in-addr.arpa": [],
			"96.100.in-addr.arpa": [],
			"97.100.in-addr.arpa": [],
			"98.100.in-addr.arpa": [],
			"99.100.in-addr.arpa": []
		}
	},
	"DisplayMessages": null,
	"Domain": "hs.ci.test",
	"DomainAuditLogID": "",
	"MachineKey": "mkey:b46f3a67c71c75c9d95ac5408a45476a05d70bcfec30bf844ed3e4b5441f9d24",
	"NodeKey": "nodekey:7adfd2c87640630e55bd12c319fb44fdd5d15759cc8e6261c4865557c5bfa669",
	"PacketFilter": [
		{
			"Caps": [],
			"Dsts": [
				{
					"Net": "0.0.0.0/0",
					"Ports": {
						"First": 0,
						"Last": 65535
					}
				},
				{
					"Net": "::/0",
					"Ports": {
						"First": 0,
						"Last": 65535
					}
				}
			],
			"IPProto": [
				6,
				17,
				1,
				58
			],
			"SrcCaps": null,
			"Srcs": [
				"0.0.0.0/0",
				"::/0"
			]
		}
	],
	"PacketFilterRules": [
		{
			"DstPorts": [
				{
					"IP": "*",
					"Ports": {
						"First": 0,
						"Last": 65535
					}
				}
			],
			"SrcIPs": [
				"*"
			]
		}
	],
	"Peers": [],
	"SSHPolicy": null,
	"SelfNode": {
		"Addresses": [
			"100.64.0.1/32",
			"fd7a:115c:a1e0::1/128"
		],
		"AllowedIPs": [
			"100.64.0.1/32",
			"fd7a:115c:a1e0::1/128"
		],
		"Cap": 142,
		"CapMap": {
			"default-auto-update": [
				false
			],
			"https://tailscale.com/cap/file-sharing": [],
			"https://tailscale.com/cap/is-admin": [],
			"https://tailscale.com/cap/ssh": []
		},
		"ComputedName": "exit-node",
		"ComputedNameWithHost": "exit-node",
		"Created": "2026-09-27T14:24:39.446940661Z",
		"DiscoKey": "discokey:42b8fa6d9f0cbb4a41190f26d7334887762181b12333f6682800921176e00c09",
		"Endpoints": [
			"172.30.0.1:40190",
			"10.0.2.15:41641",
			"10.2.0.2:41641",
			"172.17.0.1:41641",
			"172.30.0.1:41641",
			"192.0.2.1:41641",
			"[fec0::5054:ff:fe12:3456]:41641"
		],
		"HomeDERP": 999,
		"Hostinfo": {
			"AppConnector": false,
			"BackendLogID": "231aae722b39118432f2636b3fb10c6af5c8a9b534f3cd4a05db89fbba55c67c",
			"Container": false,
			"Desktop": false,
			"Distro": "debian",
			"DistroCodeName": "trixie",
			"DistroVersion": "13.7",
			"GoArch": "amd64",
			"GoArchVar": "v1",
			"GoVersion": "go1.26.6",
			"Hostname": "exit-node",
			"IPNVersion": "1.102.4-t3caf7d9e7-g084ee3b64",
			"Machine": "x86_64",
			"NetInfo": {
				"DERPLatency": {
					"999-v4": 0.00095692
				},
				"FirewallMode": "ipt-default",
				"OSHasIPv6": true,
				"PCP": false,
				"PMP": false,
				"PreferredDERP": 999,
				"UPnP": false,
				"WorkingICMPv4": false,
				"WorkingIPv6": false,
				"WorkingUDP": true
			},
			"OS": "linux",
			"OSVersion": "6.12.107+deb13-cloud-amd64",
			"RoutableIPs": [
				"0.0.0.0/0",
				"::/0"
			],
			"Services": [
				{
					"Port": 58436,
					"Proto": "peerapi4"
				},
				{
					"Port": 59780,
					"Proto": "peerapi6"
				},
				{
					"Port": 1,
					"Proto": "peerapi-dns-proxy"
				}
			],
			"StateEncrypted": false,
			"Userspace": false,
			"UserspaceRouter": false
		},
		"ID": 1,
		"Key": "nodekey:7adfd2c87640630e55bd12c319fb44fdd5d15759cc8e6261c4865557c5bfa669",
		"Machine": "mkey:b46f3a67c71c75c9d95ac5408a45476a05d70bcfec30bf844ed3e4b5441f9d24",
		"MachineAuthorized": true,
		"Name": "exit-node.ts.ci.test.",
		"Online": true,
		"StableID": "1",
		"User": 1
	},
	"TKAEnabled": false,
	"TKAHead": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
	"UserProfiles": {
		"1": {
			"DisplayName": "family",
			"ID": 1,
			"LoginName": "family"
		}
	}
}

tailscale status --json at the same moment:

status.json
json
{
  "Version": "1.102.4-t3caf7d9e7-g084ee3b64",
  "TUN": true,
  "BackendState": "Running",
  "HaveNodeKey": true,
  "AuthURL": "",
  "TailscaleIPs": [
    "100.64.0.1",
    "fd7a:115c:a1e0::1"
  ],
  "Self": {
    "ID": "1",
    "NodeID": 1,
    "PublicKey": "nodekey:7adfd2c87640630e55bd12c319fb44fdd5d15759cc8e6261c4865557c5bfa669",
    "HostName": "exit-node",
    "DNSName": "exit-node.ts.ci.test.",
    "OS": "linux",
    "UserID": 1,
    "TailscaleIPs": [
      "100.64.0.1",
      "fd7a:115c:a1e0::1"
    ],
    "AllowedIPs": [
      "100.64.0.1/32",
      "fd7a:115c:a1e0::1/128"
    ],
    "Addrs": [
      "172.30.0.1:40190",
      "10.0.2.15:41641",
      "10.2.0.2:41641",
      "172.17.0.1:41641",
      "172.30.0.1:41641",
      "192.0.2.1:41641",
      "[fec0::5054:ff:fe12:3456]:41641"
    ],
    "CurAddr": "",
    "Relay": "headscale",
    "PeerRelay": "",
    "RxBytes": 0,
    "TxBytes": 0,
    "Created": "2026-09-27T14:24:39.446940661Z",
    "LastWrite": "0001-01-01T00:00:00Z",
    "LastSeen": "0001-01-01T00:00:00Z",
    "LastHandshake": "0001-01-01T00:00:00Z",
    "Online": true,
    "ExitNode": false,
    "ExitNodeOption": false,
    "Active": false,
    "PeerAPIURL": [
      "http://100.64.0.1:58436",
      "http://[fd7a:115c:a1e0::1]:59780"
    ],
    "TaildropTarget": 0,
    "NoFileSharingReason": "",
    "Capabilities": [
      "HTTPS://TAILSCALE.COM/s/DEPRECATED-NODE-CAPS#see-https://github.com/tailscale/tailscale/issues/11508",
      "default-auto-update",
      "https://tailscale.com/cap/file-sharing",
      "https://tailscale.com/cap/is-admin",
      "https://tailscale.com/cap/ssh"
    ],
    "CapMap": {
      "default-auto-update": [
        false
      ],
      "https://tailscale.com/cap/file-sharing": [],
      "https://tailscale.com/cap/is-admin": [],
      "https://tailscale.com/cap/ssh": []
    },
    "InNetworkMap": true,
    "InMagicSock": false,
    "InEngine": false
  },
  "Health": [],
  "MagicDNSSuffix": "ts.ci.test",
  "CurrentTailnet": {
    "Name": "hs.ci.test",
    "MagicDNSSuffix": "ts.ci.test",
    "MagicDNSEnabled": true
  },
  "CertDomains": null,
  "ExtraRecords": [
    {
      "Name": "mdm.ci.test",
      "Type": "A",
      "Value": "100.64.0.1"
    }
  ],
  "Peer": null,
  "User": {
    "1": {
      "ID": 1,
      "LoginName": "family",
      "DisplayName": "family"
    }
  },
  "ClientVersion": null
}

Headscale log at trace level: the approval at 14:56:18, then the two halves of the toggle at 14:56:39 and 14:56:42 (http request lines of the keepalives removed):

headscale trace
2026-09-27T14:56:18Z DBG hscontrol/grpcv1.go:371 > gRPC SetApprovedRoutes called node.id=1 requestedRoutes=["0.0.0.0/0","::/0"]
2026-09-27T14:56:19Z TRC Policy evaluation detected no changes - all hashes match
2026-09-27T14:56:19Z DBG hscontrol/grpcv1.go:409 > gRPC SetApprovedRoutes completed approvedRoutes=["0.0.0.0/0","::/0"] finalSubnetRoutes=[] node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true primaryRoutes=[] 
2026-09-27T14:56:20Z DBG hscontrol/mapper/batcher.go:177 > node change processing started node.id=1 reason="policy change"
2026-09-27T14:56:20Z TRC send: broadcasting node.id=1 total_connections=1
2026-09-27T14:56:20Z TRC send: broadcast complete failed_connections=0 node.id=1 successful_sends=1
2026-09-27T14:56:20Z TRC hscontrol/poll.go:313 > received update from channel component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true ok=true omit_peers=false stream=true 
2026-09-27T14:56:20Z TRC hscontrol/poll.go:359 > finished writing mapresp to node chan=0x12bac2bf29a0 component=poll keepalive=false node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true timeSpent=0.160561 
2026-09-27T14:56:20Z TRC hscontrol/poll.go:326 > update sent component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true 
2026-09-27T14:56:39Z TRC hscontrol/noise.go:760 > a node sending a MapRequest with Noise protocol component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=true stream=false 
2026-09-27T14:56:39Z TRC hscontrol/state/state.go:3020 > Processing MapRequest for node endpoints_count=7 node.id=1 node.key=[et/Sy] omit_peers=true stream=false version=142
2026-09-27T14:56:40Z DBG hscontrol/state/state.go:3138 > announced routes changed but approved routes did not approvedRoutes=["0.0.0.0/0","::/0"] newAnnouncedRoutes=[] node.id=1 oldAnnouncedRoutes=["0.0.0.0/0","::/0"] routeChanged=false
2026-09-27T14:56:40Z TRC Policy evaluation detected no changes - all hashes match
2026-09-27T14:56:40Z INF http request bytes=0 elapsed=876.089766 method=POST path=/machine/map proto=HTTP/2.0 remote=172.30.0.5:32866 status=200
2026-09-27T14:56:41Z DBG hscontrol/mapper/batcher.go:177 > node change processing started node.id=1 reason="policy change"
2026-09-27T14:56:41Z TRC send: broadcasting node.id=1 total_connections=1
2026-09-27T14:56:41Z TRC send: broadcast complete failed_connections=0 node.id=1 successful_sends=1
2026-09-27T14:56:41Z TRC hscontrol/poll.go:313 > received update from channel component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true ok=true omit_peers=false stream=true 
2026-09-27T14:56:41Z TRC hscontrol/poll.go:359 > finished writing mapresp to node chan=0x12bac2bf29a0 component=poll keepalive=false node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true timeSpent=0.310003 
2026-09-27T14:56:41Z TRC hscontrol/poll.go:326 > update sent component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true 
2026-09-27T14:56:42Z TRC hscontrol/noise.go:760 > a node sending a MapRequest with Noise protocol component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=true stream=false 
2026-09-27T14:56:42Z TRC hscontrol/state/state.go:3020 > Processing MapRequest for node endpoints_count=7 node.id=1 node.key=[et/Sy] omit_peers=true stream=false version=142
2026-09-27T14:56:43Z DBG hscontrol/state/state.go:3138 > announced routes changed but approved routes did not approvedRoutes=["0.0.0.0/0","::/0"] newAnnouncedRoutes=["0.0.0.0/0","::/0"] node.id=1 oldAnnouncedRoutes=[] routeChanged=false
2026-09-27T14:56:43Z TRC Policy evaluation detected no changes - all hashes match
2026-09-27T14:56:43Z INF http request bytes=0 elapsed=854.718172 method=POST path=/machine/map proto=HTTP/2.0 remote=172.30.0.5:32866 status=200
2026-09-27T14:56:44Z DBG hscontrol/mapper/batcher.go:177 > node change processing started node.id=1 reason="policy change"
2026-09-27T14:56:44Z TRC send: broadcasting node.id=1 total_connections=1
2026-09-27T14:56:44Z TRC send: broadcast complete failed_connections=0 node.id=1 successful_sends=1
2026-09-27T14:56:44Z TRC hscontrol/poll.go:313 > received update from channel component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true ok=true omit_peers=false stream=true 
2026-09-27T14:56:44Z TRC hscontrol/poll.go:359 > finished writing mapresp to node chan=0x12bac2bf29a0 component=poll keepalive=false node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true timeSpent=0.212257 
2026-09-27T14:56:44Z TRC hscontrol/poll.go:326 > update sent component=poll node.id=1 node.key=[et/Sy] node.name=exit-node node.online=true omit_peers=false stream=true 

Headscale configuration:

config.yaml
yaml
---
server_url: https://hs.ci.test
listen_addr: 0.0.0.0:8080
metrics_listen_addr: 127.0.0.1:9090
grpc_listen_addr: 127.0.0.1:50443
grpc_allow_insecure: false
noise:
  private_key_path: /var/lib/headscale/noise_private.key
prefixes:
  v4: 100.64.0.0/10
  v6: fd7a:115c:a1e0::/48
derp:
  server:
    enabled: true
    region_id