Subject: Re: [PATCH iproute2 -next] tc, bpf: finalize eBPF support for cls and act front-end

From: Alexei Starovoitov <[email-masked]>
Date: Thu, 02 Apr 2015 09:14:07 -0700

On 4/2/2015 5:08 AM, Daniel Borkmann wrote:
> On 04/02/2015 01:30 PM, Hannes Frederic Sowa wrote:
>>> ... perhaps such a built-in fake device for retrieving bpf map fds
>>> might be interesting, e.g. exec 4<>/dev/bpf/<obj-file>/<map-name> if
>>> that has been given to bash?
>>>
>>> Anyway, I think to have some utility for shell scripts, as you
>>> suggest, certainly sounds interesting!
>>
>> All file descriptors will be inherited by exec as long as the O_CLOEXEC
>> flag wasn't specified on them. So you can retrieve the fds via af_unix
>> and just exec a new shell. The file descriptors will stay open and you
>> can pass the numbers of the fds via environment. This wouldn't need
>> changes to bash or kernel.
>
> Okay, I will give it a try. Thanks!

I think even if it's little awkward to do it in user space, it's better
than adding stuff to kernel. This /dev/bpf/obj-file/map-name or sysfs
might start hitting scalability issues when we try to load thousands
of bpf programs.