From d0c4332359e5b23b91104ca78a4edd8adc103c48 Mon Sep 17 00:00:00 2001 From: ahusic Date: Tue, 24 Sep 2024 17:01:34 +0200 Subject: [PATCH] BUG/MINOR: add missing rst-ttl option to relevant keywords --- configuration/http_request_rule.go | 2 ++ configuration/http_response_rule.go | 2 ++ configuration/tcp_request_rule.go | 6 ++++ configuration/tcp_response_rule.go | 4 ++- models/http_request_rule.go | 3 ++ models/http_response_rule.go | 3 ++ models/tcp_request_rule.go | 3 ++ models/tcp_response_rule.go | 3 ++ specification/build/haproxy_spec.yaml | 32 +++++++++++++++++++ .../models/configuration/http/request.yaml | 7 ++++ .../models/configuration/http/response.yaml | 7 ++++ .../models/configuration/tcp/request.yaml | 7 ++++ .../models/configuration/tcp/response.yaml | 7 ++++ 13 files changed, 85 insertions(+), 1 deletion(-) diff --git a/configuration/http_request_rule.go b/configuration/http_request_rule.go index 4239b127..75b2cbc5 100644 --- a/configuration/http_request_rule.go +++ b/configuration/http_request_rule.go @@ -647,6 +647,7 @@ func ParseHTTPRequestRule(f types.Action) (rule *models.HTTPRequestRule, err err } case *actions.SilentDrop: rule = &models.HTTPRequestRule{ + RstTTL: v.RstTTL, Type: "silent-drop", Cond: v.Cond, CondTest: v.CondTest, @@ -1103,6 +1104,7 @@ func SerializeHTTPRequestRule(f models.HTTPRequestRule) (rule types.Action, err } case "silent-drop": rule = &actions.SilentDrop{ + RstTTL: f.RstTTL, Cond: f.Cond, CondTest: f.CondTest, } diff --git a/configuration/http_response_rule.go b/configuration/http_response_rule.go index 5a3b5811..51773412 100644 --- a/configuration/http_response_rule.go +++ b/configuration/http_response_rule.go @@ -483,6 +483,7 @@ func ParseHTTPResponseRule(f types.Action) *models.HTTPResponseRule { //nolint:m } case *actions.SilentDrop: return &models.HTTPResponseRule{ + RstTTL: v.RstTTL, Type: "silent-drop", Cond: v.Cond, CondTest: v.CondTest, @@ -770,6 +771,7 @@ func SerializeHTTPResponseRule(f models.HTTPResponseRule) (rule types.Action, er } case "silent-drop": rule = &actions.SilentDrop{ + RstTTL: f.RstTTL, Cond: f.Cond, CondTest: f.CondTest, } diff --git a/configuration/tcp_request_rule.go b/configuration/tcp_request_rule.go index 5287aa3d..3b230115 100644 --- a/configuration/tcp_request_rule.go +++ b/configuration/tcp_request_rule.go @@ -307,6 +307,7 @@ func ParseTCPRequestRule(f types.TCPType) (rule *models.TCPRequestRule, err erro rule.CondTest = a.CondTest case *actions.SilentDrop: rule.Action = models.TCPRequestRuleActionSilentDashDrop + rule.RstTTL = a.RstTTL rule.Cond = a.Cond rule.CondTest = a.CondTest case *actions.Lua: @@ -478,6 +479,7 @@ func ParseTCPRequestRule(f types.TCPType) (rule *models.TCPRequestRule, err erro rule.CondTest = a.CondTest case *actions.SilentDrop: rule.Action = models.TCPRequestRuleActionSilentDashDrop + rule.RstTTL = a.RstTTL rule.Cond = a.Cond rule.CondTest = a.CondTest case *actions.SendSpoeGroup: @@ -647,6 +649,7 @@ func ParseTCPRequestRule(f types.TCPType) (rule *models.TCPRequestRule, err erro rule.CondTest = a.CondTest case *actions.SilentDrop: rule.Action = models.TCPRequestRuleActionSilentDashDrop + rule.RstTTL = a.RstTTL rule.Cond = a.Cond rule.CondTest = a.CondTest default: @@ -794,6 +797,7 @@ func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err e case models.TCPRequestRuleActionSilentDashDrop: return &tcp_types.Connection{ Action: &actions.SilentDrop{ + RstTTL: f.RstTTL, Cond: f.Cond, CondTest: f.CondTest, }, @@ -1076,6 +1080,7 @@ func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err e case models.TCPRequestRuleActionSilentDashDrop: return &tcp_types.Content{ Action: &actions.SilentDrop{ + RstTTL: f.RstTTL, Cond: f.Cond, CondTest: f.CondTest, }, @@ -1364,6 +1369,7 @@ func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err e case models.TCPRequestRuleActionSilentDashDrop: return &tcp_types.Session{ Action: &actions.SilentDrop{ + RstTTL: f.RstTTL, Cond: f.Cond, CondTest: f.CondTest, }, diff --git a/configuration/tcp_response_rule.go b/configuration/tcp_response_rule.go index 6f910c42..f43bbca0 100644 --- a/configuration/tcp_response_rule.go +++ b/configuration/tcp_response_rule.go @@ -350,6 +350,7 @@ func ParseTCPResponseRule(t types.TCPType) (*models.TCPResponseRule, error) { // return &models.TCPResponseRule{ Type: models.TCPResponseRuleTypeContent, Action: models.TCPResponseRuleActionSilentDashDrop, + RstTTL: a.RstTTL, Cond: a.Cond, CondTest: a.CondTest, }, nil @@ -385,7 +386,7 @@ func ParseTCPResponseRule(t types.TCPType) (*models.TCPResponseRule, error) { // return nil, NewConfError(ErrValidationError, "invalid action") } -func SerializeTCPResponseRule(t models.TCPResponseRule) (types.TCPType, error) { +func SerializeTCPResponseRule(t models.TCPResponseRule) (types.TCPType, error) { //nolint:maintidx switch t.Type { case models.TCPResponseRuleTypeContent: switch t.Action { @@ -531,6 +532,7 @@ func SerializeTCPResponseRule(t models.TCPResponseRule) (types.TCPType, error) { case models.TCPResponseRuleActionSilentDashDrop: return &tcp_types.Content{ Action: &actions.SilentDrop{ + RstTTL: t.RstTTL, Cond: t.Cond, CondTest: t.CondTest, }, diff --git a/models/http_request_rule.go b/models/http_request_rule.go index 52883425..bdd32a1b 100644 --- a/models/http_request_rule.go +++ b/models/http_request_rule.go @@ -210,6 +210,9 @@ type HTTPRequestRule struct { // Minimum: 200 ReturnStatusCode *int64 `json:"return_status_code,omitempty"` + // rst ttl + RstTTL int64 `json:"rst_ttl,omitempty"` + // sc expr ScExpr string `json:"sc_expr,omitempty"` diff --git a/models/http_response_rule.go b/models/http_response_rule.go index 80a16a7a..25bb511f 100644 --- a/models/http_response_rule.go +++ b/models/http_response_rule.go @@ -160,6 +160,9 @@ type HTTPResponseRule struct { // Minimum: 200 ReturnStatusCode *int64 `json:"return_status_code,omitempty"` + // rst ttl + RstTTL int64 `json:"rst_ttl,omitempty"` + // sc expr ScExpr string `json:"sc_expr,omitempty"` diff --git a/models/tcp_request_rule.go b/models/tcp_request_rule.go index 27237feb..8af5a11d 100644 --- a/models/tcp_request_rule.go +++ b/models/tcp_request_rule.go @@ -105,6 +105,9 @@ type TCPRequestRule struct { // resolve var ResolveVar string `json:"resolve_var,omitempty"` + // rst ttl + RstTTL int64 `json:"rst_ttl,omitempty"` + // sc idx ScIdx string `json:"sc_idx,omitempty"` diff --git a/models/tcp_response_rule.go b/models/tcp_response_rule.go index 40fcf449..9ac36ad1 100644 --- a/models/tcp_response_rule.go +++ b/models/tcp_response_rule.go @@ -85,6 +85,9 @@ type TCPResponseRule struct { // Minimum: -1024 NiceValue int64 `json:"nice_value,omitempty"` + // rst ttl + RstTTL int64 `json:"rst_ttl,omitempty"` + // sc expr ScExpr string `json:"sc_expr,omitempty"` diff --git a/specification/build/haproxy_spec.yaml b/specification/build/haproxy_spec.yaml index 0a0f6942..396dcc1f 100644 --- a/specification/build/haproxy_spec.yaml +++ b/specification/build/haproxy_spec.yaml @@ -4053,6 +4053,14 @@ definitions: value: return x-display-name: Return Error Code x-nullable: true + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL sc_expr: type: string x-dependency: @@ -4663,6 +4671,14 @@ definitions: value: return x-display-name: Return Error Code x-nullable: true + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL sc_expr: type: string x-dependency: @@ -5806,6 +5822,14 @@ definitions: value: - content x-display-name: Variable name + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL sc_idx: type: string x-dependency: @@ -6172,6 +6196,14 @@ definitions: value: content x-display-name: Nice Value x-nullable: false + rst_ttl: + type: integer + x-dependency: + type: + required: true + value: + - silent-drop + x-display-name: RST TTL sc_expr: type: string x-dependency: diff --git a/specification/models/configuration/http/request.yaml b/specification/models/configuration/http/request.yaml index 49e76d1d..a22a259c 100644 --- a/specification/models/configuration/http/request.yaml +++ b/specification/models/configuration/http/request.yaml @@ -281,6 +281,13 @@ http_request_rule: type: value: set-log-level required: true + rst_ttl: + type: integer + x-display-name: RST TTL + x-dependency: + type: + value: [silent-drop] + required: true path_match: type: string pattern: '^[^\s]+$' diff --git a/specification/models/configuration/http/response.yaml b/specification/models/configuration/http/response.yaml index eb009f05..8aade778 100644 --- a/specification/models/configuration/http/response.yaml +++ b/specification/models/configuration/http/response.yaml @@ -133,6 +133,13 @@ http_response_rule: type: value: set-log-level required: true + rst_ttl: + type: integer + x-display-name: RST TTL + x-dependency: + type: + value: [silent-drop] + required: true var_name: type: string pattern: '^[^\s]+$' diff --git a/specification/models/configuration/tcp/request.yaml b/specification/models/configuration/tcp/request.yaml index 4cb97147..4ec8ea79 100644 --- a/specification/models/configuration/tcp/request.yaml +++ b/specification/models/configuration/tcp/request.yaml @@ -316,6 +316,13 @@ tcp_request_rule: required: true type: value: content + rst_ttl: + type: integer + x-display-name: RST TTL + x-dependency: + type: + value: [silent-drop] + required: true mark_value: type: string pattern: "^(0x[0-9A-Fa-f]+|[0-9]+)$" diff --git a/specification/models/configuration/tcp/response.yaml b/specification/models/configuration/tcp/response.yaml index 9e3ad07f..6d98a28c 100644 --- a/specification/models/configuration/tcp/response.yaml +++ b/specification/models/configuration/tcp/response.yaml @@ -165,6 +165,13 @@ tcp_response_rule: required: true type: value: content + rst_ttl: + type: integer + x-display-name: RST TTL + x-dependency: + type: + value: [silent-drop] + required: true mark_value: type: string pattern: "^(0x[0-9A-Fa-f]+|[0-9]+)$"