diff options
author | Florian Westphal <fw@strlen.de> | 2019-01-02 17:10:36 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2019-01-02 23:22:44 +0100 |
commit | dafac7d528de0890b82f943fc818ccb7a82fca7d (patch) | |
tree | abd00dd15ac418f0afaa28a12873c095e98a8fb7 /src/rule.c | |
parent | 1e224c1399236cb5f93b53b4cebe7944237ad204 (diff) |
rule: fix object listing when no table is given
'nft list quotas' would not print anything at all anymore.
Fixes: 88456a7ef01172 ("rule: list only the table containing object")
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1946,13 +1946,16 @@ static int do_list_obj(struct netlink_ctx *ctx, struct cmd *cmd, uint32_t type) continue; if (cmd->handle.table.name != NULL && - !strcmp(cmd->handle.table.name, table->handle.table.name)) { - nft_print(&ctx->nft->output, "table %s %s {\n", - family2str(table->handle.family), - cmd->handle.table.name); - } else + strcmp(cmd->handle.table.name, table->handle.table.name)) continue; + if (list_empty(&table->objs)) + continue; + + nft_print(&ctx->nft->output, "table %s %s {\n", + family2str(table->handle.family), + table->handle.table.name); + list_for_each_entry(obj, &table->objs, list) { if (obj->type != type || (cmd->handle.obj.name != NULL && |