summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShivani Bhardwaj <shivanib134@gmail.com>2016-04-07 22:58:54 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2016-04-13 01:22:08 +0200
commitb9d6a7b68e93c9a7a48b2dada6e7380190480b79 (patch)
treea8aa569834fee3b1d064c6ffaf7a847f167cd4b1 /src
parent4176c7d30c2ff1b3f52468fc9c08b8df83f979a8 (diff)
src: evaluate: Show error for fanout without balance
The idea of fanout option is to improve the performance by indexing CPU ID to map packets to the queues. This is used for load balancing. Fanout option is not required when there is a single queue specified. According to iptables, queue balance should be specified in order to use fanout. Following that, throw an error in nftables if the range of queues for load balancing is not specified with the fanout option. After this patch, $ sudo nft add rule ip filter forward counter queue num 0 fanout <cmdline>:1:46-46: Error: fanout requires a range to be specified add rule ip filter forward counter queue num 0 fanout ^^^^^ Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/evaluate.c5
-rw-r--r--src/parser_bison.y1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index d9ac8542..346e34fc 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2006,6 +2006,11 @@ static int stmt_evaluate_queue(struct eval_ctx *ctx, struct stmt *stmt)
if (!expr_is_constant(stmt->queue.queue))
return expr_error(ctx->msgs, stmt->queue.queue,
"queue number is not constant");
+ if (stmt->queue.queue->ops->type != EXPR_RANGE &&
+ (stmt->queue.flags & NFT_QUEUE_FLAG_CPU_FANOUT))
+ return expr_error(ctx->msgs, stmt->queue.queue,
+ "fanout requires a range to be "
+ "specified");
}
return 0;
}
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 4b7c1f5a..444ed4c2 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1722,6 +1722,7 @@ queue_stmt_args : queue_stmt_arg
queue_stmt_arg : QUEUENUM stmt_expr
{
$<stmt>0->queue.queue = $2;
+ $<stmt>0->queue.queue->location = @$;
}
| queue_stmt_flags
{