[CRIU] [PATCH 01/12] images: add a network namespace id into images

Pavel Emelyanov xemul at virtuozzo.com
Tue Mar 21 03:30:43 PDT 2017


On 03/17/2017 09:19 PM, Andrei Vagin wrote:
> On Mon, Mar 13, 2017 at 01:44:03PM +0300, Pavel Emelyanov wrote:
>> On 03/01/2017 02:52 AM, Andrei Vagin wrote:
>>> From: Andrei Vagin <avagin at virtuozzo.com>
>>>
>>> It is possible to assign id for network namespaces and
>>> this id will be used by the kernel in some netlink messages.
>>> If no id is assigned when the kernel needs it, it will be
>>> automatically assigned by the kernel.
>>>
>>> For example, this id is reported for peer veth devices.
>>>
>>> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
>>> ---
>>>  images/netdev.proto | 10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/images/netdev.proto b/images/netdev.proto
>>> index 2f2f3d1..5bf39ef 100644
>>> --- a/images/netdev.proto
>>> +++ b/images/netdev.proto
>>> @@ -42,6 +42,14 @@ message net_device_entry {
>>>  	repeated sysctl_entry conf6	= 10;
>>>  
>>>  	optional macvlan_link_entry	macvlan		= 11;
>>> +
>>> +	optional uint32 peer_ifindex	= 12;
>>> +	optional uint32 peer_nsid	= 13;
>>> +}
>>> +
>>> +message netns_id {
>>> +	required uint32	id	= 1;
>>> +	required int32	nsid	= 2;
>>
>> Would you explain why netns_id has two integers and why one of
>> them can be negative?
> 
> I will add a comment. Here id is ns->id. Each net namespace has own set
> of of nsid-s for other namespaces.

OK, so one field is effectively target ns id and references
netns_entry object, while the other one is the user-defined
value.

I propose to name them target_ns_id and nsid_value and ...
still explain why the latter one can be negative :)

>>
>>>  }
>>>  
>>>  message netns_entry {
>>> @@ -53,4 +61,6 @@ message netns_entry {
>>>  
>>>  	repeated sysctl_entry def_conf6	= 5;
>>>  	repeated sysctl_entry all_conf6	= 6;
>>> +
>>> +	repeated netns_id nsids		= 7;
>>>  }
>>>
>>
> .
> 



More information about the CRIU mailing list