Commit c4042a33 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: ctnetlink: support individual atomic-get-and-reset of counters

This allows to use the get operation to atomically get-and-reset
counters.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 35dba1d7
...@@ -1015,6 +1015,17 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -1015,6 +1015,17 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
if (err < 0) if (err < 0)
goto out; goto out;
if (NFNL_MSG_TYPE(nlh->nlmsg_type) == IPCTNL_MSG_CT_GET_CTRZERO) {
struct nf_conn_counter *acct;
acct = nf_conn_acct_find(ct);
if (acct) {
atomic64_set(&acct[IP_CT_DIR_ORIGINAL].bytes, 0);
atomic64_set(&acct[IP_CT_DIR_ORIGINAL].packets, 0);
atomic64_set(&acct[IP_CT_DIR_REPLY].bytes, 0);
atomic64_set(&acct[IP_CT_DIR_REPLY].packets, 0);
}
}
return 0; return 0;
free: free:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment