mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-04 04:34:07 +09:00
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:
1 parent
f4af5e0286
commit
75040798e4
1 file changed
+8
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user