[CRIU] [PATCH v3] net: Add ip rule save/restore

Pavel Emelyanov xemul at parallels.com
Fri Oct 23 10:02:25 PDT 2015


On 10/23/2015 07:58 PM, Kirill Tkhai wrote:
> 
> 
> On 23.10.2015 19:54, Pavel Emelyanov wrote:
>>> @@ -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.
> 
> This case all developers and users must update their iproute2 package
> to mainstream version.

No, this is the case when the image file failed to open for some
reason other than ENOENT. The iproute2 is not even yet launched.

>>
>>> +		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