]> git.baikalelectronics.ru Git - kernel.git/commit
[TUN]: Allow to register tun devices in namespace.
authorPavel Emelyanov <xemul@openvz.org>
Wed, 16 Apr 2008 07:41:53 +0000 (00:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Apr 2008 07:41:53 +0000 (00:41 -0700)
commit2f7c1787dd77f205876c25b8cec92b50acba4175
treeeba647feaa75df68b852b2d5d948e5ee5f7dbddf
parentcc9eacbb0568b9ace9d9d8e5e66ba812a10cde33
[TUN]: Allow to register tun devices in namespace.

This is basically means that a net is set for a new device, but
actually also involves two more steps:

1. mark the tun device as "local", i.e. do not allow for it to
   move across namespaces.

This is done so, since tun device is most often associated to some
file (and thus to some process) and moving the device alone is not
valid while keeping the file and the process outside. The need in
ability to move a detached persistent device is to be investigated
later.

2. get the tun device's net when tun becomes attached and put one
   when it becomes detached.

This is needed to handle the case when a task owning the tun dies,
but a files lives for some more time - in this case we must not
allow for net to be freed, since its exit hook will spoil that file's
private data by unregistering the tun from under tun_chr_close.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c