]> err.no Git - linux-2.6/blobdiff - net/ipv4/netfilter/ipt_MASQUERADE.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / net / ipv4 / netfilter / ipt_MASQUERADE.c
index f54150356cee40fe0871abeba15e03dacc555050..84c26dd27d8100fda0913de6ad6b9616bf3de5ec 100644 (file)
@@ -25,7 +25,7 @@
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <coreteam@netfilter.org>");
-MODULE_DESCRIPTION("iptables MASQUERADE target module");
+MODULE_DESCRIPTION("Xtables: automatic-address SNAT");
 
 /* Lock protects masq region inside conntrack */
 static DEFINE_RWLOCK(masq_lock);
@@ -77,7 +77,7 @@ masquerade_tg(struct sk_buff *skb, const struct net_device *in,
                return NF_ACCEPT;
 
        mr = targinfo;
-       rt = (struct rtable *)skb->dst;
+       rt = skb->rtable;
        newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
        if (!newsrc) {
                printk("MASQUERADE: %s ate my IP address\n", out->name);
@@ -95,7 +95,7 @@ masquerade_tg(struct sk_buff *skb, const struct net_device *in,
                  mr->range[0].min, mr->range[0].max });
 
        /* Hand modified range to generic setup. */
-       return nf_nat_setup_info(ct, &newrange, hooknum);
+       return nf_nat_setup_info(ct, &newrange, IP_NAT_MANIP_SRC);
 }
 
 static int
@@ -120,7 +120,7 @@ static int masq_device_event(struct notifier_block *this,
 {
        const struct net_device *dev = ptr;
 
-       if (dev->nd_net != &init_net)
+       if (dev_net(dev) != &init_net)
                return NOTIFY_DONE;
 
        if (event == NETDEV_DOWN) {
@@ -139,18 +139,8 @@ static int masq_inet_event(struct notifier_block *this,
                           unsigned long event,
                           void *ptr)
 {
-       const struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
-
-       if (event == NETDEV_DOWN) {
-               /* IP address was deleted.  Search entire table for
-                  conntracks which were associated with that device,
-                  and forget them. */
-               NF_CT_ASSERT(dev->ifindex != 0);
-
-               nf_ct_iterate_cleanup(device_cmp, (void *)(long)dev->ifindex);
-       }
-
-       return NOTIFY_DONE;
+       struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+       return masq_device_event(this, event, dev);
 }
 
 static struct notifier_block masq_dev_notifier = {