[CRIU] [PATCH v2 3/5] tun: Check that net ns of tun device is dumped
Kirill Tkhai
ktkhai at virtuozzo.com
Fri Mar 2 15:46:37 MSK 2018
Similar to socket logic, abort the dump,
if tun is not related to any net ns, seen
before.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/tun.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/criu/tun.c b/criu/tun.c
index 117d30aa3..a6cd372d3 100644
--- a/criu/tun.c
+++ b/criu/tun.c
@@ -290,6 +290,7 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
struct cr_img *img;
FileEntry fe = FILE_ENTRY__INIT;
TunfileEntry tfe = TUNFILE_ENTRY__INIT;
+ struct ns_id *ns;
struct ifreq ifr;
if (!(root_ns_mask & CLONE_NEWNET)) {
@@ -297,6 +298,14 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
return -1;
}
+ if (kdat.tun_ns) {
+ ns = get_socket_ns(lfd);
+ if (!ns) {
+ pr_err("No net_ns for tun device\n");
+ return -1;
+ }
+ }
+
if (dump_one_reg_file(lfd, id, p))
return -1;
More information about the CRIU
mailing list