Commit d24675cb1fb0f4f5b44ce4ed9cf5c17caf0efa6b

Authored by Alexey Perevalov
Committed by Pablo Neira Ayuso
1 parent d4da843e6f

netfilter: nfnetlink_acct: dump unmodified nfacct flags

NFNL_MSG_ACCT_GET_CTRZERO modifies dumped flags, in this case
client see unmodified (uncleared) counter value and cleared
overquota state - end user doesn't know anything about overquota state,
unless end user subscribed on overquota report.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

net/netfilter/nfnetlink_acct.c
... ... @@ -129,6 +129,7 @@
129 129 struct nfgenmsg *nfmsg;
130 130 unsigned int flags = portid ? NLM_F_MULTI : 0;
131 131 u64 pkts, bytes;
  132 + u32 old_flags;
132 133  
133 134 event |= NFNL_SUBSYS_ACCT << 8;
134 135 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*nfmsg), flags);
... ... @@ -143,6 +144,7 @@
143 144 if (nla_put_string(skb, NFACCT_NAME, acct->name))
144 145 goto nla_put_failure;
145 146  
  147 + old_flags = acct->flags;
146 148 if (type == NFNL_MSG_ACCT_GET_CTRZERO) {
147 149 pkts = atomic64_xchg(&acct->pkts, 0);
148 150 bytes = atomic64_xchg(&acct->bytes, 0);
... ... @@ -160,7 +162,7 @@
160 162 if (acct->flags & NFACCT_F_QUOTA) {
161 163 u64 *quota = (u64 *)acct->data;
162 164  
163   - if (nla_put_be32(skb, NFACCT_FLAGS, htonl(acct->flags)) ||
  165 + if (nla_put_be32(skb, NFACCT_FLAGS, htonl(old_flags)) ||
164 166 nla_put_be64(skb, NFACCT_QUOTA, cpu_to_be64(*quota)))
165 167 goto nla_put_failure;
166 168 }