From effb7eb5d735c4c0c7e8907787279024fff4a40d Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Thu, 12 Dec 2024 02:30:32 +0400 Subject: [PATCH] fix all resources rules --- logic/acls.go | 4 +++- logic/nodes.go | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/logic/acls.go b/logic/acls.go index d623e5c5a..bd9f40257 100644 --- a/logic/acls.go +++ b/logic/acls.go @@ -844,6 +844,7 @@ func GetAclRulesForNode(targetnode *models.Node) (rules map[string]models.AclRul } acls := listDevicePolicies(models.NetworkID(targetnode.Network)) + targetnode.Tags["*"] = struct{}{} for nodeTag := range targetnode.Tags { for _, acl := range acls { if !acl.Enabled { @@ -944,7 +945,8 @@ func GetAclRulesForNode(targetnode *models.Node) (rules map[string]models.AclRul } } } else { - if _, ok := dstTags[nodeTag.String()]; ok { + _, all := dstTags["*"] + if _, ok := dstTags[nodeTag.String()]; ok || all { // get all src tags for src := range srcTags { if src == nodeTag.String() { diff --git a/logic/nodes.go b/logic/nodes.go index 9fe96a64d..368d7d674 100644 --- a/logic/nodes.go +++ b/logic/nodes.go @@ -829,6 +829,7 @@ func GetTagMapWithNodesByNetwork(netID models.NetworkID, withStaticNodes bool) ( tagNodesMap[nodeTagID] = append(tagNodesMap[nodeTagID], nodeI) } } + tagNodesMap["*"] = nodes if !withStaticNodes { return } @@ -850,6 +851,10 @@ func AddTagMapWithStaticNodes(netID models.NetworkID, IsStatic: true, StaticNode: extclient, }) + tagNodesMap["*"] = append(tagNodesMap["*"], models.Node{ + IsStatic: true, + StaticNode: extclient, + }) } }