Skip to content

Commit

Permalink
dont update change nodes we cant access
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Jul 5, 2023
1 parent 03369f0 commit b5be2ef
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hscontrol/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,26 @@ func (m Mapper) PeerChangedResponse(
lastSeen[tailcfg.NodeID(peer.ID)] = true
}

rules, _, err := policy.GenerateFilterAndSSHRules(
pol,
machine,
changed,
)
if err != nil {
return nil, err
}

// Filter out peers that have expired.
changed = lo.Filter(changed, func(item types.Machine, index int) bool {
return !item.IsExpired()
})

// If there are filter rules present, see if there are any machines that cannot
// access eachother at all and remove them from the changed.
if len(rules) > 0 {
changed = policy.FilterMachinesByACL(machine, changed, rules)
}

tailPeers, err := tailNodes(changed, pol, m.dnsCfg, m.baseDomain)
if err != nil {
return nil, err
Expand Down

0 comments on commit b5be2ef

Please sign in to comment.