From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kirill Tkhai Subject: [PATCH net-next v2 0/3] Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device Date: Wed, 14 Feb 2018 16:39:45 +0300 Message-ID: <151861548493.9376.6162694167471967.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: davem@davemloft.net, jasowang@redhat.com, edumazet@google.com, xiyou.wangcong@gmail.com, willemb@google.com, peterpenkov96@gmail.com, linyu.yuan@alcatel-sbell.com.cn, kstewart@linuxfoundation.org, aviadye@mellanox.com, gregkh@linuxfoundation.org, ktkhai@virtuozzo.com, davejwatson@fb.com, netdev@vger.kernel.org Return-path: Received: from mail-ve1eur01on0102.outbound.protection.outlook.com ([104.47.1.102]:2320 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030202AbeBNNjz (ORCPT ); Wed, 14 Feb 2018 08:39:55 -0500 Sender: netdev-owner@vger.kernel.org List-ID: 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. v2: Add new patch [2/3] to export open_related_ns(). --- Kirill Tkhai (3): net: Make extern and export get_net_ns() net: Export open_related_ns() tun: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device drivers/net/tun.c | 16 ++++++++++++++-- fs/nsfs.c | 1 + include/linux/socket.h | 2 ++ net/socket.c | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-)