aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorAlexey Perevalov <a.perevalov@samsung.com>2014-07-30 11:17:55 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-07-30 12:16:56 -0400
commitd24675cb1fb0f4f5b44ce4ed9cf5c17caf0efa6b (patch)
tree574faa0e143b4e54daa21e44c6b5d58e31ca826e /net/netfilter
parentd4da843e6fad4f278fe82b075d8e394cff05c95c (diff)
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>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nfnetlink_acct.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 2baa125c2e8d..11d863c8b11f 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -129,6 +129,7 @@ nfnl_acct_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
129 struct nfgenmsg *nfmsg; 129 struct nfgenmsg *nfmsg;
130 unsigned int flags = portid ? NLM_F_MULTI : 0; 130 unsigned int flags = portid ? NLM_F_MULTI : 0;
131 u64 pkts, bytes; 131 u64 pkts, bytes;
132 u32 old_flags;
132 133
133 event |= NFNL_SUBSYS_ACCT << 8; 134 event |= NFNL_SUBSYS_ACCT << 8;
134 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*nfmsg), flags); 135 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*nfmsg), flags);
@@ -143,6 +144,7 @@ nfnl_acct_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
143 if (nla_put_string(skb, NFACCT_NAME, acct->name)) 144 if (nla_put_string(skb, NFACCT_NAME, acct->name))
144 goto nla_put_failure; 145 goto nla_put_failure;
145 146
147 old_flags = acct->flags;
146 if (type == NFNL_MSG_ACCT_GET_CTRZERO) { 148 if (type == NFNL_MSG_ACCT_GET_CTRZERO) {
147 pkts = atomic64_xchg(&acct->pkts, 0); 149 pkts = atomic64_xchg(&acct->pkts, 0);
148 bytes = atomic64_xchg(&acct->bytes, 0); 150 bytes = atomic64_xchg(&acct->bytes, 0);
@@ -160,7 +162,7 @@ nfnl_acct_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
160 if (acct->flags & NFACCT_F_QUOTA) { 162 if (acct->flags & NFACCT_F_QUOTA) {
161 u64 *quota = (u64 *)acct->data; 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 nla_put_be64(skb, NFACCT_QUOTA, cpu_to_be64(*quota))) 166 nla_put_be64(skb, NFACCT_QUOTA, cpu_to_be64(*quota)))
165 goto nla_put_failure; 167 goto nla_put_failure;
166 } 168 }