@ -9,7 +9,6 @@
*
*/
# include <linux/kernel.h>
# include <linux/module.h>
# include <linux/init.h>
# include <linux/sysctl.h>
# include <linux/spinlock.h>
@ -384,17 +383,9 @@ dccp_state_table[CT_DCCP_ROLE_MAX + 1][DCCP_PKT_SYNCACK + 1][CT_DCCP_MAX + 1] =
} ,
} ;
/* this module per-net specifics */
static unsigned int dccp_net_id __read_mostly ;
struct dccp_net {
struct nf_proto_net pn ;
int dccp_loose ;
unsigned int dccp_timeout [ CT_DCCP_MAX + 1 ] ;
} ;
static inline struct dccp_net * dccp_pernet ( struct net * net )
static inline struct nf_dccp_net * dccp_pernet ( struct net * net )
{
return net_generic ( net , dccp_net_id ) ;
return & net - > ct . nf_ct_proto . dccp ;
}
static bool dccp_pkt_to_tuple ( const struct sk_buff * skb , unsigned int dataoff ,
@ -424,7 +415,7 @@ static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff , unsigned int * timeouts )
{
struct net * net = nf_ct_net ( ct ) ;
struct dccp_net * dn ;
struct nf_ dccp_net * dn ;
struct dccp_hdr _dh , * dh ;
const char * msg ;
u_int8_t state ;
@ -719,7 +710,7 @@ static int dccp_nlattr_size(void)
static int dccp_timeout_nlattr_to_obj ( struct nlattr * tb [ ] ,
struct net * net , void * data )
{
struct dccp_net * dn = dccp_pernet ( net ) ;
struct nf_ dccp_net * dn = dccp_pernet ( net ) ;
unsigned int * timeouts = data ;
int i ;
@ -820,7 +811,7 @@ static struct ctl_table dccp_sysctl_table[] = {
# endif /* CONFIG_SYSCTL */
static int dccp_kmemdup_sysctl_table ( struct net * net , struct nf_proto_net * pn ,
struct dccp_net * dn )
struct nf_ dccp_net * dn )
{
# ifdef CONFIG_SYSCTL
if ( pn - > ctl_table )
@ -850,7 +841,7 @@ static int dccp_kmemdup_sysctl_table(struct net *net, struct nf_proto_net *pn,
static int dccp_init_net ( struct net * net , u_int16_t proto )
{
struct dccp_net * dn = dccp_pernet ( net ) ;
struct nf_ dccp_net * dn = dccp_pernet ( net ) ;
struct nf_proto_net * pn = & dn - > pn ;
if ( ! pn - > users ) {
@ -868,7 +859,7 @@ static int dccp_init_net(struct net *net, u_int16_t proto)
return dccp_kmemdup_sysctl_table ( net , pn , dn ) ;
}
static st ruct nf_conntrack_l4proto dccp_proto 4 __read_mostly = {
struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp 4 __read_mostly = {
. l3proto = AF_INET ,
. l4proto = IPPROTO_DCCP ,
. name = " dccp " ,
@ -898,11 +889,11 @@ static struct nf_conntrack_l4proto dccp_proto4 __read_mostly = {
. nla_policy = dccp_timeout_nla_policy ,
} ,
# endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
. net_id = & dccp_net_id ,
. init_net = dccp_init_net ,
} ;
EXPORT_SYMBOL_GPL ( nf_conntrack_l4proto_dccp4 ) ;
static st ruct nf_conntrack_l4proto dccp_proto 6 __read_mostly = {
struct nf_conntrack_l4proto nf_conntrack_l4proto_dccp 6 __read_mostly = {
. l3proto = AF_INET6 ,
. l4proto = IPPROTO_DCCP ,
. name = " dccp " ,
@ -932,56 +923,6 @@ static struct nf_conntrack_l4proto dccp_proto6 __read_mostly = {
. nla_policy = dccp_timeout_nla_policy ,
} ,
# endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
. net_id = & dccp_net_id ,
. init_net = dccp_init_net ,
} ;
static struct nf_conntrack_l4proto * dccp_proto [ ] = {
& dccp_proto4 ,
& dccp_proto6 ,
} ;
static __net_init int dccp_net_init ( struct net * net )
{
return nf_ct_l4proto_pernet_register ( net , dccp_proto ,
ARRAY_SIZE ( dccp_proto ) ) ;
}
static __net_exit void dccp_net_exit ( struct net * net )
{
nf_ct_l4proto_pernet_unregister ( net , dccp_proto ,
ARRAY_SIZE ( dccp_proto ) ) ;
}
static struct pernet_operations dccp_net_ops = {
. init = dccp_net_init ,
. exit = dccp_net_exit ,
. id = & dccp_net_id ,
. size = sizeof ( struct dccp_net ) ,
} ;
static int __init nf_conntrack_proto_dccp_init ( void )
{
int ret ;
ret = register_pernet_subsys ( & dccp_net_ops ) ;
if ( ret < 0 )
return ret ;
ret = nf_ct_l4proto_register ( dccp_proto , ARRAY_SIZE ( dccp_proto ) ) ;
if ( ret < 0 )
unregister_pernet_subsys ( & dccp_net_ops ) ;
return ret ;
}
static void __exit nf_conntrack_proto_dccp_fini ( void )
{
nf_ct_l4proto_unregister ( dccp_proto , ARRAY_SIZE ( dccp_proto ) ) ;
unregister_pernet_subsys ( & dccp_net_ops ) ;
}
module_init ( nf_conntrack_proto_dccp_init ) ;
module_exit ( nf_conntrack_proto_dccp_fini ) ;
MODULE_AUTHOR ( " Patrick McHardy <kaber@trash.net> " ) ;
MODULE_DESCRIPTION ( " DCCP connection tracking protocol helper " ) ;
MODULE_LICENSE ( " GPL " ) ;
EXPORT_SYMBOL_GPL ( nf_conntrack_l4proto_dccp6 ) ;