[NETNS][IPV6] route6 - Pass the network namespace parameter to rt6_lookup
[deliverable/linux.git] / net / ipv6 / sit.c
index dde7801abeffb83240ac4460c773369843eaa384..68720aa63f962f5899865d37453e12f7e60a11b8 100644 (file)
@@ -171,6 +171,11 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
        if (dev == NULL)
                return NULL;
 
+       if (strchr(name, '%')) {
+               if (dev_alloc_name(dev, name) < 0)
+                       goto failed_free;
+       }
+
        nt = netdev_priv(dev);
        dev->init = ipip6_tunnel_init;
        nt->parms = *parms;
@@ -178,16 +183,16 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
        if (parms->i_flags & SIT_ISATAP)
                dev->priv_flags |= IFF_ISATAP;
 
-       if (register_netdevice(dev) < 0) {
-               free_netdev(dev);
-               goto failed;
-       }
+       if (register_netdevice(dev) < 0)
+               goto failed_free;
 
        dev_hold(dev);
 
        ipip6_tunnel_link(nt);
        return nt;
 
+failed_free:
+       free_netdev(dev);
 failed:
        return NULL;
 }
@@ -334,11 +339,11 @@ out:
        skb_reset_network_header(skb2);
 
        /* Try to guess incoming interface */
-       rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0);
+       rt6i = rt6_lookup(&init_net, &iph6->saddr, NULL, NULL, 0);
        if (rt6i && rt6i->rt6i_dev) {
                skb2->dev = rt6i->rt6i_dev;
 
-               rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0);
+               rt6i = rt6_lookup(&init_net, &iph6->daddr, &iph6->saddr, NULL, 0);
 
                if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
                        struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);
This page took 0.026345 seconds and 5 git commands to generate.