]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/netfilter/ipt_MASQUERADE.c
[NETFILTER]: Replace sk_buff ** with sk_buff *
[net-next-2.6.git] / net / ipv4 / netfilter / ipt_MASQUERADE.c
index f136ef7f23f85de9b32cec4efb740edd5678e91f..44b516e7cb79f1c9c814930bbaca7922ef08b03d 100644 (file)
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
 MODULE_DESCRIPTION("iptables MASQUERADE target module");
 
-#if 0
-#define DEBUGP printk
-#else
-#define DEBUGP(format, args...)
-#endif
-
 /* Lock protects masq region inside conntrack */
 static DEFINE_RWLOCK(masq_lock);
 
@@ -47,18 +41,18 @@ masquerade_check(const char *tablename,
        const struct nf_nat_multi_range_compat *mr = targinfo;
 
        if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
-               DEBUGP("masquerade_check: bad MAP_IPS.\n");
+               pr_debug("masquerade_check: bad MAP_IPS.\n");
                return false;
        }
        if (mr->rangesize != 1) {
-               DEBUGP("masquerade_check: bad rangesize %u.\n", mr->rangesize);
+               pr_debug("masquerade_check: bad rangesize %u\n", mr->rangesize);
                return false;
        }
        return true;
 }
 
 static unsigned int
-masquerade_target(struct sk_buff **pskb,
+masquerade_target(struct sk_buff *skb,
                  const struct net_device *in,
                  const struct net_device *out,
                  unsigned int hooknum,
@@ -75,7 +69,7 @@ masquerade_target(struct sk_buff **pskb,
 
        NF_CT_ASSERT(hooknum == NF_IP_POST_ROUTING);
 
-       ct = nf_ct_get(*pskb, &ctinfo);
+       ct = nf_ct_get(skb, &ctinfo);
        nat = nfct_nat(ct);
 
        NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
@@ -88,7 +82,7 @@ masquerade_target(struct sk_buff **pskb,
                return NF_ACCEPT;
 
        mr = targinfo;
-       rt = (struct rtable *)(*pskb)->dst;
+       rt = (struct rtable *)skb->dst;
        newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
        if (!newsrc) {
                printk("MASQUERADE: %s ate my IP address\n", out->name);
@@ -131,6 +125,9 @@ static int masq_device_event(struct notifier_block *this,
 {
        const struct net_device *dev = ptr;
 
+       if (dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        if (event == NETDEV_DOWN) {
                /* Device was downed.  Search entire table for
                   conntracks which were associated with that device,
@@ -169,7 +166,7 @@ static struct notifier_block masq_inet_notifier = {
        .notifier_call  = masq_inet_event,
 };
 
-static struct xt_target masquerade = {
+static struct xt_target masquerade __read_mostly = {
        .name           = "MASQUERADE",
        .family         = AF_INET,
        .target         = masquerade_target,