[CRIU] [PATCH v2 09/15] restore/net/ipv6: net device and def/all configuration
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Wed Apr 20 07:42:50 PDT 2016
First restore "all" and then "default"(and "dev") as for some ipv6
sysctls setting all can change the latter(forwarding, disable_ipv6)
e.g.:
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6
cat /proc/sys/net/ipv6/conf/default/disable_ipv6
0
As changing disable_ipv6 sysctl for some device may change mtu sysctl
do not optimize mtu's restore.
https://jira.sw.ru/browse/PSBM-30942
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
criu/net.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/criu/net.c b/criu/net.c
index c265318..d81bdc1 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -173,9 +173,12 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
continue;
}
/*
- * If dev conf value is the same as default skip restoring it
+ * If dev conf value is the same as default skip restoring it,
+ * mtu may be changed by disable_ipv6 so we can not skip
+ * it's restore
*/
- if (def_conf && sysctl_entries_equal(conf[i], def_conf[i])) {
+ if (def_conf && sysctl_entries_equal(conf[i], def_conf[i])
+ && strcmp(devconfs[i], "mtu")) {
pr_debug("Skip %s/%s, coincides with default\n", tgt, devconfs[i]);
continue;
}
@@ -973,6 +976,11 @@ static int restore_links(int pid, NetnsEntry **netns)
ret = ipv4_conf_op(nde->name, nde->conf4, nde->n_conf4, CTL_WRITE, def_netns ? (*def_netns)->def_conf4 : NULL);
else if (nde->conf)
ret = ipv4_conf_op_old(nde->name, nde->conf, nde->n_conf, CTL_WRITE, def_netns ? (*def_netns)->def_conf : NULL);
+ if (ret)
+ goto exit;
+
+ if (nde->conf6)
+ ret = ipv6_conf_op(nde->name, nde->conf6, nde->n_conf6, CTL_WRITE, def_netns ? (*def_netns)->def_conf6 : NULL);
exit:
net_device_entry__free_unpacked(nde, NULL);
if (ret)
@@ -1289,12 +1297,23 @@ static int restore_netns_conf(int pid, NetnsEntry **netns)
if (ret)
goto out;
ret = ipv4_conf_op("all", (*netns)->all_conf4, (*netns)->n_all_conf4, CTL_WRITE, NULL);
+ if (ret)
+ goto out;
} else if ((*netns)->def_conf) {
/* Backward compatibility */
ret = ipv4_conf_op_old("default", (*netns)->def_conf, (*netns)->n_def_conf, CTL_WRITE, NULL);
if (ret)
goto out;
ret = ipv4_conf_op_old("all", (*netns)->all_conf, (*netns)->n_all_conf, CTL_WRITE, NULL);
+ if (ret)
+ goto out;
+ }
+
+ if ((*netns)->def_conf6) {
+ ret = ipv6_conf_op("all", (*netns)->all_conf6, (*netns)->n_all_conf6, CTL_WRITE, NULL);
+ if (ret)
+ goto out;
+ ret = ipv6_conf_op("default", (*netns)->def_conf6, (*netns)->n_def_conf6, CTL_WRITE, NULL);
}
out:
close_image(img);
--
1.9.3
More information about the CRIU
mailing list