servertest: count deleted nodes in replayed peer views

Only nodes still in State resolved to an alias, so a client that kept
a deleted peer passed the peers and route owner checks.
This commit is contained in:
Kristoffer Dalby committed 2026-10-30 14:55:35 +00:00
1 parent 31a6200e00
commit 5511cd6afc
1 file changed
+8 -1
+8 -1
View File
@@ -1229,7 +1229,8 @@ func (r *stepReplay) saasAlias(id tailcfg.NodeID) (string, bool) {
return "", false
}
// hsAlias is the alias whose machine holds node id.
// hsAlias is the alias whose machine holds node id, or last held it: a
// deleted node a client still lists must count, as saasAlias counts it.
func (r *stepReplay) hsAlias(id tailcfg.NodeID) (string, bool) {
for alias := range r.clients {
for _, nv := range r.machineNodes(alias) {
@@ -1239,6 +1240,12 @@ func (r *stepReplay) hsAlias(id tailcfg.NodeID) (string, bool) {
}
}
for alias, last := range r.lastIDs {
if last == strconv.FormatInt(int64(id), 10) {
return alias, true
}
}
return "", false
}