|
|
ce88bd |
From c321cc07607cfe4215fc90e426ae4491fca4c49c Mon Sep 17 00:00:00 2001
|
|
|
ce88bd |
From: Adrian Reber <areber@redhat.com>
|
|
|
ce88bd |
Date: Thu, 22 Nov 2018 13:44:03 +0000
|
|
|
ce88bd |
Subject: [PATCH] Fix kerndat_link_nsid() on systems with more than 10
|
|
|
ce88bd |
interfaces
|
|
|
ce88bd |
|
|
|
ce88bd |
On a system with more than 10 network interfaces the link_nsid check
|
|
|
ce88bd |
fails:
|
|
|
ce88bd |
|
|
|
ce88bd |
$ criu check --feature link_nsid
|
|
|
ce88bd |
Warn (criu/cr-check.c:1237): NSID isn't supported
|
|
|
ce88bd |
|
|
|
ce88bd |
The function kerndat_link_nsid() uses:
|
|
|
ce88bd |
|
|
|
ce88bd |
nde.ifindex = 10;
|
|
|
ce88bd |
|
|
|
ce88bd |
This fails as there is already an interface with ifindex 10.
|
|
|
ce88bd |
|
|
|
ce88bd |
This patch moves the creation of the socket into the second network
|
|
|
ce88bd |
namespace and the feature check succeeds.
|
|
|
ce88bd |
|
|
|
ce88bd |
Suggested-by: Jiri Benc <jbenc@redhat.com>
|
|
|
ce88bd |
Signed-off-by: Adrian Reber <areber@redhat.com>
|
|
|
ce88bd |
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
|
|
ce88bd |
---
|
|
|
ce88bd |
criu/net.c | 12 ++++++------
|
|
|
ce88bd |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
ce88bd |
|
|
|
ce88bd |
diff --git a/criu/net.c b/criu/net.c
|
|
|
ce88bd |
index ec66d1e6c3..c1a6e3094f 100644
|
|
|
ce88bd |
--- a/criu/net.c
|
|
|
ce88bd |
+++ b/criu/net.c
|
|
|
ce88bd |
@@ -3148,12 +3148,6 @@ int kerndat_link_nsid()
|
|
|
ce88bd |
};
|
|
|
ce88bd |
int nsfd, sk, ret;
|
|
|
ce88bd |
|
|
|
ce88bd |
- sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
|
|
ce88bd |
- if (sk < 0) {
|
|
|
ce88bd |
- pr_perror("Unable to create a netlink socket");
|
|
|
ce88bd |
- exit(1);
|
|
|
ce88bd |
- }
|
|
|
ce88bd |
-
|
|
|
ce88bd |
if (unshare(CLONE_NEWNET)) {
|
|
|
ce88bd |
pr_perror("Unable create a network namespace");
|
|
|
ce88bd |
exit(1);
|
|
|
ce88bd |
@@ -3168,6 +3162,12 @@ int kerndat_link_nsid()
|
|
|
ce88bd |
exit(1);
|
|
|
ce88bd |
}
|
|
|
ce88bd |
|
|
|
ce88bd |
+ sk = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
|
|
ce88bd |
+ if (sk < 0) {
|
|
|
ce88bd |
+ pr_perror("Unable to create a netlink socket");
|
|
|
ce88bd |
+ exit(1);
|
|
|
ce88bd |
+ }
|
|
|
ce88bd |
+
|
|
|
ce88bd |
nde.type = ND_TYPE__VETH;
|
|
|
ce88bd |
nde.name = "veth";
|
|
|
ce88bd |
nde.ifindex = 10;
|