Skip to content
Commit 0c3e0e3b authored by Kirill Tkhai's avatar Kirill Tkhai Committed by David S. Miller
Browse files

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

In commit f2780d6d

 "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: default avatarHarald Albrecht <harald.albrecht@gmx.net>
Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 28b18b39
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment