Current implementation shows "packet" for none byte quota type. It means "packet" was used for overquota counter as well and it wasn't so informative. This commmit adds additional column - overquota with yes/no value. Signed-off-by: Alexey Perevalov <a.perevalov@xxxxxxxxxxx> --- src/libnetfilter_acct.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c index 7f539b6..0156c9a 100644 --- a/src/libnetfilter_acct.c +++ b/src/libnetfilter_acct.c @@ -266,15 +266,22 @@ nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct, SNPRINTF_CHECK(ret, rem, offset, len); if (nfacct->flags) { - uint32_t mode; - - mode = nfacct_attr_get_u64(nfacct, NFACCT_ATTR_FLAGS); + const uint32_t mode = nfacct_attr_get_u64(nfacct, + NFACCT_ATTR_FLAGS); + char *mode_name = NULL; + if (mode & NFACCT_F_QUOTA_PKTS) + mode_name = "packet"; + else if (mode & NFACCT_F_QUOTA_BYTES) + mode_name = "byte"; + else + mode_name = "unknown"; ret = snprintf(buf + offset, rem, - ", quota = %.20"PRIu64", mode = %s", + ", quota = %.20"PRIu64", mode = %s"\ + ", overquota = %s", nfacct_attr_get_u64(nfacct, NFACCT_ATTR_QUOTA), - mode == NFACCT_F_QUOTA_BYTES ? - "byte" : "packet"); + mode_name, + mode & NFACCT_F_OVERQUOTA ? "yes" : "no"); SNPRINTF_CHECK(ret, rem, offset, len); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html