[Devel] [PATCH] tun: Add ioctl() TUNGETDEVNETNS cmd to allow obtaining real net ns of tun device

Kirill Gorkunov gorcunov at virtuozzo.com
Wed Nov 6 14:07:58 MSK 2019


On Wed, Nov 06, 2019 at 01:57:56PM +0300, Alexander Mikhalitsyn wrote:
> In commit f2780d6d7475 "tun: Add ioctl() SIOCGSKNS cmd to allow
> obtaining net ns of tun device" it was missed that tun may change
> its net ns, while net ns of socket remains the same as it was
> created initially. SIOCGSKNS returns net ns of socket, so it is
> not suitable for obtaining net ns of device.
> 
> We may have two tun devices with the same names in two net ns,
> and in this case it's not possible to determ, which of them
> fd refers to (TUNGETIFF will return the same name).
> 
> This patch adds new ioctl() cmd for obtaining net ns of a device.
> 
> Reported-by: Harald Albrecht <harald.albrecht at gmx.net>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> 
> https://jira.sw.ru/browse/PSBM-99027
> (ported from commit 0c3e0e3bb623c3735b8c9ab8aa8332f944f83a9f)
> Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>



More information about the Devel mailing list