Re: "new style" netdevice allocation patch for TUN driver (2.4.18 kernel)

From: Maksim (Max) Krasnyanskiy (
Date: Fri Aug 02 2002 - 18:54:02 EST

Hi Jacek,

>I had a lot of problem with tun devices created with both openvpn and
>vtund. When I wanted to shut down my system when the devices were in
>use (eg. TCP connection established on tun0 interface), even if the
>tunneling daemon was killed, it stopped while trying to deconfigure
>network. And "unregister_netdevice: waiting for tun0 to become free"
>message was displayed again and again. I tried to resolve this problem
>using Google, but I have only found out, that this is behaviour of 2.4
>kernels, and that it is proper. After further investigation, in kernel
>sources, I found out, that there are "old style" and "new style" network
>devices, and that only the "old style" devices have this problem.
>I had similar problem with VLAN devices some time ago, so I checked VLAN
>driver sources too. As I suspected, it was "new style" device now.
>The patch below is my try to make tun device "new style" too. It seems
>to work for me, but I am not sure if it is 100% proper. This is patch
>against 2.4.18 sources.
You're fixing the wrong problem. It seems that some subsystem is not releasing
tun device during shutdown/deregistration. (See comment in
You're not gonna see "waiting for" warning anymore if you change to new
style allocation.
But you're gonna leak tun devices because destructor is not called unless
refcount is zero.

>Sorry, for spamming all those addresses, but I am not sure which one is
>correct. Driver on URL given in MAINTAINERS file seems to be a bit
URL is ok. Mailing list has to be update though.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed Aug 07 2002 - 22:00:21 EST