diff options
author | Jose M. Guisado Gomez <guigom@riseup.net> | 2020-08-01 23:30:10 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-08-03 12:59:32 +0200 |
commit | a9c2177f292f2620edb02b5549580b982ceb9455 (patch) | |
tree | aa1128a716f2cd22c98efac154b201a7bfb66ba1 | |
parent | 968d8fe946e5c689d2ebf94b1f05490b19573ef2 (diff) |
src: fix obj list output when reset command
This patch enables json output when doing a reset command.
Previously do_list_obj was called at the end of do_command_reset to
list the named object affected by the reset, this function
is for nft output only.
Listing affected objects using do_command_list ensures
output flags will be honored.
Eg: For a ruleset like
table inet x {
counter user123 {
packets 12 bytes 1433
}
counter user321 {
packets 0 bytes 0
}
quota user123 {
over 2000 bytes
}
quota user124 {
over 2000 bytes
}
set y {
type ipv4_addr
}
...
}
{
"nftables": [
{
"metainfo": {
"json_schema_version": 1,
"release_name": "Capital Idea #2",
"version": "0.9.6"
}
},
{
"counter": {
"bytes": 0,
"family": "inet",
"handle": 3,
"name": "user321",
"packets": 0,
"table": "x"
}
},
{
"counter": {
"bytes": 1433,
"family": "inet",
"handle": 2,
"name": "user123",
"packets": 12,
"table": "x"
}
}
]
}
Fixes: https://bugzilla.netfilter.org/show_bug.cgi?id=1336
Signed-off-by: Jose M. Guisado Gomez <guigom@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | src/rule.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2682,7 +2682,7 @@ static int do_command_reset(struct netlink_ctx *ctx, struct cmd *cmd) if (ret < 0) return ret; - return do_list_obj(ctx, cmd, type); + return do_command_list(ctx, cmd); } static int do_command_flush(struct netlink_ctx *ctx, struct cmd *cmd) |