diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-23 23:19:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-23 23:19:20 -0500 |
commit | 34cc7ba6398203aab4056917fa1e2aa5988487aa (patch) | |
tree | 40fc152c1d9722ca70154bd6d989694fff526280 /net/ipv4/ip_gre.c | |
parent | 55b01e8681cba392ccda4ff6184054d38968115d (diff) |
[IP_TUNNEL]: Don't limit the number of tunnels with generic name explicitly.
Use the added dev_alloc_name() call to create tunnel device name,
rather than iterate in a hand-made loop with an artificial limit.
Thanks Patrick for noticing this.
[ The way this works is, when the device is actually registered,
the generic code noticed the '%' in the name and invokes
dev_alloc_name() to fully resolve the name. -DaveM ]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 63f691719353..906cb1ada4c3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -259,16 +259,8 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int | |||
259 | 259 | ||
260 | if (parms->name[0]) | 260 | if (parms->name[0]) |
261 | strlcpy(name, parms->name, IFNAMSIZ); | 261 | strlcpy(name, parms->name, IFNAMSIZ); |
262 | else { | 262 | else |
263 | int i; | 263 | sprintf(name, "gre%%d"); |
264 | for (i=1; i<100; i++) { | ||
265 | sprintf(name, "gre%d", i); | ||
266 | if (__dev_get_by_name(&init_net, name) == NULL) | ||
267 | break; | ||
268 | } | ||
269 | if (i==100) | ||
270 | goto failed; | ||
271 | } | ||
272 | 264 | ||
273 | dev = alloc_netdev(sizeof(*t), name, ipgre_tunnel_setup); | 265 | dev = alloc_netdev(sizeof(*t), name, ipgre_tunnel_setup); |
274 | if (!dev) | 266 | if (!dev) |