From f4a34d25f6d5f4188573dbe16613ce96327f0e6c Mon Sep 17 00:00:00 2001 From: Harsha Sharma Date: Sun, 14 Jan 2018 21:48:46 +0530 Subject: src: list set handle and delete set via set handle Print 'handle' attribute in sets when listing via '-a' option and delete sets via their unique set handles listed with '-a' option. For e.g. nft delete set [] [handle ] Signed-off-by: Harsha Sharma Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index 29343f75..d58e58f1 100644 --- a/src/rule.c +++ b/src/rule.c @@ -377,7 +377,11 @@ static void do_set_print(const struct set *set, struct print_fmt_options *opts, expr_print(set->init, octx); nft_print(octx, "%s", opts->nl); } - nft_print(octx, "%s}%s", opts->tab, opts->nl); + nft_print(octx, "%s}", opts->tab); + if (octx->handle > 0) + nft_print(octx, " # handle %" PRIu64, set->handle.handle.id); + nft_print(octx, "%s", opts->nl); + } void set_print(const struct set *s, struct output_ctx *octx) -- cgit v1.2.3