diff --git a/management/server/http/handlers/policies/policies_handler.go b/management/server/http/handlers/policies/policies_handler.go index 9ff7ea0ea33..4d8cce3d41c 100644 --- a/management/server/http/handlers/policies/policies_handler.go +++ b/management/server/http/handlers/policies/policies_handler.go @@ -255,23 +255,12 @@ func (h *handler) savePolicy(w http.ResponseWriter, r *http.Request, accountID s } // validate policy object - switch pr.Protocol { - case types.PolicyRuleProtocolALL, types.PolicyRuleProtocolICMP: + if pr.Protocol == types.PolicyRuleProtocolALL || pr.Protocol == types.PolicyRuleProtocolICMP { if len(pr.Ports) != 0 || len(pr.PortRanges) != 0 { util.WriteError(r.Context(), status.Errorf(status.InvalidArgument, "for ALL or ICMP protocol ports is not allowed"), w) return } - if !pr.Bidirectional { - util.WriteError(r.Context(), status.Errorf(status.InvalidArgument, "for ALL or ICMP protocol type flow can be only bi-directional"), w) - return - } - case types.PolicyRuleProtocolTCP, types.PolicyRuleProtocolUDP: - if !pr.Bidirectional && (len(pr.Ports) == 0 || len(pr.PortRanges) != 0) { - util.WriteError(r.Context(), status.Errorf(status.InvalidArgument, "for ALL or ICMP protocol type flow can be only bi-directional"), w) - return - } } - policy.Rules = append(policy.Rules, &pr) }