Currently, it's not possible to get or check net namespace,
which was used to create tun socket. User may have two tun
devices with the same names in different nets, and there
is no way to differ them each other.

The patchset adds support for ioctl() cmd SIOCGSKNS for tun
devices. It will allow people to obtain net namespace file
descriptor like we allow to do that for sockets in general.


Kirill Tkhai (2):
      net: Make extern and export get_net_ns()
      tun: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device

 drivers/net/tun.c      |   16 ++++++++++++++--
 include/linux/socket.h |    2 ++
 net/socket.c           |    3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

Signed-off-by: Kirill Tkhai <>

Reply via email to