iovisor / iovisor/bcc

Access to map content without attaching bpf code

Open
#2,223 6 comments 4 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

I'm a beginner with bpf/xdp, I'm currently playing with it and I plan to create a pretty simple UDP loadbalancer.

I play a bit with bcc and I feel it could make my life easier :).

But all the examples, I see is about 1 script which :
- loads bpf code
- does stuff in python/userspace by interacting with loaded bpf code (using map).
- detaches bpf code.

I would like to know if this is possible to use bcc to create several scripts :
- 1 script which could load the bpf code.
- 1 script which could update maps for configuration.
- 1 script which could monitor maps.
- 1 script which could detach bpf code (more optional because this could easily be done with iproute2).

[Here](https://github.com/Netronome/bpf-samples/tree/master/l4lb) is something which looks like a bit at the idea but **without bcc**...
They compile the bpf code with clang, load it with iproute2.
Then they have python scripts to [monitor](https://github.com/Netronome/bpf-samples/blob/master/l4lb/l4lb_stats.py) and [configure](https://github.com/Netronome/bpf-samples/blob/master/l4lb/l4lb_map.py). This scripts are using an home made [bpftool wrapper](https://github.com/Netronome/bpf-samples/blob/master/l4lb/bpftool_utils.py).
And finally they detach bpf code using iproute2 too.

Another question a bit out of topic ... Is this possible to use bcc to dump the bpf bytecode in a file and then load it later instead of recompiling C code each time. (maybe this does not make any sense because compilation is pretty fast ?)

Thx.

Contributor guide

No contributing guide indexed for this repository

Research direction

No BCC file or test is named. Start by reviewing the BCC map-loading APIs alongside the linked l4lb_map.py and l4lb_stats.py examples; done means establishing whether separate scripts can access maps and whether compiled bytecode can be reused.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, operating-systems, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.