ACL firewall manager fix/improvement (#970)

* ACL firewall manager fix/improvement

Fix issue with rule squashing, it contained issue when calculated
total amount of IPs in the Peer map (doesn't included offline peers).
That why squashing not worked.
Also this commit changes the rules apply behaviour. Instead policy:
1. Apply all rules from network map
2. Remove all previous applied rules
We do:
1. Apply only new rules
2. Remove outdated rules
Why first variant was implemented: because when you have drop policy
it is important in which order order you rules are and you need totally
clean previous state to apply the new. But in the release we didn't
include drop policy so we can do this improvement.

* Print log message about processed ACL rules
This commit is contained in:
Givi Khojanashvili
2023-06-20 22:33:41 +04:00
committed by GitHub
parent 20ae540fb1
commit c20f98c8b6
3 changed files with 77 additions and 22 deletions

View File

@ -1,5 +1,9 @@
package firewall
import (
"strconv"
)
// Protocol is the protocol of the port
type Protocol string
@ -28,3 +32,15 @@ type Port struct {
// Values contains one value for single port, multiple values for the list of ports, or two values for the range of ports
Values []int
}
// String interface implementation
func (p *Port) String() string {
var ports string
for _, port := range p.Values {
if ports != "" {
ports += ","
}
ports += strconv.Itoa(port)
}
return ports
}