File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -145,25 +145,27 @@ static struct pernet_operations iptable_nat_net_ops = {
145
145
146
146
static int __init iptable_nat_init (void )
147
147
{
148
- int ret = xt_register_template (& nf_nat_ipv4_table ,
149
- iptable_nat_table_init );
148
+ int ret ;
150
149
150
+ /* net->gen->ptr[iptable_nat_net_id] must be allocated
151
+ * before calling iptable_nat_table_init().
152
+ */
153
+ ret = register_pernet_subsys (& iptable_nat_net_ops );
151
154
if (ret < 0 )
152
155
return ret ;
153
156
154
- ret = register_pernet_subsys (& iptable_nat_net_ops );
155
- if (ret < 0 ) {
156
- xt_unregister_template (& nf_nat_ipv4_table );
157
- return ret ;
158
- }
157
+ ret = xt_register_template (& nf_nat_ipv4_table ,
158
+ iptable_nat_table_init );
159
+ if (ret < 0 )
160
+ unregister_pernet_subsys (& iptable_nat_net_ops );
159
161
160
162
return ret ;
161
163
}
162
164
163
165
static void __exit iptable_nat_exit (void )
164
166
{
165
- unregister_pernet_subsys (& iptable_nat_net_ops );
166
167
xt_unregister_template (& nf_nat_ipv4_table );
168
+ unregister_pernet_subsys (& iptable_nat_net_ops );
167
169
}
168
170
169
171
module_init (iptable_nat_init );
You can’t perform that action at this time.
0 commit comments