Re: [PATCH bpf-next v2 1/4] net: add SO_NETNS_COOKIE socket option

2021-02-19 Thread Eric Dumazet
On 2/19/21 1:23 PM, Lorenz Bauer wrote: > On Fri, 19 Feb 2021 at 11:49, Eric Dumazet wrote: >> >>> + case SO_NETNS_COOKIE: >>> + lv = sizeof(u64); >>> + if (len < lv) >>> + return -EINVAL; >> >> if (len != lv) >> return -EI

Re: [PATCH bpf-next v2 1/4] net: add SO_NETNS_COOKIE socket option

2021-02-19 Thread Lorenz Bauer
On Fri, 19 Feb 2021 at 11:49, Eric Dumazet 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 v

Re: [PATCH bpf-next v2 1/4] net: add SO_NETNS_COOKIE socket option

2021-02-19 Thread Eric Dumazet
On 2/19/21 10:51 AM, Lorenz Bauer wrote: > We need to distinguish which network namespace a socket belongs to. > BPF has the useful bpf_get_netns_cookie helper for this, but accessing > it from user space isn't possible. Add a read-only socket option that > returns the netns cookie, similar to S

[PATCH bpf-next v2 1/4] net: add SO_NETNS_COOKIE socket option

2021-02-19 Thread Lorenz Bauer
We need to distinguish which network namespace a socket belongs to. BPF has the useful bpf_get_netns_cookie helper for this, but accessing it from user space isn't possible. Add a read-only socket option that returns the netns cookie, similar to SO_COOKIE. If network namespaces are disabled, SO_NET