Commit 832dfed7 authored by Andrei Vagin's avatar Andrei Vagin

net: handle a case when --empty net is set only for criu dump

The origin idea was to set --empty net for criu dump and criu restore,
but before cde33dcb ("empty-ns: Don't C/R iptables too (v2)"),
criu restore worked without --empty net and we didn't notice that
docker doesn't set this option on restore.

After a small brainstorm, we decided that it is better to remove
this requirement. Docker has to set this option, but with this changes,
the docker issue will be less urgent.

https://github.com/checkpoint-restore/criu/issues/393
parent 91bc6e07
...@@ -1541,13 +1541,18 @@ static inline int restore_iptables(int pid) ...@@ -1541,13 +1541,18 @@ static inline int restore_iptables(int pid)
struct cr_img *img; struct cr_img *img;
img = open_image(CR_FD_IPTABLES, O_RSTR, pid); img = open_image(CR_FD_IPTABLES, O_RSTR, pid);
if (img) { if (img == NULL)
return -1;
if (empty_image(img)) {
ret = 0;
goto ipt6;
}
ret = run_iptables_tool("iptables-restore", img_raw_fd(img), -1); ret = run_iptables_tool("iptables-restore", img_raw_fd(img), -1);
close_image(img); close_image(img);
}
if (ret) if (ret)
return ret; return ret;
ipt6:
img = open_image(CR_FD_IP6TABLES, O_RSTR, pid); img = open_image(CR_FD_IP6TABLES, O_RSTR, pid);
if (img == NULL) if (img == NULL)
return -1; return -1;
......
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