diff options
author | Patrick McHardy <kaber@trash.net> | 2007-02-07 18:07:22 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 15:39:13 -0500 |
commit | 5eb87f456ebdc983164f0913b53c199ca9673887 (patch) | |
tree | 92ed9911e54a00a29afbc4fff9727754a2ece728 /net | |
parent | efbc597634f239fa5ce84a131898341791fec1ec (diff) |
[NETFILTER]: bridge-netfilter: use nf_register_hooks/nf_unregister_hooks
Additionally mark the init function __init.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_netfilter.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index ea3337ad0edc..a25fa8cb5284 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -949,44 +949,29 @@ static ctl_table brnf_net_table[] = { | |||
949 | }; | 949 | }; |
950 | #endif | 950 | #endif |
951 | 951 | ||
952 | int br_netfilter_init(void) | 952 | int __init br_netfilter_init(void) |
953 | { | 953 | { |
954 | int i; | 954 | int ret; |
955 | |||
956 | for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) { | ||
957 | int ret; | ||
958 | |||
959 | if ((ret = nf_register_hook(&br_nf_ops[i])) >= 0) | ||
960 | continue; | ||
961 | |||
962 | while (i--) | ||
963 | nf_unregister_hook(&br_nf_ops[i]); | ||
964 | 955 | ||
956 | ret = nf_register_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops)); | ||
957 | if (ret < 0) | ||
965 | return ret; | 958 | return ret; |
966 | } | ||
967 | |||
968 | #ifdef CONFIG_SYSCTL | 959 | #ifdef CONFIG_SYSCTL |
969 | brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0); | 960 | brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0); |
970 | if (brnf_sysctl_header == NULL) { | 961 | if (brnf_sysctl_header == NULL) { |
971 | printk(KERN_WARNING | 962 | printk(KERN_WARNING |
972 | "br_netfilter: can't register to sysctl.\n"); | 963 | "br_netfilter: can't register to sysctl.\n"); |
973 | for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) | 964 | nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops)); |
974 | nf_unregister_hook(&br_nf_ops[i]); | 965 | return -ENOMEM; |
975 | return -EFAULT; | ||
976 | } | 966 | } |
977 | #endif | 967 | #endif |
978 | |||
979 | printk(KERN_NOTICE "Bridge firewalling registered\n"); | 968 | printk(KERN_NOTICE "Bridge firewalling registered\n"); |
980 | |||
981 | return 0; | 969 | return 0; |
982 | } | 970 | } |
983 | 971 | ||
984 | void br_netfilter_fini(void) | 972 | void br_netfilter_fini(void) |
985 | { | 973 | { |
986 | int i; | 974 | nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops)); |
987 | |||
988 | for (i = ARRAY_SIZE(br_nf_ops) - 1; i >= 0; i--) | ||
989 | nf_unregister_hook(&br_nf_ops[i]); | ||
990 | #ifdef CONFIG_SYSCTL | 975 | #ifdef CONFIG_SYSCTL |
991 | unregister_sysctl_table(brnf_sysctl_header); | 976 | unregister_sysctl_table(brnf_sysctl_header); |
992 | #endif | 977 | #endif |