libbpf / bpftool

Automated upstream mirror for bpftool stand-alone build.
Other
398 stars 71 forks source link

Have bpftool return ID of created objects #121

Open qmonnet opened 1 year ago

qmonnet commented 1 year ago

When using bpftool to create new BPF objects (loaded programs, maps, etc.), it is not currently possible to retrieve a safe handle to the created objects. Users can set a given name for a program or a map, but names have no guarantee to be unique. They can pin the objects to a given path under the bpffs, and this should mostly work, unless there's some race condition with the objects being unpinned and replace.

As an alternative solution, we could have bpftool printing the IDs of the created/registered objects on successful creation (instead of printing nothing today).

This could be helpful for CI tests, for example, where we could delete objects created by bpftool (and only them) in tear-down steps.