From 079041bd477f444d29e02c6442351c0ed6ffaa1e Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sun, 29 Dec 2013 19:28:10 +0100 Subject: src: add support for queue This patch adds support for the queue target. It is now possible to specify rule sending packet to a given queue and using load balancing: nft add rule filter output queue num 3 total 2 options fanout Signed-off-by: Eric Leblond Signed-off-by: Pablo Neira Ayuso --- src/statement.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/statement.c') diff --git a/src/statement.c b/src/statement.c index d18e0340..3fdd9e2d 100644 --- a/src/statement.c +++ b/src/statement.c @@ -172,6 +172,37 @@ struct stmt *limit_stmt_alloc(const struct location *loc) return stmt_alloc(loc, &limit_stmt_ops); } +static void queue_stmt_print(const struct stmt *stmt) +{ + int one = 0; + + printf("queue num %u total %u", + stmt->queue.queuenum, stmt->queue.queues_total); + if (stmt->queue.flags) + printf(" options "); + if (stmt->queue.flags & NFT_QUEUE_FLAG_BYPASS) { + printf("bypass"); + one = 1; + } + if (stmt->queue.flags & NFT_QUEUE_FLAG_CPU_FANOUT) { + if (one) + printf (","); + printf("fanout"); + } + +} + +static const struct stmt_ops queue_stmt_ops = { + .type = STMT_QUEUE, + .name = "queue", + .print = queue_stmt_print, +}; + +struct stmt *queue_stmt_alloc(const struct location *loc) +{ + return stmt_alloc(loc, &queue_stmt_ops); +} + static void reject_stmt_print(const struct stmt *stmt) { printf("reject"); -- cgit v1.2.3