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-28 14:30:15 +00:00
1 parent edc64bf7b8
commit f87985073e
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
}