[CRIU] [PATCH v3] net: Add ip rule save/restore
Pavel Emelyanov
xemul at parallels.com
Fri Oct 23 09:54:30 PDT 2015
> @@ -657,6 +678,32 @@ static inline int restore_route(int pid)
> return 0;
> }
>
> +static inline int restore_rule(int pid)
> +{
> + struct cr_img *img;
> + int ret = 0;
> +
> + img = open_image(CR_FD_RULE, O_RSTR, pid);
> + if (!img)
Presumably in this case we should report -1.
> + goto out;
> + if (empty_image(img))
> + goto close;
> + /*
> + * Delete 3 default rules to prevent duplicates. See kernel's
> + * function fib_default_rules_init() for the details.
> + */
> + run_ip_tool("rule", "delete", NULL, -1, -1);
> + run_ip_tool("rule", "delete", NULL, -1, -1);
> + run_ip_tool("rule", "delete", NULL, -1, -1);
> +
> + if (restore_ip_dump(CR_FD_RULE, pid, "rule"))
> + ret = -1;
> +close:
> + close_image(img);
> +out:
> + return ret;
> +}
> +
More information about the CRIU
mailing list