Skip to content

Commit

Permalink
BUG/MINOR: add missing rst-ttl option to relevant keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
amelhusic committed Sep 26, 2024
1 parent 064b254 commit d0c4332
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 1 deletion.
2 changes: 2 additions & 0 deletions configuration/http_request_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 2 additions & 0 deletions configuration/http_response_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down
6 changes: 6 additions & 0 deletions configuration/tcp_request_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down
4 changes: 3 additions & 1 deletion configuration/tcp_response_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
},
Expand Down
3 changes: 3 additions & 0 deletions models/http_request_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions models/http_response_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions models/tcp_request_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions models/tcp_response_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions specification/models/configuration/http/request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]+$'
Expand Down
7 changes: 7 additions & 0 deletions specification/models/configuration/http/response.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]+$'
Expand Down
7 changes: 7 additions & 0 deletions specification/models/configuration/tcp/request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)$"
Expand Down
7 changes: 7 additions & 0 deletions specification/models/configuration/tcp/response.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)$"
Expand Down

0 comments on commit d0c4332

Please sign in to comment.