diff mbox series

[nft] rule: print object handle with --echo --handle

Message ID 20180305162801.25139-1-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft] rule: print object handle with --echo --handle | expand

Commit Message

Pablo Neira Ayuso March 5, 2018, 4:28 p.m. UTC
# nft --echo --handle add counter x y
 add counter ip x y { packets 0 bytes 0 }  # handle 0

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/rule.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/rule.c b/src/rule.c
index 99a99e8a3f9d..6af7d9a913fe 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1503,6 +1503,9 @@  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);
+
+	if (octx->handle > 0)
+		nft_print(octx, "# handle %" PRIu64, obj->handle.handle.id);
 }
 
 void obj_print(const struct obj *obj, struct output_ctx *octx)