[PATCH nft 1/7] rule: display table when listing sets

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

 



After this patch:

 # nft list sets ip
 table ip test {
        set pepe {
                type ipv4_addr
        }
 }

Before:

 # nft list sets ip
        set pepe {
                type ipv4_addr
        }

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

diff --git a/src/rule.c b/src/rule.c
index 92b83f0..71b26e3 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -983,8 +983,18 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd)
 	struct set *set;
 
 	list_for_each_entry(table, &table_list, list) {
+		if (cmd->handle.family != NFPROTO_UNSPEC &&
+		    cmd->handle.family != table->handle.family)
+			continue;
+
+		printf("table %s %s {\n",
+		       family2str(table->handle.family),
+		       table->handle.table);
+
 		list_for_each_entry(set, &table->sets, list)
 			set_print(set);
+
+		printf("}\n");
 	}
 	return 0;
 }
-- 
2.1.4

--
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