[PATCH nft] rule: broken handle listing of table and named objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now listing looks good:

 table ip test-ip {
        counter https-traffic {
                packets 0 bytes 0
        } # handle 1
 } # handle 847

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/rule.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/rule.c b/src/rule.c
index 6af7d9a913fe..99b12e97a1fa 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -888,9 +888,12 @@ static void table_print(const struct table *table, struct output_ctx *octx)
 		chain_print(chain, octx);
 		delim = "\n";
 	}
+	nft_print(octx, "}");
+
 	if (octx->handle > 0)
 		nft_print(octx, " # handle %" PRIu64, table->handle.handle.id);
-	nft_print(octx, "}\n");
+
+	nft_print(octx, "\n");
 }
 
 struct cmd *cmd_alloc(enum cmd_ops op, enum cmd_obj obj,
@@ -1502,10 +1505,12 @@ static void obj_print_declaration(const struct obj *obj,
 
 	obj_print_data(obj, opts, octx);
 
-	nft_print(octx, "%s%s}%s", opts->nl, opts->tab, opts->nl);
+	nft_print(octx, "%s%s}", opts->nl, opts->tab);
 
 	if (octx->handle > 0)
-		nft_print(octx, "# handle %" PRIu64, obj->handle.handle.id);
+		nft_print(octx, " # handle %" PRIu64, obj->handle.handle.id);
+
+	nft_print(octx, "%s", opts->nl);
 }
 
 void obj_print(const struct obj *obj, struct output_ctx *octx)
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux