types: leave MachineAuthorized off peer entries

SaaS sets it only on a node's own entry, the only one clients read.

Updates #3626
This commit is contained in:
Kristoffer Dalby committed 2026-11-03 16:29:03 +01:00
1 parent 0d5e4f28e9
commit 7d50f33e32
4 files changed
+14 -20

No files matched your search

+3 -2
View File
@@ -109,8 +109,9 @@ func (b *MapResponseBuilder) WithSelfNode() *MapResponseBuilder {
func(p netip.Prefix) bool { return !b.mapper.cfg.ServesRoute(p) },
)
// As on Tailscale SaaS, an expired node's own entry stays authorised and
// unmarked; the client reads its expiry from the past KeyExpiry.
// As on Tailscale SaaS, only a node's own entry is authorised, and an
// expired node's stays so and unmarked; the client reads its expiry from
// the past KeyExpiry.
tailnode.MachineAuthorized = true
tailnode.Expired = false
+8 -12
View File
@@ -68,11 +68,10 @@ func TestTailNode(t *testing.T) {
dnsConfig: &tailcfg.DNSConfig{},
baseDomain: "",
want: &tailcfg.Node{
Name: "empty",
StableID: "0",
HomeDERP: 0,
Hostinfo: hiview(tailcfg.Hostinfo{}),
MachineAuthorized: true,
Name: "empty",
StableID: "0",
HomeDERP: 0,
Hostinfo: hiview(tailcfg.Hostinfo{}),
CapMap: tailcfg.NodeCapMap{
nodecap.Admin: []tailcfg.RawMessage{},
@@ -159,8 +158,6 @@ func TestTailNode(t *testing.T) {
Tags: []string{},
MachineAuthorized: true,
CapMap: tailcfg.NodeCapMap{
nodecap.Admin: []tailcfg.RawMessage{},
nodecap.SSH: []tailcfg.RawMessage{},
@@ -181,11 +178,10 @@ func TestTailNode(t *testing.T) {
baseDomain: "example.com",
want: &tailcfg.Node{
// a node name should have a dot appended
Name: "minimal.example.com.",
StableID: "0",
HomeDERP: 0,
Hostinfo: hiview(tailcfg.Hostinfo{}),
MachineAuthorized: true,
Name: "minimal.example.com.",
StableID: "0",
HomeDERP: 0,
Hostinfo: hiview(tailcfg.Hostinfo{}),
CapMap: tailcfg.NodeCapMap{
nodecap.Admin: []tailcfg.RawMessage{},
@@ -60,9 +60,8 @@ var mapStreamSkipReasons = map[string]string{
"map-delivery/S3.5-remove/db1/frames": policyResponseToEveryNode,
"map-delivery/S3.5-restore/db1/frames": policyResponseToEveryNode,
"map-delivery/S2.0/peer-entry/MachineAuthorized": peerAuthorizedSent,
"map-delivery/S2.0/own-entry/Cap": ownCapSent,
"map-delivery/S2.0/own-entry/Online": ownOnlineSent,
"map-delivery/S2.0/own-entry/Cap": ownCapSent,
"map-delivery/S2.0/own-entry/Online": ownOnlineSent,
"map-delivery/S2.5/laptop/endpoints-gap-bystander": restartEndpointsKept,
"map-delivery/S2.5/laptop/endpoints-gap-svc": restartEndpointsKept,
@@ -103,7 +102,6 @@ var mapStreamSkipReasons = map[string]string{
const (
policyResponseToEveryNode = "POLICY_RESPONSE_TO_EVERY_NODE: headscale sends every connected node a policy response when the policy, a node's tags or approved routes, or the set of nodes change; SaaS sends only the nodes whose peers or filter change"
restartEndpointsKept = "RESTART_ENDPOINTS_KEPT: headscale keeps a restarted node's last endpoints at its peers until it reports new ones; SaaS sends peers the node without endpoints until then"
peerAuthorizedSent = "PEER_AUTHORIZED_SENT: headscale sets MachineAuthorized on peer entries; SaaS only on a node's own"
ownCapSent = "OWN_CAP_SENT: headscale sets Cap on a node's own entry; SaaS only on peers"
ownOnlineSent = "OWN_ONLINE_SENT: headscale sets Online on a node's own entry; SaaS only on peers"
)
+1 -2
View File
@@ -1484,8 +1484,7 @@ func (nv NodeView) TailNode(
Tags: nv.Tags().AsSlice(),
MachineAuthorized: !nv.IsExpired(),
Expired: nv.IsExpired(),
Expired: nv.IsExpired(),
}
// Set LastSeen only for offline nodes to avoid confusing Tailscale clients