[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACAyw9_kY9fPdC5DLz4GKiBR8B4mCCnknB2xY1DSKYwkridgFQ@mail.gmail.com>
Date: Fri, 19 Feb 2021 12:23:59 +0000
From: Lorenz Bauer <lmb@...udflare.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
kernel-team <kernel-team@...udflare.com>
Subject: Re: [PATCH bpf-next v2 1/4] net: add SO_NETNS_COOKIE socket option
On Fri, 19 Feb 2021 at 11:49, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> > + case SO_NETNS_COOKIE:
> > + lv = sizeof(u64);
> > + if (len < lv)
> > + return -EINVAL;
>
> if (len != lv)
> return -EINVAL;
>
> (There is no reason to support bigger value before at least hundred years)
Sorry that was copy pasta from SO_COOKIE which uses the same check. I'll
change it to your suggestion. Want me to fix SO_COOKIE as well?
>
> > +#ifdef CONFIG_NET_NS
> > + v.val64 = sock_net(sk)->net_cookie;
> > +#else
> > + v.val64 = init_net.net_cookie;
> > +#endif
> > + break;
> > +
>
> Why using this ugly #ifdef ?
>
> The following should work just fine, even if CONFIG_NET_NS is not set.
>
> v.val64 = sock_net(sk)->net_cookie;
I looked at sock_net and didn't understand how it avoids a compile error
so I didn't use it, thanks for pointing this out.
--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
www.cloudflare.com
Powered by blists - more mailing lists