[CRIU] [PATCH 1/2] tun: Add compatibility with old images
Cyrill Gorcunov
gorcunov at gmail.com
Tue Jan 29 17:12:48 MSK 2019
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
criu/tun.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/criu/tun.c b/criu/tun.c
index b13148b0b912..6b3f3fb3ff42 100644
--- a/criu/tun.c
+++ b/criu/tun.c
@@ -139,8 +139,14 @@ static struct tun_link *find_tun_link(char *name, unsigned int ns_id)
struct tun_link *tl;
list_for_each_entry(tl, &tun_links, l) {
- if (!strcmp(tl->name, name) &&
- tl->ns_id == ns_id)
+ if (strcmp(tl->name, name))
+ continue;
+ /*
+ * Old images or kernel do not have SIOCGSKNS support,
+ * and ns_id = 0, so then we can rely on names matching
+ * only.
+ */
+ if (ns_id == 0 || tl->ns_id == ns_id)
return tl;
}
return NULL;
--
2.20.1
More information about the CRIU
mailing list