Subject: Re: [PATCH 2/6] net: Add a struct net parameter to sock_create_kern

From: Nicolas Dichtel <[email-masked]>
Date: Tue, 12 May 2015 16:15:08 +0200

Le 12/05/2015 15:16, David Laight a écrit :
> From: Nicolas Dichtel [mailto:[email-masked]]
>> Sent: 12 May 2015 13:29
>> Le 12/05/2015 13:48, David Laight a écrit :
>>> From: Eric W. Biederman
>>>> Sent: 12 May 2015 09:55
>>>>
>>>> On May 12, 2015 3:24:11 AM CDT, David Laight <[email-masked]> wrote:
>>> ...
>>>>> Wouldn't it involve far less churn to add a new function that uses a
>>>>> non-default namespace?
>>>>
>>>> The goal is comprehensible and maintainable kernel code.
>>>>
>>>> Which network namespace your socket is in, is an important property and something you probably care
>>>> about if you are creating kernel sockets.
>>>
>>> That rather depends on whether you've anywhere to get a namespace from.
>>> eg something like ceph/messenger.c
>> sk_net(con->sock->sk)?
>
> What if you don't already have a socket?
> Just an IP(v6) address ?
So you have an IPv6 address and you don't know on which netns this address
belongs? I can't imagine how it can work.

>
>> This parameter is essential, hiding it will just hides bugs.
>> Having this parameter forces the developer to ask himself what is the best
>> value.
>
> What if the answer is 'NFI'?
> Which requires the answer be pushed back to the 'application' configuration?
Your application is bound to a netns.

> Most users will have no idea either.
If you support netns, you *have to know*.

Regards,
Nicolas