Re: Sharing eBPF map between two eBPF kernel programs

Kanthi P <Pavuluri.kanthi@...>

Thanks for that!

I think those work because bcc has given utilities to do that.

I am using C and we use libbpf to load programs and to do map operations. 

Do you know if we can achieve it in this way too?


On Tue, Mar 5, 2019 at 2:21 AM Y Song <ys114321@...> wrote:
On Mon, Mar 4, 2019 at 9:52 AM Kanthi P <Pavuluri.kanthi@...> wrote:
> Hi,
> I have two eBPF programs, each with its own user and kernel programs.
> One of the programs defines an eBPF map.
> How do I access this map from another eBPF kernel program?

In examples/cpp, we have, which gives an example of
how to share maps between two processes with C++ interface.
Basically, if you know the ID of the map in another application (you
can see id use bpftool), you can get a fd for that map by ID with API
`bpf_map_get_fd_by_id()`, and example shows how to inject the new `fd`
to bcc compilation system.

We do not have a python way to share map yet bwtween two different processes.

Please take a look. If you feel the interface needs to improve to
support your use case, we can do that.

> PS:
> I can pin the map and that helps me access this map from other program's user space.
> But looking for a direct way in which I can access this map from other programs's kernel space.
> Thanks!

Join to automatically receive all group messages.