[management] added exception on not appending route firewall rules if we have all wildcard (#4801)

This commit is contained in:
Vlad
2025-11-17 18:20:30 +01:00
committed by GitHub
parent d71a82769c
commit 4eeb2d8deb

View File

@@ -22,10 +22,11 @@ import (
) )
const ( const (
allPeers = "0.0.0.0" allPeers = "0.0.0.0"
fw = "fw:" allWildcard = "0.0.0.0/0"
rfw = "route-fw:" v6AllWildcard = "::/0"
nr = "network-resource-" fw = "fw:"
rfw = "route-fw:"
) )
type NetworkMapCache struct { type NetworkMapCache struct {
@@ -1640,6 +1641,10 @@ func (b *NetworkMapBuilder) updateRouteFirewallRules(routesView *PeerRoutesView,
} }
if string(rule.RouteID) == update.RuleID { if string(rule.RouteID) == update.RuleID {
if hasWildcard := slices.Contains(rule.SourceRanges, allWildcard) || slices.Contains(rule.SourceRanges, v6AllWildcard); hasWildcard {
break
}
sourceIP := update.AddSourceIP sourceIP := update.AddSourceIP
if strings.Contains(sourceIP, ":") { if strings.Contains(sourceIP, ":") {