[CRIU] [PATCH 7/8] net: Don't specify link index when restoring its params

Pavel Emelyanov xemul at parallels.com
Thu Dec 26 05:00:55 PST 2013


Well, when we create external link with ip utility we cannot
specify its index. Thus we will not be able to move external
device to namespace and ask criu to restore link params.

However, RTM_SETLINK can happily work with the link name only.
And since we do have one in the images, we can omit setting
the index in the requrest.

TODO: Send patch with index specification to iproute2.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net.c b/net.c
index bceeb4d..75c400d 100644
--- a/net.c
+++ b/net.c
@@ -256,7 +256,8 @@ static int do_rtm_link_req(int msg_type, NetDeviceEntry *nde, int nlsk,
 	req.h.nlmsg_type = msg_type;
 	req.h.nlmsg_seq = CR_NLMSG_SEQ;
 	req.i.ifi_family = AF_PACKET;
-	req.i.ifi_index = nde->ifindex;
+	if (msg_type == RTM_NEWLINK)
+		req.i.ifi_index = nde->ifindex;
 	req.i.ifi_flags = nde->flags;
 
 	addattr_l(&req.h, sizeof(req), IFLA_IFNAME, nde->name, strlen(nde->name));
-- 
1.8.3.1


More information about the CRIU mailing list