1 /* 2 * (C) 2010 Pablo Neira Ayuso <pablo@netfilter.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation (or any later at your option). 7 */ 8 9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 10 11 #include <linux/netfilter.h> 12 #include <linux/slab.h> 13 #include <linux/kernel.h> 14 #include <linux/moduleparam.h> 15 16 #include <net/netfilter/nf_conntrack.h> 17 #include <net/netfilter/nf_conntrack_extend.h> 18 #include <net/netfilter/nf_conntrack_timestamp.h> 19 20 static bool nf_ct_tstamp __read_mostly; 21 22 module_param_named(tstamp, nf_ct_tstamp, bool, 0644); 23 MODULE_PARM_DESC(tstamp, "Enable connection tracking flow timestamping."); 24 25 static const struct nf_ct_ext_type tstamp_extend = { 26 .len = sizeof(struct nf_conn_tstamp), 27 .align = __alignof__(struct nf_conn_tstamp), 28 .id = NF_CT_EXT_TSTAMP, 29 }; 30 31 void nf_conntrack_tstamp_pernet_init(struct net *net) 32 { 33 net->ct.sysctl_tstamp = nf_ct_tstamp; 34 } 35 36 int nf_conntrack_tstamp_init(void) 37 { 38 int ret; 39 ret = nf_ct_extend_register(&tstamp_extend); 40 if (ret < 0) 41 pr_err("Unable to register extension\n"); 42 return ret; 43 } 44 45 void nf_conntrack_tstamp_fini(void) 46 { 47 nf_ct_extend_unregister(&tstamp_extend); 48 } 49