summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2018-02-14 16:40:14 +0300
committerDavid S. Miller <davem@davemloft.net>2018-02-15 15:34:42 -0500
commitf2780d6d74756bc1d7ba32ff3dd0de4afd7c7e1e (patch)
tree379cb186c759641311ec2eed0c3e1aba9e30fa3c /net
parent24dce0800baaa508b1a8ccf01ae0a9c8e600a5aa (diff)
downloadop-kernel-dev-f2780d6d74756bc1d7ba32ff3dd0de4afd7c7e1e.zip
op-kernel-dev-f2780d6d74756bc1d7ba32ff3dd0de4afd7c7e1e.tar.gz
tun: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device
This patch adds possibility to get tun device's net namespace fd in the same way we allow to do that for sockets. Socket ioctl numbers do not intersect with tun-specific, and there is already SIOCSIFHWADDR used in tun code. So, SIOCGSKNS number is choosen instead of custom-made for this functionality. Note, that open_related_ns() uses plain get_net_ns() and it's safe (net can't be already dead at this moment): tun socket is allocated via sk_alloc() with zero last arg (kern = 0). So, each alive socket increments net::count, and the socket is definitely alive during ioctl syscall. Also, common variable net is introduced, so small cleanup in TUNSETIFF is made. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud