Commit 5eb87f45 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: bridge-netfilter: use nf_register_hooks/nf_unregister_hooks

Additionally mark the init function __init.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent efbc5976
...@@ -949,44 +949,29 @@ static ctl_table brnf_net_table[] = { ...@@ -949,44 +949,29 @@ static ctl_table brnf_net_table[] = {
}; };
#endif #endif
int br_netfilter_init(void) int __init br_netfilter_init(void)
{ {
int i;
for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) {
int ret; int ret;
if ((ret = nf_register_hook(&br_nf_ops[i])) >= 0) ret = nf_register_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
continue; if (ret < 0)
while (i--)
nf_unregister_hook(&br_nf_ops[i]);
return ret; return ret;
}
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0); brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0);
if (brnf_sysctl_header == NULL) { if (brnf_sysctl_header == NULL) {
printk(KERN_WARNING printk(KERN_WARNING
"br_netfilter: can't register to sysctl.\n"); "br_netfilter: can't register to sysctl.\n");
for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
nf_unregister_hook(&br_nf_ops[i]); return -ENOMEM;
return -EFAULT;
} }
#endif #endif
printk(KERN_NOTICE "Bridge firewalling registered\n"); printk(KERN_NOTICE "Bridge firewalling registered\n");
return 0; return 0;
} }
void br_netfilter_fini(void) void br_netfilter_fini(void)
{ {
int i; nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
for (i = ARRAY_SIZE(br_nf_ops) - 1; i >= 0; i--)
nf_unregister_hook(&br_nf_ops[i]);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
unregister_sysctl_table(brnf_sysctl_header); unregister_sysctl_table(brnf_sysctl_header);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment