summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rule.c b/src/rule.c
index a815850d..e15a20b3 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -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 &&