Extend protocol and firewall manager to handle old management (#915)

* Extend protocol and firewall manager to handle old management

* Send correct empty firewall rules list when delete peer

* Add extra tests for firewall manager and uspfilter

* Work with inconsistent state

* Review note

* Update comment
This commit is contained in:
Givi Khojanashvili
2023-05-31 21:04:38 +04:00
committed by GitHub
parent 45a6263adc
commit 293499c3c0
13 changed files with 362 additions and 220 deletions

View File

@@ -242,6 +242,9 @@ func (a *Account) connResourcesGenerator() (func(*PolicyRule, []*Peer, int), fun
peers := make([]*Peer, 0)
return func(rule *PolicyRule, groupPeers []*Peer, direction int) {
for _, peer := range groupPeers {
if peer == nil {
continue
}
if _, ok := peersExists[peer.ID]; !ok {
peers = append(peers, peer)
peersExists[peer.ID] = struct{}{}
@@ -457,8 +460,8 @@ func getAllPeersFromGroups(account *Account, groups []string, peerID string) ([]
}
for _, p := range group.Peers {
peer := account.Peers[p]
if peer.ID == peerID {
peer, ok := account.Peers[p]
if ok && peer != nil && peer.ID == peerID {
peerInGroups = true
continue
}