From e36eef476a9e89c813259c4df47d56dc86285894 Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 4 Nov 2024 12:38:08 +0400 Subject: [PATCH] perform acl operations on cloned map --- logic/acls/nodeacls/retrieve.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/logic/acls/nodeacls/retrieve.go b/logic/acls/nodeacls/retrieve.go index d5fa68c40..195ac4971 100644 --- a/logic/acls/nodeacls/retrieve.go +++ b/logic/acls/nodeacls/retrieve.go @@ -3,6 +3,7 @@ package nodeacls import ( "encoding/json" "fmt" + "maps" "sync" "github.com/gravitl/netmaker/logic/acls" @@ -20,8 +21,9 @@ func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool { } var allowed bool acls.AclMutex.Lock() - currNetworkACLNode1 := currentNetworkACL[acls.AclID(node1)] - currNetworkACLNode2 := currentNetworkACL[acls.AclID(node2)] + currNetAclCopy := maps.Clone(currentNetworkACL) + currNetworkACLNode1 := currNetAclCopy[acls.AclID(node1)] + currNetworkACLNode2 := currNetAclCopy[acls.AclID(node2)] acls.AclMutex.Unlock() allowed = currNetworkACLNode1.IsAllowed(acls.AclID(node2)) && currNetworkACLNode2.IsAllowed(acls.AclID(node1)) return allowed