pyang
pyang

Reputation: 147

Sharing a map between two BPF programs

I know this question is asked before, but I failed to find any post that has an example on how to do it. Specifically, one BPF program defines a map, and the other BPF program accesses that map. Note that it is Not one BPF program defines a map, and another userspace program accesses it. BOTH BPF program run in the kernel space.

Upvotes: 2

Views: 878

Answers (1)

Junyeong Jeong
Junyeong Jeong

Reputation: 51

pyang.

If you don't mind using RedBPF, a rust library for eBPF, you can do what you want.

Here are the exact examples you mentioned. https://github.com/foniod/redbpf/blob/main/examples/example-userspace/examples/sharemap1.rs

and

https://github.com/foniod/redbpf/blob/main/examples/example-userspace/examples/sharemap2.rs

Upvotes: 0

Related Questions