summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-12-02 18:31:00 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2020-12-04 12:53:00 +0100
commita8dc9e2a2b40d5d29b12920873bbe1f2cfeda8f6 (patch)
treecc8d6aa145ec6e6ad253cdadba50b489c9844910 /src/parser_bison.y
parent299ec575faa6b070940b483dc517ecd883b9f1a4 (diff)
parser_bison: allow to restore limit from dynamic set
Update parser to allow to restore limit per set element in dynamic set. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1477 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index a8884466..fb329919 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -4097,6 +4097,38 @@ set_elem_expr_option : TIMEOUT time_spec
stmt->counter.bytes = $5;
$<expr>0->stmt = stmt;
}
+ | LIMIT RATE limit_mode NUM SLASH time_unit limit_burst_pkts
+ {
+ struct stmt *stmt;
+
+ stmt = limit_stmt_alloc(&@$);
+ stmt->limit.rate = $4;
+ stmt->limit.unit = $6;
+ stmt->limit.burst = $7;
+ stmt->limit.type = NFT_LIMIT_PKTS;
+ stmt->limit.flags = $3;
+ $<expr>0->stmt = stmt;
+ }
+ | LIMIT RATE limit_mode NUM STRING limit_burst_bytes
+ {
+ struct error_record *erec;
+ uint64_t rate, unit;
+ struct stmt *stmt;
+
+ erec = rate_parse(&@$, $5, &rate, &unit);
+ xfree($5);
+ if (erec != NULL) {
+ erec_queue(erec, state->msgs);
+ YYERROR;
+ }
+
+ stmt = limit_stmt_alloc(&@$);
+ stmt->limit.rate = rate * $4;
+ stmt->limit.unit = unit;
+ stmt->limit.burst = $6;
+ stmt->limit.type = NFT_LIMIT_PKT_BYTES;
+ stmt->limit.flags = $3;
+ }
| comment_spec
{
if (already_set($<expr>0->comment, &@1, state)) {