Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nfacct: per network namespace support

- Move the nfnl_acct_list into the network namespace, initialize
and destroy it per namespace
- Keep track of refcnt on nfacct objects, the old logic does not
longer work with a per namespace list
- Adjust xt_nfacct to pass the namespace when registring objects

Signed-off-by: Andreas Schultz <aschultz@tpip.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Andreas Schultz and committed by
Pablo Neira Ayuso
3499abb2 d2168e84

+56 -23
+3
include/net/net_namespace.h
··· 118 118 #endif 119 119 struct sock *nfnl; 120 120 struct sock *nfnl_stash; 121 + #if IS_ENABLED(CONFIG_NETFILTER_NETLINK_ACCT) 122 + struct list_head nfnl_acct_list; 123 + #endif 121 124 #endif 122 125 #ifdef CONFIG_WEXT_CORE 123 126 struct sk_buff_head wext_nlevents;
+1 -1
net/netfilter/xt_nfacct.c
··· 37 37 struct xt_nfacct_match_info *info = par->matchinfo; 38 38 struct nf_acct *nfacct; 39 39 40 - nfacct = nfnl_acct_find_get(info->name); 40 + nfacct = nfnl_acct_find_get(par->net, info->name); 41 41 if (nfacct == NULL) { 42 42 pr_info("xt_nfacct: accounting object with name `%s' " 43 43 "does not exists\n", info->name);