summaryrefslogtreecommitdiffstats
path: root/src/statement.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-09-24 13:49:05 +0200
committerPatrick McHardy <kaber@trash.net>2014-09-24 13:49:05 +0200
commit30a7eb9eecba7d5f83d28c284948ed7448d28fc0 (patch)
tree90fce3244f1aac276c381c9d12d70865cd908057 /src/statement.c
parentd68824c96f2e8cee14b6a505c91fd379b9aa3088 (diff)
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 <kaber@trash.net>
Diffstat (limited to 'src/statement.c')
-rw-r--r--src/statement.c19
1 files changed, 12 insertions, 7 deletions
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);
}