Re: 2.4.13-ac5 && vtun not working

Maksim Krasnyanskiy (maxk@qualcomm.com)
Wed, 31 Oct 2001 09:55:47 -0800


At 10:43 AM 10/31/01 +0100, pcg@goof.com ( Marc) (A.) (Lehmann ) wrote:
>On Wed, Oct 31, 2001 at 12:30:56AM -0800, "David S. Miller" <davem@redhat.com> wrote:
>> You're right, it should allow the "string has no '%' at all" case
>> as well. Please, someone send me a patch which does this.
>
>My original mail contained a one-line fix, suboptimal but works fine for me.
>I also found a more elaborate patch:
>
> http://www.geocrawler.com/lists/3/SourceForge/12162/0/6896612/
>
>it seems to use a fancier algorithm and has been used by more people.

Here is the patch for TUN/TAP to remove that suboptimality :).
So we won't call dev_alloc_name if name is not a template.

--- tun.c.old Tue Oct 30 21:00:55 2001
+++ tun.c Tue Oct 30 21:10:17 2001
@@ -377,8 +377,11 @@
if (*ifr->ifr_name)
name = ifr->ifr_name;

- if ((err = dev_alloc_name(&tun->dev, name)) < 0)
- goto failed;
+ if (strchr(name, '%')) {
+ err = dev_alloc_name(&tun->dev, name);
+ if (err) goto failed;
+ }
+
if ((err = register_netdevice(&tun->dev)))
goto failed;

Untested but looks obvious.

Max

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/