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

Kirill Tkhai ktkhai at odin.com
Fri Oct 23 09:58:23 PDT 2015



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.

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