Skip to content

Commit

Permalink
Merge pull request #3338 from gravitl/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
abhishek9686 authored Feb 18, 2025
2 parents f028a63 + ee6bea1 commit 7bc7b25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func hostUpdateFallback(w http.ResponseWriter, r *http.Request) {
var hostUpdate models.HostUpdate
err = json.NewDecoder(r.Body).Decode(&hostUpdate)
if err != nil {
slog.Error("failed to update a host:", "user", r.Header.Get("user"), "error", err.Error())
slog.Error("failed to update a host:", "user", r.Header.Get("user"), "error", err.Error(), "host", currentHost.Name)
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
}
Expand Down
5 changes: 5 additions & 0 deletions logic/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
var (
aclCacheMutex = &sync.RWMutex{}
aclCacheMap = make(map[string]models.Acl)
aclTagsMutex = &sync.RWMutex{}
)

func MigrateAclPolicies() {
Expand Down Expand Up @@ -576,8 +577,10 @@ func IsPeerAllowed(node, peer models.Node, checkDefaultPolicy bool) bool {
if peer.IsStatic {
peer = peer.StaticNode.ConvertToStaticNode()
}
aclTagsMutex.RLock()
peerTags := maps.Clone(peer.Tags)
nodeTags := maps.Clone(node.Tags)
aclTagsMutex.RUnlock()
if checkDefaultPolicy {
// check default policy if all allowed return true
defaultPolicy, err := GetDefaultPolicy(models.NetworkID(node.Network), models.DevicePolicy)
Expand Down Expand Up @@ -660,8 +663,10 @@ func IsNodeAllowedToCommunicate(node, peer models.Node, checkDefaultPolicy bool)
if peer.IsStatic {
peer = peer.StaticNode.ConvertToStaticNode()
}
aclTagsMutex.RLock()
peerTags := maps.Clone(peer.Tags)
nodeTags := maps.Clone(node.Tags)
aclTagsMutex.RUnlock()
if checkDefaultPolicy {
// check default policy if all allowed return true
defaultPolicy, err := GetDefaultPolicy(models.NetworkID(node.Network), models.DevicePolicy)
Expand Down

0 comments on commit 7bc7b25

Please sign in to comment.