diff options
Diffstat (limited to 'src/expr/counter.c')
-rw-r--r-- | src/expr/counter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/expr/counter.c b/src/expr/counter.c index 77054e2..62bd143 100644 --- a/src/expr/counter.c +++ b/src/expr/counter.c @@ -194,11 +194,14 @@ nft_rule_expr_counter_snprintf(char *buf, size_t len, uint32_t type, struct nft_expr_counter *ctr = (struct nft_expr_counter *)e->data; switch(type) { + case NFT_RULE_O_DEFAULT: + return snprintf(buf, len, "pkts=%lu bytes=%lu ", + ctr->pkts, ctr->bytes); case NFT_RULE_O_XML: return snprintf(buf, len, "<pkts>%lu</pkts><bytes>%lu</bytes>", ctr->pkts, ctr->bytes); - case NFT_RULE_O_DEFAULT: - return snprintf(buf, len, "pkts=%lu bytes=%lu ", + case NFT_RULE_O_JSON: + return snprintf(buf, len, "\"pkts\" : %lu, \"bytes\" : %lu", ctr->pkts, ctr->bytes); default: break; |