@@ -1026,6 +1026,13 @@ static struct pernet_operations nat_net_ops = {
10261026 .size = sizeof (struct nat_net ),
10271027};
10281028
1029+ struct nf_nat_hook nat_hook = {
1030+ .parse_nat_setup = nfnetlink_parse_nat_setup ,
1031+ #ifdef CONFIG_XFRM
1032+ .decode_session = __nf_nat_decode_session ,
1033+ #endif
1034+ };
1035+
10291036static int __init nf_nat_init (void )
10301037{
10311038 int ret , i ;
@@ -1057,13 +1064,9 @@ static int __init nf_nat_init(void)
10571064
10581065 nf_ct_helper_expectfn_register (& follow_master_nat );
10591066
1060- BUG_ON (nfnetlink_parse_nat_setup_hook != NULL );
1061- RCU_INIT_POINTER (nfnetlink_parse_nat_setup_hook ,
1062- nfnetlink_parse_nat_setup );
1063- #ifdef CONFIG_XFRM
1064- BUG_ON (nf_nat_decode_session_hook != NULL );
1065- RCU_INIT_POINTER (nf_nat_decode_session_hook , __nf_nat_decode_session );
1066- #endif
1067+ WARN_ON (nf_nat_hook != NULL );
1068+ RCU_INIT_POINTER (nf_nat_hook , & nat_hook );
1069+
10671070 return 0 ;
10681071}
10691072
@@ -1076,10 +1079,8 @@ static void __exit nf_nat_cleanup(void)
10761079
10771080 nf_ct_extend_unregister (& nat_extend );
10781081 nf_ct_helper_expectfn_unregister (& follow_master_nat );
1079- RCU_INIT_POINTER (nfnetlink_parse_nat_setup_hook , NULL );
1080- #ifdef CONFIG_XFRM
1081- RCU_INIT_POINTER (nf_nat_decode_session_hook , NULL );
1082- #endif
1082+ RCU_INIT_POINTER (nf_nat_hook , NULL );
1083+
10831084 synchronize_rcu ();
10841085
10851086 for (i = 0 ; i < NFPROTO_NUMPROTO ; i ++ )
0 commit comments