Commit 5be76840 authored by Adrian Reber's avatar Adrian Reber Committed by Andrei Vagin

Fix kerndat_link_nsid() on systems with more than 10 interfaces

On a system with more than 10 network interfaces the link_nsid check
fails:

$ criu check --feature link_nsid
Warn  (criu/cr-check.c:1237): NSID isn't supported

The function kerndat_link_nsid() uses:

 nde.ifindex = 10;

This fails as there is already an interface with ifindex 10.

This patch moves the creation of the socket into the second network
namespace and the feature check succeeds.
Suggested-by: 's avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent d4f3c7cd
......@@ -3121,12 +3121,6 @@ int kerndat_link_nsid()
};
int nsfd, sk, ret;
sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sk < 0) {
pr_perror("Unable to create a netlink socket");
exit(1);
}
if (unshare(CLONE_NEWNET)) {
pr_perror("Unable create a network namespace");
exit(1);
......@@ -3141,6 +3135,12 @@ int kerndat_link_nsid()
exit(1);
}
sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sk < 0) {
pr_perror("Unable to create a netlink socket");
exit(1);
}
nde.type = ND_TYPE__VETH;
nde.name = "veth";
nde.ifindex = 10;
......
Markdown is supported
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