[NETFILTER]: replace list_for_each with list_for_each_entry
[sfrench/cifs-2.6.git] / net / ipv4 / netfilter / ipt_CLUSTERIP.c
index dcc12b1834747a513a7468f780604b738124f0c2..311361e1272ce09464ca1b9cad4fb6bbd5873b02 100644 (file)
 #include <linux/udp.h>
 #include <linux/icmp.h>
 #include <linux/if_arp.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/netfilter_arp.h>
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ipt_CLUSTERIP.h>
 #include <net/netfilter/nf_conntrack.h>
+#include <net/net_namespace.h>
 #include <net/checksum.h>
 
 #define CLUSTERIP_VERSION "0.8"
@@ -109,11 +109,9 @@ clusterip_config_entry_put(struct clusterip_config *c)
 static struct clusterip_config *
 __clusterip_config_find(__be32 clusterip)
 {
-       struct list_head *pos;
+       struct clusterip_config *c;
 
-       list_for_each(pos, &clusterip_configs) {
-               struct clusterip_config *c = list_entry(pos,
-                                       struct clusterip_config, list);
+       list_for_each_entry(c, &clusterip_configs, list) {
                if (c->clusterip == clusterip)
                        return c;
        }
@@ -289,7 +287,7 @@ clusterip_responsible(const struct clusterip_config *config, u_int32_t hash)
  ***********************************************************************/
 
 static unsigned int
-target(struct sk_buff **pskb,
+target(struct sk_buff *skb,
        const struct net_device *in,
        const struct net_device *out,
        unsigned int hooknum,
@@ -305,7 +303,7 @@ target(struct sk_buff **pskb,
         * is only decremented by destroy() - and ip_tables guarantees
         * that the ->target() function isn't called after ->destroy() */
 
-       ct = nf_ct_get(*pskb, &ctinfo);
+       ct = nf_ct_get(skb, &ctinfo);
        if (ct == NULL) {
                printk(KERN_ERR "CLUSTERIP: no conntrack!\n");
                        /* FIXME: need to drop invalid ones, since replies
@@ -316,7 +314,7 @@ target(struct sk_buff **pskb,
 
        /* special case: ICMP error handling. conntrack distinguishes between
         * error messages (RELATED) and information requests (see below) */
-       if (ip_hdr(*pskb)->protocol == IPPROTO_ICMP
+       if (ip_hdr(skb)->protocol == IPPROTO_ICMP
            && (ctinfo == IP_CT_RELATED
                || ctinfo == IP_CT_RELATED+IP_CT_IS_REPLY))
                return XT_CONTINUE;
@@ -325,7 +323,7 @@ target(struct sk_buff **pskb,
         * TIMESTAMP, INFO_REQUEST or ADDRESS type icmp packets from here
         * on, which all have an ID field [relevant for hashing]. */
 
-       hash = clusterip_hashfn(*pskb, cipinfo->config);
+       hash = clusterip_hashfn(skb, cipinfo->config);
 
        switch (ctinfo) {
                case IP_CT_NEW:
@@ -355,7 +353,7 @@ target(struct sk_buff **pskb,
 
        /* despite being received via linklayer multicast, this is
         * actually a unicast IP packet. TCP doesn't like PACKET_MULTICAST */
-       (*pskb)->pkt_type = PACKET_HOST;
+       skb->pkt_type = PACKET_HOST;
 
        return XT_CONTINUE;
 }
@@ -401,7 +399,7 @@ checkentry(const char *tablename,
                                return false;
                        }
 
-                       dev = dev_get_by_name(e->ip.iniface);
+                       dev = dev_get_by_name(&init_net, e->ip.iniface);
                        if (!dev) {
                                printk(KERN_WARNING "CLUSTERIP: no such interface %s\n", e->ip.iniface);
                                return false;
@@ -505,12 +503,12 @@ static void arp_print(struct arp_payload *payload)
 
 static unsigned int
 arp_mangle(unsigned int hook,
-          struct sk_buff **pskb,
+          struct sk_buff *skb,
           const struct net_device *in,
           const struct net_device *out,
           int (*okfn)(struct sk_buff *))
 {
-       struct arphdr *arp = arp_hdr(*pskb);
+       struct arphdr *arp = arp_hdr(skb);
        struct arp_payload *payload;
        struct clusterip_config *c;
 
@@ -727,7 +725,7 @@ static int __init ipt_clusterip_init(void)
                goto cleanup_target;
 
 #ifdef CONFIG_PROC_FS
-       clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", proc_net);
+       clusterip_procdir = proc_mkdir("ipt_CLUSTERIP", init_net.proc_net);
        if (!clusterip_procdir) {
                printk(KERN_ERR "CLUSTERIP: Unable to proc dir entry\n");
                ret = -ENOMEM;