Skip to content

Commit

Permalink
release maps
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 authored and yabinma committed Nov 18, 2024
1 parent 439cc87 commit 0d801e0
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions logic/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,20 @@ func GetDefaultPolicy(netID models.NetworkID, ruleType models.AclPolicyType) (mo
return acl, nil
}
// check if there are any custom all policies
srcMap := make(map[string]struct{})
dstMap := make(map[string]struct{})
defer func() {
srcMap = nil
dstMap = nil
}()
policies, _ := ListAcls(netID)
for _, policy := range policies {
if !policy.Enabled {
continue
}
if policy.RuleType == ruleType {
dstMap := convAclTagToValueMap(policy.Dst)
srcMap := convAclTagToValueMap(policy.Src)
dstMap = convAclTagToValueMap(policy.Dst)
srcMap = convAclTagToValueMap(policy.Src)
if _, ok := srcMap["*"]; ok {
if _, ok := dstMap["*"]; ok {
return policy, nil
Expand Down Expand Up @@ -528,12 +534,18 @@ func IsNodeAllowedToCommunicate(node, peer models.Node) bool {

// list device policies
policies := listDevicePolicies(models.NetworkID(peer.Network))
srcMap := make(map[string]struct{})
dstMap := make(map[string]struct{})
defer func() {
srcMap = nil
dstMap = nil
}()
for _, policy := range policies {
if !policy.Enabled {
continue
}
srcMap := convAclTagToValueMap(policy.Src)
dstMap := convAclTagToValueMap(policy.Dst)
srcMap = convAclTagToValueMap(policy.Src)
dstMap = convAclTagToValueMap(policy.Dst)
// fmt.Printf("\n======> SRCMAP: %+v\n", srcMap)
// fmt.Printf("\n======> DSTMAP: %+v\n", dstMap)
// fmt.Printf("\n======> node Tags: %+v\n", node.Tags)
Expand Down

0 comments on commit 0d801e0

Please sign in to comment.