From 30a7eb9eecba7d5f83d28c284948ed7448d28fc0 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Wed, 24 Sep 2014 13:49:05 +0200 Subject: queue: clean up queue statement - Rename keyword tokens to their actual keyword - Change the grammar to follow the standard schema for statements and arguments - Use actual expression for the queue numbers to support using normal range expressions, symbolic expression and so on. - restore comma seperation of flag keywords The result is that its possible to use standard ranges, prefix expressions, symbolic expressions etc for the queue number. We get checks for overflow, negative ranges and so on automatically. The comma seperation of flags is more similar to what we have for other flag values. It is still possible to use spaces, however this could be removed since we never had a release supporting that. Signed-off-by: Patrick McHardy --- src/statement.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/statement.c') diff --git a/src/statement.c b/src/statement.c index 4be66251..8e4b49e2 100644 --- a/src/statement.c +++ b/src/statement.c @@ -197,14 +197,19 @@ struct stmt *limit_stmt_alloc(const struct location *loc) static void queue_stmt_print(const struct stmt *stmt) { - printf("queue num %u", - stmt->queue.from); - if (stmt->queue.to && stmt->queue.to != stmt->queue.from) - printf("-%u", stmt->queue.to); - if (stmt->queue.flags & NFT_QUEUE_FLAG_BYPASS) - printf(" bypass"); + const char *delim = " "; + + printf("queue"); + if (stmt->queue.queue != NULL) { + printf(" num "); + expr_print(stmt->queue.queue); + } + if (stmt->queue.flags & NFT_QUEUE_FLAG_BYPASS) { + printf("%sbypass", delim); + delim = ","; + } if (stmt->queue.flags & NFT_QUEUE_FLAG_CPU_FANOUT) - printf(" fanout"); + printf("%sfanout", delim); } -- cgit v1.2.3