Re: Using pinned maps within a network namespace

Y Song <[email protected]>
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <CAH3MdRUUEHMeTjpNy=a0Q0CnJeXioFzCuoBVpdnu3gKhm5D0pA@mail.gmail.com>
On Tue, Sep 15, 2020 at 11:46 AM John McDowall
<[email protected]> wrote:
>
> 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

Similar commands `mount --bind /sys/fs/bpf /sys/fs/bpf1` in the same namespace
works fine.

Maybe there are restrictions related to namespace? Maybe it becomes readonly?
Could you print out the error code below?

>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.