struct table *table;
struct set *set;
int ret;
+ uint32_t obj_type = NFT_OBJECT_UNSPEC;
ret = cache_update(cmd->op, ctx->msgs);
if (ret < 0)
return cmd_error(ctx, "Could not process rule: Chain '%s' does not exist",
cmd->handle.chain);
return 0;
+ case CMD_OBJ_QUOTA:
+ obj_type = NFT_OBJECT_QUOTA;
+ case CMD_OBJ_COUNTER:
+ if (obj_type == NFT_OBJECT_UNSPEC)
+ obj_type = NFT_OBJECT_COUNTER;
+ table = table_lookup(&cmd->handle);
+ if (table == NULL)
+ return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
+ cmd->handle.table);
+ if (obj_lookup(table, cmd->handle.obj, obj_type) == NULL)
+ return cmd_error(ctx, "Could not process rule: Object '%s' does not exist",
+ cmd->handle.obj);
+ return 0;
case CMD_OBJ_CHAINS:
case CMD_OBJ_SETS:
case CMD_OBJ_COUNTERS:
family2str(table->handle.family),
table->handle.table);
+ if (cmd->handle.table != NULL &&
+ strcmp(cmd->handle.table, table->handle.table)) {
+ printf("}\n");
+ continue;
+ }
+
list_for_each_entry(obj, &table->objs, list) {
- if (obj->type != type)
+ if (obj->type != type ||
+ (cmd->handle.obj != NULL &&
+ strcmp(cmd->handle.obj, obj->handle.obj)))
continue;
obj_print_declaration(obj, &opts);
return do_list_sets(ctx, cmd);
case CMD_OBJ_MAP:
return do_list_set(ctx, cmd, table);
+ case CMD_OBJ_COUNTER:
case CMD_OBJ_COUNTERS:
return do_list_obj(ctx, cmd, NFT_OBJECT_COUNTER);
+ case CMD_OBJ_QUOTA:
case CMD_OBJ_QUOTAS:
return do_list_obj(ctx, cmd, NFT_OBJECT_QUOTA);
default: