[NETFILTER]: x_tables: remove unused size argument to check/destroy functions
[safe/jmp/linux-2.6] / net / ipv4 / netfilter / ipt_CLUSTERIP.c
index 61e11ed..4158966 100644 (file)
@@ -10,7 +10,6 @@
  *
  */
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/proc_fs.h>
 #include <linux/jhash.h>
 #include <linux/bitops.h>
@@ -173,11 +172,10 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip,
        struct clusterip_config *c;
        char buffer[16];
 
-       c = kmalloc(sizeof(*c), GFP_ATOMIC);
+       c = kzalloc(sizeof(*c), GFP_ATOMIC);
        if (!c)
                return NULL;
 
-       memset(c, 0, sizeof(*c));
        c->dev = dev;
        c->clusterip = ip;
        memcpy(&c->clustermac, &i->clustermac, ETH_ALEN);
@@ -241,25 +239,17 @@ clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config)
        struct iphdr *iph = skb->nh.iph;
        unsigned long hashval;
        u_int16_t sport, dport;
-       struct tcphdr *th;
-       struct udphdr *uh;
-       struct icmphdr *ih;
+       u_int16_t *ports;
 
        switch (iph->protocol) {
        case IPPROTO_TCP:
-               th = (void *)iph+iph->ihl*4;
-               sport = ntohs(th->source);
-               dport = ntohs(th->dest);
-               break;
        case IPPROTO_UDP:
-               uh = (void *)iph+iph->ihl*4;
-               sport = ntohs(uh->source);
-               dport = ntohs(uh->dest);
-               break;
+       case IPPROTO_SCTP:
+       case IPPROTO_DCCP:
        case IPPROTO_ICMP:
-               ih = (void *)iph+iph->ihl*4;
-               sport = ntohs(ih->un.echo.id);
-               dport = (ih->type<<8)|ih->code;
+               ports = (void *)iph+iph->ihl*4;
+               sport = ports[0];
+               dport = ports[1];
                break;
        default:
                if (net_ratelimit()) {
@@ -312,8 +302,7 @@ target(struct sk_buff **pskb,
        const struct net_device *out,
        unsigned int hooknum,
        const struct xt_target *target,
-       const void *targinfo,
-       void *userinfo)
+       const void *targinfo)
 {
        const struct ipt_clusterip_tgt_info *cipinfo = targinfo;
        enum ip_conntrack_info ctinfo;
@@ -383,7 +372,6 @@ checkentry(const char *tablename,
           const void *e_void,
           const struct xt_target *target,
            void *targinfo,
-           unsigned int targinfosize,
            unsigned int hook_mask)
 {
        struct ipt_clusterip_tgt_info *cipinfo = targinfo;
@@ -460,8 +448,7 @@ checkentry(const char *tablename,
 }
 
 /* drop reference count of cluster config when rule is deleted */
-static void destroy(const struct xt_target *target, void *targinfo,
-                   unsigned int targinfosize)
+static void destroy(const struct xt_target *target, void *targinfo)
 {
        struct ipt_clusterip_tgt_info *cipinfo = targinfo;
 
@@ -725,22 +712,17 @@ static struct file_operations clusterip_proc_fops = {
 
 #endif /* CONFIG_PROC_FS */
 
-static int init_or_cleanup(int fini)
+static int __init ipt_clusterip_init(void)
 {
        int ret;
 
-       if (fini)
-               goto cleanup;
-
-       if (ipt_register_target(&clusterip_tgt)) {
-               ret = -EINVAL;
-               goto cleanup_none;
-       }
+       ret = ipt_register_target(&clusterip_tgt);
+       if (ret < 0)
+               return ret;
 
-       if (nf_register_hook(&cip_arp_ops) < 0) {
-               ret = -EINVAL;
+       ret = nf_register_hook(&cip_arp_ops);
+       if (ret < 0)
                goto cleanup_target;
-       }
 
 #ifdef CONFIG_PROC_FS
        clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", proc_net);
@@ -753,32 +735,25 @@ static int init_or_cleanup(int fini)
 
        printk(KERN_NOTICE "ClusterIP Version %s loaded successfully\n",
                CLUSTERIP_VERSION);
-
        return 0;
 
-cleanup:
-       printk(KERN_NOTICE "ClusterIP Version %s unloading\n",
-               CLUSTERIP_VERSION);
-#ifdef CONFIG_PROC_FS
-       remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent);
-#endif
 cleanup_hook:
        nf_unregister_hook(&cip_arp_ops);
 cleanup_target:
        ipt_unregister_target(&clusterip_tgt);
-cleanup_none:
-       return -EINVAL;
-}
-
-static int __init init(void)
-{
-       return init_or_cleanup(0);
+       return ret;
 }
 
-static void __exit fini(void)
+static void __exit ipt_clusterip_fini(void)
 {
-       init_or_cleanup(1);
+       printk(KERN_NOTICE "ClusterIP Version %s unloading\n",
+               CLUSTERIP_VERSION);
+#ifdef CONFIG_PROC_FS
+       remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent);
+#endif
+       nf_unregister_hook(&cip_arp_ops);
+       ipt_unregister_target(&clusterip_tgt);
 }
 
-module_init(init);
-module_exit(fini);
+module_init(ipt_clusterip_init);
+module_exit(ipt_clusterip_fini);