diff options
author | Florian Westphal <fw@strlen.de> | 2021-06-16 18:25:28 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2021-06-21 14:44:58 +0200 |
commit | 3486127e52426d1861a78b44f10e5997c3a69ff2 (patch) | |
tree | 58ee3ab39d323435b2153f7b3df187526a21ad15 /src | |
parent | 52f61f87b3891b60ca5efec125bc2e5f6522a6c1 (diff) |
parser: new queue flag input format
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/parser_bison.y | 4 | ||||
-rw-r--r-- | src/statement.c | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 2a86c275..277918ef 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -3739,6 +3739,10 @@ nf_nat_flag : RANDOM { $$ = NF_NAT_RANGE_PROTO_RANDOM; } ; queue_stmt : queue_stmt_compat close_scope_queue + | QUEUE FLAGS queue_stmt_flags QUEUENUM queue_stmt_expr_simple close_scope_queue + { + $$ = queue_stmt_alloc(&@$, $5, $3); + } ; queue_stmt_compat : queue_stmt_alloc diff --git a/src/statement.c b/src/statement.c index a713952c..9eb49339 100644 --- a/src/statement.c +++ b/src/statement.c @@ -493,20 +493,25 @@ struct stmt *limit_stmt_alloc(const struct location *loc) static void queue_stmt_print(const struct stmt *stmt, struct output_ctx *octx) { - const char *delim = " "; + struct expr *e = stmt->queue.queue; + const char *delim = " flags "; nft_print(octx, "queue"); - if (stmt->queue.queue != NULL) { - nft_print(octx, " num "); - expr_print(stmt->queue.queue, octx); - } + if (stmt->queue.flags & NFT_QUEUE_FLAG_BYPASS) { nft_print(octx, "%sbypass", delim); delim = ","; } + if (stmt->queue.flags & NFT_QUEUE_FLAG_CPU_FANOUT) nft_print(octx, "%sfanout", delim); + if (e) { + nft_print(octx, " num "); + expr_print(stmt->queue.queue, octx); + } else { + nft_print(octx, " num 0"); + } } static void queue_stmt_destroy(struct stmt *stmt) |