net: Allow to specify ifindex when device is moved to another namespace
authorAndrei Vagin <avagin@gmail.com>
Mon, 5 Apr 2021 07:12:23 +0000 (00:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Apr 2021 21:49:40 +0000 (14:49 -0700)
commiteeb85a14ee3494febb85ccfbee0772eda0823b13
tree7d5dbe29daf44df707f4439e8f8e6441ed13ba43
parentd3295869c40cb69a2c599000009b3fde43cec2ec
net: Allow to specify ifindex when device is moved to another namespace

Currently, we can specify ifindex on link creation. This change allows
to specify ifindex when a device is moved to another network namespace.

Even now, a device ifindex can be changed if there is another device
with the same ifindex in the target namespace. So this change doesn't
introduce completely new behavior, it adds more control to the process.

CRIU users want to restore containers with pre-created network devices.
A user will provide network devices and instructions where they have to
be restored, then CRIU will restore network namespaces and move devices
into them. The problem is that devices have to be restored with the same
indexes that they have before C/R.

Cc: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Suggested-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c
include/linux/netdevice.h
net/core/dev.c
net/core/rtnetlink.c
net/ieee802154/core.c
net/wireless/core.c