From: Daniel Borkmann <daniel@iogearbox.net>
To: Jianlin Lv <Jianlin.Lv@arm.com>, bpf@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, ast@kernel.org, yhs@fb.com,
Song.Zhu@arm.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Generate cookie for new non-initial net NS
Date: Tue, 21 Jul 2020 22:17:58 +0200 [thread overview]
Message-ID: <840a9007-3dcb-457f-8746-7f8e6fa209c5@iogearbox.net> (raw)
In-Reply-To: <20200720140919.22342-1-Jianlin.Lv@arm.com>
On 7/20/20 4:09 PM, Jianlin Lv wrote:
> For non-initial network NS, the net cookie is generated when
> bpf_get_netns_cookie_sock is called for the first time, but it is more
> reasonable to complete the cookie generation work when creating a new
> network NS, just like init_net.
> net_gen_cookie() be moved into setup_net() that it can serve the initial
> and non-initial network namespace.
>
> Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
What use-case are you trying to solve? Why should it be different than, say,
socket cookie generation? I'm currently not seeing much of a point in moving
this. When it's not used in the system, it would actually create more work.
> ---
> net/core/net_namespace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index dcd61aca343e..5937bd0df56d 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -336,6 +336,7 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
> idr_init(&net->netns_ids);
> spin_lock_init(&net->nsid_lock);
> mutex_init(&net->ipv4.ra_mutex);
> + net_gen_cookie(net);
>
> list_for_each_entry(ops, &pernet_list, list) {
> error = ops_init(ops, net);
> @@ -1101,7 +1102,6 @@ static int __init net_ns_init(void)
> panic("Could not allocate generic netns");
>
> rcu_assign_pointer(init_net.gen, ng);
> - net_gen_cookie(&init_net);
>
> down_write(&pernet_ops_rwsem);
> if (setup_net(&init_net, &init_user_ns))
>
next prev parent reply other threads:[~2020-07-21 20:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 14:09 [PATCH bpf-next] bpf: Generate cookie for new non-initial net NS Jianlin Lv
2020-07-21 20:17 ` Daniel Borkmann [this message]
2020-07-22 6:30 ` Jianlin Lv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=840a9007-3dcb-457f-8746-7f8e6fa209c5@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=Jianlin.Lv@arm.com \
--cc=Song.Zhu@arm.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).