]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expression: fix output of verdict maps
authorPablo Neira <pablo@netfilter.org>
Mon, 13 Jan 2014 12:39:16 +0000 (13:39 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 16 Jan 2014 17:04:15 +0000 (18:04 +0100)
% nft list table filter
table ip filter {
...
chain output {
...
ip saddr map { 1.1.1.1 => accept}
}
}

It displays 'map' instead of 'vmap'. Fix it by checking the mapping
type in map_expr_print().

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expression.c

index 518f71c8ba15d133a7423b599abb520bc0b58104..a12133c8d052099f7c3e7726fbb5dba8deba68df 100644 (file)
@@ -691,7 +691,11 @@ struct expr *mapping_expr_alloc(const struct location *loc,
 static void map_expr_print(const struct expr *expr)
 {
        expr_print(expr->map);
-       printf(" map ");
+       if (expr->mappings->ops->type == EXPR_SET_REF &&
+           expr->mappings->set->datatype->type == TYPE_VERDICT)
+               printf(" vmap ");
+       else
+               printf(" map ");
        expr_print(expr->mappings);
 }