diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-27 23:24:21 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-01-03 14:21:52 +0100 |
commit | d156fd17ee7ff9a2822d7714e1c8dfe7b6b18f55 (patch) | |
tree | 7f14b719a9459ee21dd75469f94b02e62577a2ea /src/statement.c | |
parent | da3f503dc3609a66d84782aa200c1aafaecdc1f7 (diff) |
src: add used quota support
table ip x {
chain y {
type filter hook forward priority 0; policy accept;
quota over 200 mbytes used 1143 kbytes drop
}
}
This patch allows us to list and to restore used quota.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/statement.c')
-rw-r--r-- | src/statement.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/statement.c b/src/statement.c index e70eb51e..4d3ca55a 100644 --- a/src/statement.c +++ b/src/statement.c @@ -352,11 +352,16 @@ static void quota_stmt_print(const struct stmt *stmt) { bool inv = stmt->quota.flags & NFT_QUOTA_F_INV; const char *data_unit; - uint64_t bytes; + uint64_t bytes, used; data_unit = get_rate(stmt->quota.bytes, &bytes); printf("quota %s%"PRIu64" %s", inv ? "over " : "", bytes, data_unit); + + if (stmt->quota.used) { + data_unit = get_rate(stmt->quota.used, &used); + printf(" used %"PRIu64" %s", used, data_unit); + } } static const struct stmt_ops quota_stmt_ops = { |