[1/2] src: Print handle attribute in chains

Message ID 5c89bb2dd4af12a952bc3931a93bdb7803d47587.1515521150.git.harshasharmaiitr@gmail.com
State Under Review
Delegated to: Pablo Neira
Headers show
Series
  • parser_bison: delete chains via chain handle
Related show

Commit Message

Harsha Sharma Jan. 9, 2018, 6:59 p.m.
Print handle attribute in chains when listing via '-a' option.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
 src/rule.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/src/rule.c b/src/rule.c
index e875816..7d66c22 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -694,7 +694,10 @@  static void chain_print(const struct chain *chain, struct output_ctx *octx)
 		rule_print(rule, octx);
 		nft_print(octx, "\n");
 	}
-	nft_print(octx, "\t}\n");
+	nft_print(octx, "\t}");
+	if (octx->handle > 0)
+		nft_print(octx, " # handle %" PRIu64, chain->handle.handle.id);
+	nft_print(octx, "\n");
 }
 
 void chain_print_plain(const struct chain *chain, struct output_ctx *octx)