Jesper Dangaard Brouer d84ced9730 AF_XDP-interaction: Fix to work on newer kernels supporting bpf_link
Program fails on newer kernels, with error message:

 libbpf: Netlink-based XDP prog detected, please unload it in order to launch AF_XDP prog
 ERROR: Can't setup AF_XDP socket "Invalid argument"

Since kernel v5.13 libbpf version, when bpf_link support is
detected then libbpf/xsk require XDP/BPF programs use this feature.
See kernel commit 10397994d30f ("libbpf: xsk: Use bpf_link").

To continue using our netlink-based XDP attach approach,
instruct libbpf/xsk to not be in change of loading the
BPF-prog.  As our XDP-prog is special it also makes
to control this ourselves.

This is achived with the flag XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD

 xsk_cfg.libbpf_flags = XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD

Remember to update the xskmap manually.

Fixes: 10397994d30f ("libbpf: xsk: Use bpf_link")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-11-05 14:54:50 +01:00
2021-06-21 22:51:57 +02:00
2021-10-05 00:44:43 +02:00

Practical BPF examples

This git repository contains a diverse set of practical BPF examples that solve (or demonstrate) a specific use-case using BPF.

It is meant to ease doing rapid prototyping and development, writing C-code BPF programs using libbpf. The goal is to make is easier for developers to get started coding.

Many developers struggle to get a working BPF build environment. The repo enviroment makes it easy to build/compile BPF programs by doing the necessary libbpf setup transparently and detect missing compile dependencies (via the (configure)[configure] script). It is a declared goal to make BPF programming more consumable by detecting and reporting issues (when possible).

Description
No description provided
Readme 25 MiB
Languages
C 93.6%
Shell 4.7%
Makefile 1.6%