]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit260bbc20c87f473098e8caa33c7bb13fc2a8c9a3
tree7d5dbe29daf44df707f4439e8f8e6441ed13ba43
parentbbf396e69b3a3d80abcdd9ced6e5fe57b908d80e
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