diff options
author | Pavel Emelyanov <xemul@parallels.com> | 2013-08-21 14:31:38 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-21 12:21:45 -0700 |
commit | fb7589a162162223e6bb6422dde3fb1ce07d9a78 (patch) | |
tree | f99c3c7c9af2681f57b8b7beb4b859bf9d2bf4f5 /include/uapi/linux/if_tun.h | |
parent | 5f1cd200c4e4e1a6bce946aaac40c7a10427f3ed (diff) |
tun: Add ability to create tun device with given index
Tun devices cannot be created with ifidex user wants, but it's
required by checkpoint-restore project.
Long time ago such ability was implemented for rtnl_ops-based
interface for creating links (9c7dafbf net: Allow to create links
with given ifindex), but the only API for creating and managing
tuntap devices is ioctl-based and is evolving with adding new ones
(cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
device).
Following that trend, here's how a new ioctl that sets the ifindex
for device, that _will_ be created by TUNSETIFF ioctl looks like.
So those who want a tuntap device with the ifindex N, should open
the tun device, call ioctl(fd, TUNSETIFINDEX, &N), then call TUNSETIFF.
If the index N is busy, then the register_netdev will find this out
and the ioctl would be failed with -EBUSY.
If setifindex is not called, then it will be generated as before.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/if_tun.h')
-rw-r--r-- | include/uapi/linux/if_tun.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h index 1870ee29bb3..c58d023c482 100644 --- a/include/uapi/linux/if_tun.h +++ b/include/uapi/linux/if_tun.h @@ -56,6 +56,7 @@ #define TUNGETVNETHDRSZ _IOR('T', 215, int) #define TUNSETVNETHDRSZ _IOW('T', 216, int) #define TUNSETQUEUE _IOW('T', 217, int) +#define TUNSETIFINDEX _IOW('T', 218, unsigned int) /* TUNSETIFF ifr flags */ #define IFF_TUN 0x0001 |