mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
restore/net/ipv6: net device and def/all configuration
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. Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Reviewed-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
715a08b466
commit
99e65b424c
23
criu/net.c
23
criu/net.c
@@ -179,9 +179,12 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
|
|||||||
continue;
|
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]);
|
pr_debug("Skip %s/%s, coincides with default\n", tgt, devconfs[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1002,6 +1005,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);
|
ret = ipv4_conf_op(nde->name, nde->conf4, nde->n_conf4, CTL_WRITE, def_netns ? (*def_netns)->def_conf4 : NULL);
|
||||||
else if (nde->conf)
|
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);
|
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:
|
exit:
|
||||||
net_device_entry__free_unpacked(nde, NULL);
|
net_device_entry__free_unpacked(nde, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -1322,12 +1330,23 @@ static int restore_netns_conf(int pid, NetnsEntry **netns)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
ret = ipv4_conf_op("all", (*netns)->all_conf4, (*netns)->n_all_conf4, CTL_WRITE, NULL);
|
ret = ipv4_conf_op("all", (*netns)->all_conf4, (*netns)->n_all_conf4, CTL_WRITE, NULL);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
} else if ((*netns)->def_conf) {
|
} else if ((*netns)->def_conf) {
|
||||||
/* Backward compatibility */
|
/* Backward compatibility */
|
||||||
ret = ipv4_conf_op_old("default", (*netns)->def_conf, (*netns)->n_def_conf, CTL_WRITE, NULL);
|
ret = ipv4_conf_op_old("default", (*netns)->def_conf, (*netns)->n_def_conf, CTL_WRITE, NULL);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
ret = ipv4_conf_op_old("all", (*netns)->all_conf, (*netns)->n_all_conf, CTL_WRITE, NULL);
|
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:
|
out:
|
||||||
close_image(img);
|
close_image(img);
|
||||||
|
Reference in New Issue
Block a user