]> err.no Git - linux-2.6/commitdiff
[NETNS]: Process inet_confirm_addr in the correct namespace.
authorDenis V. Lunev <den@openvz.org>
Tue, 15 Jan 2008 07:06:19 +0000 (23:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:13 +0000 (15:02 -0800)
inet_confirm_addr can be called with NULL in_dev from arp_ignore iff
scope is RT_SCOPE_LINK.

Lets always pass the device and check for RT_SCOPE_LINK scope inside
inet_confirm_addr. This let us take network namespace from in_device a
need for an additional argument.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/arp.c
net/ipv4/devinet.c

index 6f0827b2b154c298869f825d3585a41002008f55..b2c19cb12063b022eaccc9e66f0df02370642e32 100644 (file)
@@ -402,7 +402,6 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
        case 3: /* Do not reply for scope host addresses */
                sip = 0;
                scope = RT_SCOPE_LINK;
-               in_dev = NULL;
                break;
        case 4: /* Reserved */
        case 5:
index dc1665a2b0751caefa28adb8b51e1de7f9a56b63..e381edb19b2317098ef9d40dd2d18933e718940b 100644 (file)
@@ -978,13 +978,15 @@ __be32 inet_confirm_addr(struct in_device *in_dev,
 {
        __be32 addr = 0;
        struct net_device *dev;
+       struct net *net;
 
-       if (in_dev != NULL)
+       if (scope != RT_SCOPE_LINK)
                return confirm_addr_indev(in_dev, dst, local, scope);
 
+       net = in_dev->dev->nd_net;
        read_lock(&dev_base_lock);
        rcu_read_lock();
-       for_each_netdev(&init_net, dev) {
+       for_each_netdev(net, dev) {
                if ((in_dev = __in_dev_get_rcu(dev))) {
                        addr = confirm_addr_indev(in_dev, dst, local, scope);
                        if (addr)