man bpf
states that
Some complete working code can be found in the samples/bpf directory in the kernel source tree.
However I can't find any samples at that location:
$ uname -r
5.1.11-200.fc29.x86_64
$ ls /usr/src/kernels/5.1.11-200.fc29.x86_64/samples/bpf
Makefile
sudo make
appears to error due to another cause, however it looks like the Makefile
there expects the existence of samples in samples/bpf
(BPF_SAMPLES_PATH
):
$ cd /usr/src/kernels/5.1.11-200.fc29.x86_64/
$ sudo make headers_install
$ sudo make samples/bpf/
HOSTCC scripts/selinux/genheaders/genheaders
scripts/selinux/genheaders/genheaders.c:18:10: fatal error: classmap.h: No such file or directory
#include "classmap.h"
^~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.host:92: scripts/selinux/genheaders/genheaders] Error 1
make[2]: *** [scripts/Makefile.build:486: scripts/selinux/genheaders] Error 2
make[1]: *** [scripts/Makefile.build:486: scripts/selinux] Error 2
make: *** [Makefile:1069: scripts] Error 2
Also, the remote linux kernel repo includes a README with examples.
Are there BPF samples in the Fedora linux kernel directory? If so, where are they located?