summaryrefslogtreecommitdiff
path: root/net/netfilter
diff options
context:
space:
mode:
authorwenxu <wenxu@ucloud.cn>2020-03-28 03:57:53 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2020-03-30 03:05:39 +0300
commit9312eabab4a68348af5b4482cc7cc6f151ff1c3f (patch)
treed81c986b9a2a8589553920dc7aac23d8db0eead7 /net/netfilter
parentd56aab2625f7bee79686566d3f6ad639d694b8cd (diff)
downloadlinux-9312eabab4a68348af5b4482cc7cc6f151ff1c3f.tar.xz
netfilter: conntrack: add nf_ct_acct_add()
Add nf_ct_acct_add function to update the conntrack counter with packets and bytes. Signed-off-by: wenxu <wenxu@ucloud.cn> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 7ded6d287f87..c4582eb71766 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -865,7 +865,8 @@ out:
}
EXPORT_SYMBOL_GPL(nf_conntrack_hash_check_insert);
-void nf_ct_acct_update(struct nf_conn *ct, u32 dir, unsigned int bytes)
+void nf_ct_acct_add(struct nf_conn *ct, u32 dir, unsigned int packets,
+ unsigned int bytes)
{
struct nf_conn_acct *acct;
@@ -873,11 +874,11 @@ void nf_ct_acct_update(struct nf_conn *ct, u32 dir, unsigned int bytes)
if (acct) {
struct nf_conn_counter *counter = acct->counter;
- atomic64_inc(&counter[dir].packets);
+ atomic64_add(packets, &counter[dir].packets);
atomic64_add(bytes, &counter[dir].bytes);
}
}
-EXPORT_SYMBOL_GPL(nf_ct_acct_update);
+EXPORT_SYMBOL_GPL(nf_ct_acct_add);
static void nf_ct_acct_merge(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
const struct nf_conn *loser_ct)