File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1111#include <linux/wait.h>
1212#include <linux/list.h>
1313#include <linux/static_key.h>
14+ #include <linux/module.h>
1415#include <linux/netfilter_defs.h>
1516#include <linux/netdevice.h>
1617#include <linux/sockptr.h>
@@ -481,6 +482,15 @@ struct nfnl_ct_hook {
481482};
482483extern const struct nfnl_ct_hook __rcu * nfnl_ct_hook ;
483484
485+ struct nf_defrag_hook {
486+ struct module * owner ;
487+ int (* enable )(struct net * net );
488+ void (* disable )(struct net * net );
489+ };
490+
491+ extern const struct nf_defrag_hook __rcu * nf_defrag_v4_hook ;
492+ extern const struct nf_defrag_hook __rcu * nf_defrag_v6_hook ;
493+
484494/*
485495 * nf_skb_duplicated - TEE target has sent a packet
486496 *
Original file line number Diff line number Diff line change 77#include <linux/ip.h>
88#include <linux/netfilter.h>
99#include <linux/module.h>
10+ #include <linux/rcupdate.h>
1011#include <linux/skbuff.h>
1112#include <net/netns/generic.h>
1213#include <net/route.h>
@@ -113,17 +114,31 @@ static void __net_exit defrag4_net_exit(struct net *net)
113114 }
114115}
115116
117+ static const struct nf_defrag_hook defrag_hook = {
118+ .owner = THIS_MODULE ,
119+ .enable = nf_defrag_ipv4_enable ,
120+ .disable = nf_defrag_ipv4_disable ,
121+ };
122+
116123static struct pernet_operations defrag4_net_ops = {
117124 .exit = defrag4_net_exit ,
118125};
119126
120127static int __init nf_defrag_init (void )
121128{
122- return register_pernet_subsys (& defrag4_net_ops );
129+ int err ;
130+
131+ err = register_pernet_subsys (& defrag4_net_ops );
132+ if (err )
133+ return err ;
134+
135+ rcu_assign_pointer (nf_defrag_v4_hook , & defrag_hook );
136+ return err ;
123137}
124138
125139static void __exit nf_defrag_fini (void )
126140{
141+ rcu_assign_pointer (nf_defrag_v4_hook , NULL );
127142 unregister_pernet_subsys (& defrag4_net_ops );
128143}
129144
Original file line number Diff line number Diff line change 1010#include <linux/module.h>
1111#include <linux/skbuff.h>
1212#include <linux/icmp.h>
13+ #include <linux/rcupdate.h>
1314#include <linux/sysctl.h>
1415#include <net/ipv6_frag.h>
1516
@@ -96,6 +97,12 @@ static void __net_exit defrag6_net_exit(struct net *net)
9697 }
9798}
9899
100+ static const struct nf_defrag_hook defrag_hook = {
101+ .owner = THIS_MODULE ,
102+ .enable = nf_defrag_ipv6_enable ,
103+ .disable = nf_defrag_ipv6_disable ,
104+ };
105+
99106static struct pernet_operations defrag6_net_ops = {
100107 .exit = defrag6_net_exit ,
101108};
@@ -114,6 +121,9 @@ static int __init nf_defrag_init(void)
114121 pr_err ("nf_defrag_ipv6: can't register pernet ops\n" );
115122 goto cleanup_frag6 ;
116123 }
124+
125+ rcu_assign_pointer (nf_defrag_v6_hook , & defrag_hook );
126+
117127 return ret ;
118128
119129cleanup_frag6 :
@@ -124,6 +134,7 @@ static int __init nf_defrag_init(void)
124134
125135static void __exit nf_defrag_fini (void )
126136{
137+ rcu_assign_pointer (nf_defrag_v6_hook , NULL );
127138 unregister_pernet_subsys (& defrag6_net_ops );
128139 nf_ct_frag6_cleanup ();
129140}
Original file line number Diff line number Diff line change @@ -680,6 +680,12 @@ EXPORT_SYMBOL_GPL(nfnl_ct_hook);
680680const struct nf_ct_hook __rcu * nf_ct_hook __read_mostly ;
681681EXPORT_SYMBOL_GPL (nf_ct_hook );
682682
683+ const struct nf_defrag_hook __rcu * nf_defrag_v4_hook __read_mostly ;
684+ EXPORT_SYMBOL_GPL (nf_defrag_v4_hook );
685+
686+ const struct nf_defrag_hook __rcu * nf_defrag_v6_hook __read_mostly ;
687+ EXPORT_SYMBOL_GPL (nf_defrag_v6_hook );
688+
683689#if IS_ENABLED (CONFIG_NF_CONNTRACK )
684690u8 nf_ctnetlink_has_listener ;
685691EXPORT_SYMBOL_GPL (nf_ctnetlink_has_listener );
You can’t perform that action at this time.
0 commit comments