netfilter: arptables: use pernet ops struct during unregister
Subsystems (2)
Florian Westphal
maintainerPATCH 1/1 netfilter: arptables: use pernet ops struct during unregister
Like with iptables and ebtables, hook unregistration has to use the pernet ops struct, not the template.
This triggered following splat:
hook not found, pf 3 num 0
WARNING: CPU: 0 PID: 224 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480 [..] nf_unregister_net_hook net/netfilter/core.c:502 [inline] nf_unregister_net_hooks+0x117/0x160 net/netfilter/core.c:576 arpt_unregister_table_pre_exit+0x67/0x80 net/ipv4/netfilter/arp_tables.c:1565
Fixes f9006acc8dfe5 ("netfilter: arp_tables: pass table pointer via nf_hook_ops")
Reported-by [email protected]
Signed-off-by Florian Westphal <[email protected]>
--- include/linux/netfilter_arp/arp_tables.h | 3 +-- net/ipv4/netfilter/arp_tables.c | 5 ++--- net/ipv4/netfilter/arptable_filter.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
include/linux/netfilter_arp/arp_tables.h +1 -2
@@ -53,8 +53,7 @@ int arpt_register_table(struct net *net, const struct xt_table *table,const struct arpt_replace *repl, const struct nf_hook_ops *ops);void arpt_unregister_table (struct net *net,const char *name); -void arpt_unregister_table_pre_exit (struct net *net,const char *name, -const struct nf_hook_ops *ops); +void arpt_unregister_table_pre_exit (struct net *net,const char *name);extern unsigned int arpt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct xt_table *table);
net/ipv4/netfilter/arp_tables.c +2 -3
@@ -1556,13 +1556,12 @@ int arpt_register_table(struct net *net,return ret; } -void arpt_unregister_table_pre_exit (struct net *net,const char *name, -const struct nf_hook_ops *ops) +void arpt_unregister_table_pre_exit (struct net *net,const char *name) {struct xt_table *table =xt_find_table (net,NFPROTO_ARP , name);if (table) -nf_unregister_net_hooks (net, ops,hweight32 (table->valid_hooks)); +nf_unregister_net_hooks (net, table->ops,hweight32 (table->valid_hooks)); }EXPORT_SYMBOL (arpt_unregister_table_pre_exit);
net/ipv4/netfilter/arptable_filter.c +1 -1
@@ -54,7 +54,7 @@ static int __net_init arptable_filter_table_init(struct net *net) static void __net_exit arptable_filter_net_pre_exit(struct net *net) { -arpt_unregister_table_pre_exit (net,"filter" , arpfilter_ops); +arpt_unregister_table_pre_exit (net,"filter" ); } static void __net_exit arptable_filter_net_exit(struct net *net)
Signature · 1 line
2.26.3
Quoted 10 lines · Florian Westphal
Like with iptables and ebtables, hook unregistration has to use the pernet ops struct, not the template.
This triggered following splat:
hook not found, pf 3 num 0WARNING: CPU: 0 PID: 224 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480 [..] nf_unregister_net_hook net/netfilter/core.c:502 [inline] nf_unregister_net_hooks+0x117/0x160 net/netfilter/core.c:576 arpt_unregister_table_pre_exit+0x67/0x80 net/ipv4/netfilter/arp_tables.c:1565
Applied, thanks.