summaryrefslogtreecommitdiffstats
path: root/src/netlink_linearize.c
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <alvaroneay@gmail.com>2014-06-10 15:26:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-06-11 11:14:37 +0200
commit27619ffbe503ed4d9e59a02e81db9a7ac49d37af (patch)
treed0341b9d56091aa541b6d0240bcf59283315af3c /src/netlink_linearize.c
parent2874f6f52393495de8b31b6e5222441056fba9eb (diff)
queue: More compact syntax
This patch allows to use a new syntax more compact and break the current syntax. This new syntax is more similar than the nftables syntax that we use usually. We can use range like we have used in other case in nftables. Here, we have some examples: Before, If we want to declare a queue, we have used a syntax like this: nft add rule test input queue num 1 total 3 options bypass,fanout If we want to use the queue number 1 and the two next (total 3), we use a range in the new syntax, for example: nft add rule test input queue num 1-3 bypass fanout Also if we want to use only one queue, the new rules are like: nft add rule test input queue num 1 # queue 1 or nft add rule test input queue # queue 0 And if we want to add a specific flags we only need to put what flags we want to use: nft add rule test input queue bypass we don't need to use options and the comma for indicating the flags. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink_linearize.c')
-rw-r--r--src/netlink_linearize.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 19153fd7..8db333cc 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -683,15 +683,17 @@ static void netlink_gen_queue_stmt(struct netlink_linearize_ctx *ctx,
const struct stmt *stmt)
{
struct nft_rule_expr *nle;
+ uint16_t total_queues;
nle = alloc_nft_expr("queue");
nft_rule_expr_set_u16(nle, NFT_EXPR_QUEUE_NUM,
- stmt->queue.queuenum);
- if (stmt->queue.queues_total) {
- nft_rule_expr_set_u16(nle, NFT_EXPR_QUEUE_TOTAL,
- stmt->queue.queues_total);
- }
+ stmt->queue.from);
+
+ total_queues = stmt->queue.to - stmt->queue.from;
+ nft_rule_expr_set_u16(nle, NFT_EXPR_QUEUE_TOTAL,
+ total_queues + 1);
+
if (stmt->queue.flags) {
nft_rule_expr_set_u16(nle, NFT_EXPR_QUEUE_FLAGS,
stmt->queue.flags);