Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "check for custom all policies" #3175

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions logic/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func CreateDefaultAclNetworkPolicies(netID models.NetworkID) {
ID: models.UserAclID,
Value: "*",
},
{
ID: models.UserGroupAclID,
Value: "*",
},
},
Dst: []models.AclPolicyTag{{
ID: models.DeviceAclID,
Expand Down Expand Up @@ -281,27 +285,6 @@ func GetDefaultPolicy(netID models.NetworkID, ruleType models.AclPolicyType) (mo
if err != nil {
return models.Acl{}, errors.New("default rule not found")
}
if acl.Enabled {
return acl, nil
}
// check if there are any custom all policies
policies, _ := ListAcls(netID)
for _, policy := range policies {
if !policy.Enabled {
continue
}
if policy.RuleType == ruleType {
dstMap := convAclTagToValueMap(policy.Dst)
srcMap := convAclTagToValueMap(policy.Dst)
if _, ok := srcMap["*"]; ok {
if _, ok := dstMap["*"]; ok {
return policy, nil
}
}
}

}

return acl, nil
}

Expand Down Expand Up @@ -484,6 +467,11 @@ func IsNodeAllowedToCommunicate(node, peer models.Node) bool {
// fmt.Printf("\n======> DSTMAP: %+v\n", dstMap)
// fmt.Printf("\n======> node Tags: %+v\n", node.Tags)
// fmt.Printf("\n======> peer Tags: %+v\n", peer.Tags)
if _, ok := srcMap["*"]; ok {
if _, ok := dstMap["*"]; ok {
return true
}
}
for tagID := range node.Tags {
if _, ok := dstMap[tagID.String()]; ok {
if _, ok := srcMap["*"]; ok {
Expand Down
Loading