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

Pavel Emelyanov xemul at parallels.com
Tue May 12 01:47:33 PDT 2015


On 05/12/2015 11:39 AM, Cyrill Gorcunov wrote:
> On Tue, May 12, 2015 at 11:30:29AM +0300, Pavel Emelyanov wrote:
>>
>>> @@ -114,6 +124,14 @@ static int ipv4_conf_op(char *tgt, int *conf, int op, NetnsEntry **netns)
>>>  		pr_err("Failed to %s %s/<confs>\n", (op == CTL_READ)?"read":"write", tgt);
>>>  		return -1;
>>>  	}
>>> +
>>> +	if (op == CTL_READ) {
>>> +		for (i = 0; i < ri; i++) {
>>> +			if (req[i].status & CTL_STATUS_ENOENT)
>>> +				*(int *)req[i].arg = DEVCONFS_UNUSED;
>>> +		}
>>> +	}
>>> +
>>>  	return 0;
>>>  }
>>>  
>>>
>>
>> I don't like this loop. Can we assign -1-s in the beginning of the
>> ipv4_conf_op?
> 
> req is a structure so we have to walk over even to assign -1's there,
> so i don't see much difference.

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[ri] = DEVCONFS_UNUSED;
 		req[ri].status = 0;
 		ri++;
 	}

and no post-loop.

-- Pavel


More information about the CRIU mailing list