1 /* Accouting handling for netfilter. */
4 * (C) 2008 Krzysztof Piotr Oledzki <ole@ans.pl>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/netfilter.h>
14 #include <linux/slab.h>
15 #include <linux/kernel.h>
16 #include <linux/moduleparam.h>
17 #include <linux/export.h>
19 #include <net/netfilter/nf_conntrack.h>
20 #include <net/netfilter/nf_conntrack_extend.h>
21 #include <net/netfilter/nf_conntrack_acct.h>
23 static bool nf_ct_acct __read_mostly;
25 module_param_named(acct, nf_ct_acct, bool, 0644);
26 MODULE_PARM_DESC(acct, "Enable connection tracking flow accounting.");
28 static const struct nf_ct_ext_type acct_extend = {
29 .len = sizeof(struct nf_conn_acct),
30 .align = __alignof__(struct nf_conn_acct),
34 void nf_conntrack_acct_pernet_init(struct net *net)
36 net->ct.sysctl_acct = nf_ct_acct;
39 int nf_conntrack_acct_init(void)
41 int ret = nf_ct_extend_register(&acct_extend);
43 pr_err("Unable to register extension\n");
47 void nf_conntrack_acct_fini(void)
49 nf_ct_extend_unregister(&acct_extend);