提交 9312eaba 编写于 作者: W wenxu 提交者: Pablo Neira Ayuso

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: Nwenxu <wenxu@ucloud.cn>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 d56aab26
......@@ -65,7 +65,16 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
#endif
}
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);
static inline void nf_ct_acct_update(struct nf_conn *ct, u32 dir,
unsigned int bytes)
{
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
nf_ct_acct_add(ct, dir, 1, bytes);
#endif
}
void nf_conntrack_acct_pernet_init(struct net *net);
......
......@@ -865,7 +865,8 @@ nf_conntrack_hash_check_insert(struct nf_conn *ct)
}
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册