rule: filter out tables depending on family
Pablo Neira Ayuso
maintainerPATCH 1/2 rule: filter out tables depending on family
# nft list tables ip table ip filter
# nft list tables ip6 table ip6 filter
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/rule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
src/rule.c +6 -1
@@ -1013,10 +1013,15 @@ static int do_list_tables(struct netlink_ctx *ctx, struct cmd *cmd) {struct table *table; -list_for_each_entry (table, &table_list, list) +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); + }return 0 ; }
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 2/2 parser: show all tables via list tables with no family
Default to the same behaviour that we get through `list ruleset', ie.
# nft list tables table ip filter table ip6 filter
# nft list tables ip table ip filter
# nft list tables ip6 table ip6 filter
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/parser_bison.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/parser_bison.y +1 -1
@@ -767,7 +767,7 @@ list_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_LIST, CMD_OBJ_TABLE, &$2, &@$, NULL); } - | TABLES tables_spec + | TABLES ruleset_spec { $$ = cmd_alloc(CMD_LIST, CMD_OBJ_TABLE, &$2, &@$, NULL); }
Signature · 1 line
1.7.10.4