lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 02 Jul 2014 15:57:32 +0200
From:	Nicolas Dichtel <nicolas.dichtel@...nd.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
	netdev@...r.kernel.org
CC:	davem@...emloft.net, ebiederm@...ssion.com,
	stephen@...workplumber.org
Subject: Re: [RFC PATCH net-next 1/5] netns: allocate netns ids

Le 02/07/2014 15:33, Sergei Shtylyov a écrit :
> Hello.
>
> On 07/02/2014 03:59 PM, Nicolas Dichtel wrote:
>
>> With this patch, netns allocates ids for all netns. Each netns has its own list
>> of ids, it means that the id is valid only in the current netns.
>
>> For homogeneity, an id is also allocated for the netns owner itself.
>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
> [...]
>
>> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
>> index 85b62691f4f2..2976864cef13 100644
>> --- a/net/core/net_namespace.c
>> +++ b/net/core/net_namespace.c
>> @@ -144,6 +144,30 @@ static void ops_free_list(const struct pernet_operations
>> *ops,
>>       }
>>   }
>>
>> +static int net_eq_idr(int id, void *net, void *peer)
>> +{
>> +    return net_eq(net, peer) ? id : 0;
>> +}
>> +
>> +int net2id(struct net *net, struct net *peer)
>> +{
>> +    ASSERT_RTNL();
>> +    return idr_for_each(&(net)->netns_ids, net_eq_idr, (peer)) ? : -ENOENT;
>
>     I don't think the inner parens are needed, this is not a macro body...
Right!
In fact, it was a macro at the beginning ;-)

>
>> +}
>> +
>> +struct net *get_net_from_netnsid(struct net *net, int id)
>> +{
>> +    struct net *peer;
>> +
>> +    rcu_read_lock();
>> +    peer = idr_find(&(net)->netns_ids, id);
>
>     Same here.
Same.

Thank you,
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ