]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/netfilter/ipt_CLUSTERIP.c
Merge branch 'parisc' from /home/kyle/repos/parisc-2.6.git
[linux-2.6-omap-h63xx.git] / net / ipv4 / netfilter / ipt_CLUSTERIP.c
index 7a29d6e7baa7db35c4d71da25889e0e0b83f3a66..b1c11160b9de2a44f663bbeaa9c2c5fd0c675852 100644 (file)
@@ -40,8 +40,6 @@
 #define DEBUGP
 #endif
 
-#define ASSERT_READ_LOCK(x)
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
 MODULE_DESCRIPTION("iptables target for CLUSTERIP");
@@ -123,7 +121,6 @@ __clusterip_config_find(__be32 clusterip)
 {
        struct list_head *pos;
 
-       ASSERT_READ_LOCK(&clusterip_lock);
        list_for_each(pos, &clusterip_configs) {
                struct clusterip_config *c = list_entry(pos, 
                                        struct clusterip_config, list);
@@ -170,7 +167,6 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
                        struct net_device *dev)
 {
        struct clusterip_config *c;
-       char buffer[16];
 
        c = kzalloc(sizeof(*c), GFP_ATOMIC);
        if (!c)
@@ -187,12 +183,17 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
        atomic_set(&c->entries, 1);
 
 #ifdef CONFIG_PROC_FS
-       /* create proc dir entry */
-       sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
-       c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR, clusterip_procdir);
-       if (!c->pde) {
-               kfree(c);
-               return NULL;
+       {
+               char buffer[16];
+
+               /* create proc dir entry */
+               sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
+               c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR,
+                                          clusterip_procdir);
+               if (!c->pde) {
+                       kfree(c);
+                       return NULL;
+               }
        }
        c->pde->proc_fops = &clusterip_proc_fops;
        c->pde->data = c;
@@ -205,6 +206,7 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
        return c;
 }
 
+#ifdef CONFIG_PROC_FS
 static int
 clusterip_add_node(struct clusterip_config *c, u_int16_t nodenum)
 {
@@ -232,6 +234,7 @@ clusterip_del_node(struct clusterip_config *c, u_int16_t nodenum)
 
        return 1;
 }
+#endif
 
 static inline u_int32_t
 clusterip_hashfn(struct sk_buff *skb, struct clusterip_config *config)
@@ -444,6 +447,12 @@ checkentry(const char *tablename,
                cipinfo->config = config;
        }
 
+       if (nf_ct_l3proto_try_module_get(target->family) < 0) {
+               printk(KERN_WARNING "can't load conntrack support for "
+                                   "proto=%d\n", target->family);
+               return 0;
+       }
+
        return 1;
 }
 
@@ -457,6 +466,8 @@ static void destroy(const struct xt_target *target, void *targinfo)
        clusterip_config_entry_put(cipinfo->config);
 
        clusterip_config_put(cipinfo->config);
+
+       nf_ct_l3proto_module_put(target->family);
 }
 
 static struct ipt_target clusterip_tgt = {
@@ -680,7 +691,7 @@ static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
 {
 #define PROC_WRITELEN  10
        char buffer[PROC_WRITELEN+1];
-       struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
+       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
        struct clusterip_config *c = pde->data;
        unsigned long nodenum;
 
@@ -737,8 +748,10 @@ static int __init ipt_clusterip_init(void)
                CLUSTERIP_VERSION);
        return 0;
 
+#ifdef CONFIG_PROC_FS
 cleanup_hook:
        nf_unregister_hook(&cip_arp_ops);
+#endif /* CONFIG_PROC_FS */
 cleanup_target:
        ipt_unregister_target(&clusterip_tgt);
        return ret;