Using pinned maps within a network namespace
John McDowall <[email protected]>
| Newsgroups | org.kernel.vger.xdp-newbies |
|---|---|
| Message-ID | <CAHQoOTbXqZ0_djDbMuXwSs31Mo3dRCSFShD1NvW+Dz2YmKiejw@mail.gmail.com> |
Hi everyone,
This may be a dumb question, I have set up a simple test environment
with multiple network namespaces running on a ubuntu 20.04 vagrant
box, with the latest github libbpf.
I want to use a pinned map, I can make /sys/fs/bpf shared by:
$ mount mount --make-shared /sys/fs/bpf
$ mount --bind /sys/fs/bpf /sys/fs/bpf
but when I try access the maps from a C program running in a namespace
using bpf I get
Access to /sys/fs/bpf/lwtconfig map failed obj_pin errno: No such
file or directory
The code snippet is:
mapfd = bpf_obj_pin(pin_fd,CONFIG_MAP_PATH);
if (mapfd < 0) {
jed_info(jed_logfile,"Access to %s map failed obj_pin ",
CONFIG_MAP_PATH);
pin_fd = bpf_obj_get(CONFIG_MAP_PATH);
if (pin_fd < 0){
jed_error(jed_logfile,"Access to %s map failed with
obj_get ", CONFIG_MAP_PATH);
}
}
Is this possible, and if so what am I missing?
Regards
John