Skip to content

Commit 9a352f2

Browse files
fix: ACLPolicy check for hnsv2 (#815)
Current code is incorrectly checking against EndpointPolicyType.
1 parent 79fd586 commit 9a352f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

network/policy/policy_windows.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,11 @@ func GetPolicyType(policy Policy) CNIPolicyType {
215215
}
216216

217217
// Check if the type is ACLPolicy
218-
if policy.Type == ACLPolicy {
219-
return ACLPolicy
218+
var aclPolicy hcn.AclPolicySetting
219+
if err := json.Unmarshal(policy.Data, &aclPolicy); err == nil {
220+
if aclPolicy.Action != "" {
221+
return ACLPolicy
222+
}
220223
}
221224

222225
// Return empty string if the policy type is invalid

0 commit comments

Comments
 (0)