aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9031e521c1df..78f438880923 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -229,33 +229,33 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
229 char name[IFNAMSIZ]; 229 char name[IFNAMSIZ];
230 int err; 230 int err;
231 231
232 if (p->name[0]) { 232 if (p->name[0])
233 strlcpy(name, p->name, IFNAMSIZ); 233 strlcpy(name, p->name, IFNAMSIZ);
234 } else { 234 else
235 int i; 235 sprintf(name, "ip6tnl%%d");
236 for (i = 1; i < IP6_TNL_MAX; i++) { 236
237 sprintf(name, "ip6tnl%d", i);
238 if (__dev_get_by_name(&init_net, name) == NULL)
239 break;
240 }
241 if (i == IP6_TNL_MAX)
242 goto failed;
243 }
244 dev = alloc_netdev(sizeof (*t), name, ip6_tnl_dev_setup); 237 dev = alloc_netdev(sizeof (*t), name, ip6_tnl_dev_setup);
245 if (dev == NULL) 238 if (dev == NULL)
246 goto failed; 239 goto failed;
247 240
241 if (strchr(name, '%')) {
242 if (dev_alloc_name(dev, name) < 0)
243 goto failed_free;
244 }
245
248 t = netdev_priv(dev); 246 t = netdev_priv(dev);
249 dev->init = ip6_tnl_dev_init; 247 dev->init = ip6_tnl_dev_init;
250 t->parms = *p; 248 t->parms = *p;
251 249
252 if ((err = register_netdevice(dev)) < 0) { 250 if ((err = register_netdevice(dev)) < 0)
253 free_netdev(dev); 251 goto failed_free;
254 goto failed; 252
255 }
256 dev_hold(dev); 253 dev_hold(dev);
257 ip6_tnl_link(t); 254 ip6_tnl_link(t);
258 return t; 255 return t;
256
257failed_free:
258 free_netdev(dev);
259failed: 259failed:
260 return NULL; 260 return NULL;
261} 261}
@@ -550,6 +550,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
550 ip_rt_put(rt); 550 ip_rt_put(rt);
551 goto out; 551 goto out;
552 } 552 }
553 skb2->dst = (struct dst_entry *)rt;
553 } else { 554 } else {
554 ip_rt_put(rt); 555 ip_rt_put(rt);
555 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, 556 if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,