diff options
author | Steve French <sfrench@us.ibm.com> | 2008-03-01 13:29:55 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-03-01 13:29:55 -0500 |
commit | 0dbd888936a23514716b8d944775bc56f731363a (patch) | |
tree | a2c60cdc45bdcbed47680731fa8188bffe58c098 /net/ipv4/ipip.c | |
parent | 0b442d2c28479332610c46e1a74e5638ab63a97d (diff) | |
parent | d395991c117d43bfca97101a931a41d062a93852 (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r-- | net/ipv4/ipip.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index da281581692c..dbaed69de06a 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -221,35 +221,31 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c | |||
221 | 221 | ||
222 | if (parms->name[0]) | 222 | if (parms->name[0]) |
223 | strlcpy(name, parms->name, IFNAMSIZ); | 223 | strlcpy(name, parms->name, IFNAMSIZ); |
224 | else { | 224 | else |
225 | int i; | 225 | sprintf(name, "tunl%%d"); |
226 | for (i=1; i<100; i++) { | ||
227 | sprintf(name, "tunl%d", i); | ||
228 | if (__dev_get_by_name(&init_net, name) == NULL) | ||
229 | break; | ||
230 | } | ||
231 | if (i==100) | ||
232 | goto failed; | ||
233 | } | ||
234 | 226 | ||
235 | dev = alloc_netdev(sizeof(*t), name, ipip_tunnel_setup); | 227 | dev = alloc_netdev(sizeof(*t), name, ipip_tunnel_setup); |
236 | if (dev == NULL) | 228 | if (dev == NULL) |
237 | return NULL; | 229 | return NULL; |
238 | 230 | ||
231 | if (strchr(name, '%')) { | ||
232 | if (dev_alloc_name(dev, name) < 0) | ||
233 | goto failed_free; | ||
234 | } | ||
235 | |||
239 | nt = netdev_priv(dev); | 236 | nt = netdev_priv(dev); |
240 | dev->init = ipip_tunnel_init; | 237 | dev->init = ipip_tunnel_init; |
241 | nt->parms = *parms; | 238 | nt->parms = *parms; |
242 | 239 | ||
243 | if (register_netdevice(dev) < 0) { | 240 | if (register_netdevice(dev) < 0) |
244 | free_netdev(dev); | 241 | goto failed_free; |
245 | goto failed; | ||
246 | } | ||
247 | 242 | ||
248 | dev_hold(dev); | 243 | dev_hold(dev); |
249 | ipip_tunnel_link(nt); | 244 | ipip_tunnel_link(nt); |
250 | return nt; | 245 | return nt; |
251 | 246 | ||
252 | failed: | 247 | failed_free: |
248 | free_netdev(dev); | ||
253 | return NULL; | 249 | return NULL; |
254 | } | 250 | } |
255 | 251 | ||