[CRIU] [PATCH 2/2] net: Don't fail on missing icmp entries

Pavel Emelyanov xemul at parallels.com
Tue May 12 02:05:30 PDT 2015


On 05/12/2015 11:55 AM, Cyrill Gorcunov wrote:
> On Tue, May 12, 2015 at 11:47:47AM +0300, Pavel Emelyanov wrote:
>>
>> I mean like this
>>
>> @@ -100,11 +107,14 @@ static int ipv4_conf_op(char *tgt, int *conf, int op, NetnsEntry **netns)
>>  			continue;
>>  		}
>>  
>> +		if (op == CTL_WRITE && conf[i] == DEVCONFS_UNUSED)
>> +			continue;
>> +
>>  		snprintf(path[i], MAX_CONF_OPT_PATH, "%s/%s/%s", NET_CONF_PATH, tgt, devconfs[i]);
>>  		req[ri].name = path[i];
>>  		req[ri].arg = &conf[i];
>>  		req[ri].type = CTL_32;
>> -		req[ri].flags = 0;
>> +		req[ri].flags = flags;
>> +		conf[i] = DEVCONFS_UNUSED;
>>  		req[ri].status = 0;
>>  		ri++;
>>  	}
>>
>> and no post-loop.
> 
> This won't work, conf[i] here comes for write operation as well,
> so you have to add another if (op == READ) which makes code
> even more uglier i think.

You do if (req == READ) anyway. And your internal loop is from 0 to ri which
required additional branticks to understand why it's such ;)

> Moreover this rewrites caller variable
> without testing if its optional. That said, I don;t like such
> approach, but if you prefer sure I can add if (op == read) here.

Please :)

-- Pavel


More information about the CRIU mailing list