Pārlūkot izejas kodu

fix acl rules for egress policies with new models

abhishek9686 4 mēneši atpakaļ
vecāks
revīzija
eb1b502259
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12 0
      logic/acls.go

+ 12 - 0
logic/acls.go

@@ -1450,6 +1450,18 @@ func checkIfAnyActiveEgressPolicy(targetNode models.Node) bool {
 		}
 		srcTags := convAclTagToValueMap(acl.Src)
 		dstTags := convAclTagToValueMap(acl.Dst)
+		for _, dst := range acl.Dst {
+			if dst.ID == models.EgressID {
+				e := schema.Egress{ID: dst.Value}
+				err := e.Get(db.WithContext(context.TODO()))
+				if err == nil {
+					for nodeID := range e.Nodes {
+						dstTags[nodeID] = struct{}{}
+					}
+					dstTags[e.Range] = struct{}{}
+				}
+			}
+		}
 		for nodeTag := range targetNodeTags {
 			if acl.RuleType == models.DevicePolicy {
 				if _, ok := srcTags[nodeTag.String()]; ok {