32 Commits

Author SHA1 Message Date
3d6baf8905 fix: erroneous bitmask operation
In kernel selftest/bpf xdp synproxy has:
[0] b6a3451e084 (selftests/bpf: Fix erroneous bitmask operation)
sync the fix here.

It addresses an issue when xdp synproxy need to handle SYNACK
from backend server, see [1].

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b6a3451e0847
[1]: https://lore.kernel.org/xdp-newbies/CAK3+h2z1r69Z5g+qTwCaJzgnD5sv93x67TLJ3gVQ70_nFE0AqQ@mail.gmail.com/T/#t

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2023-12-11 23:44:46 +00:00
fed8da5072 Add xdp-synproxy to bpf-examples
this code is from kernel bpf selftests xdp synproxy, removed the
tc part for simplicity, shows an exmaple of using libxdp
to attach xdp synproxy program on network interface.

if port is not in allowed ports, the packet will be dropped
by xdp synproxy by default, this would break tcp connections
to ports that user does not want to do synproxy, change the
default to allow connection pass through.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2023-10-26 19:01:49 +00:00
f63c7633cc headers/linux: update if_xdp.h from kernel v6.5.0+
Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com>
2023-09-21 08:32:53 +02:00
5d111a29ee Update kernel-mirrored UAPI header file btf.h
The distro kernel UAPI headers evolve too slow.
Thus, maintain a mirror in headers/linux/ in this proj.

Libbpf been overly-eager to get features into their releases
and depend on kernel commit 6089fb325cf7 ("bpf: Add btf enum64 support"),
which have not been released in an official kernel release yet.

Thus, this headers/linux/btf.h update comes from bpf-next git.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2022-09-02 14:34:11 +02:00
c04f6934cf Update headers/linux/btf.h
Newer libbpf uses constants from the newer kernel header file, so
compilation breaks unless we have the newest version of the kernel header.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-01-17 13:12:53 +01:00
c690c0d7d0 headers: Update linux/btf.h to contain BTF_KIND_FLOAT
This was added in kernel commit:
 8fd886911a6a ("bpf: Add BTF_KIND_FLOAT to uapi") (Author: Ilya Leoshkevich)

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-09-10 17:06:58 +02:00
7a845a0901 ktrace-CO-RE: Fix compile failure due to missing vmlinux_arch.h
Fixes pull request #24

I had forgot to git add headers/vmlinux/vmlinux_arch.h in PR#24
which caused compile failures for ktrace-CO-RE.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-08-25 08:48:51 +02:00
54c0d52dd8 ktrace-CO-RE: README explain CPU architecture challenges
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-06-02 10:39:12 +02:00
ff5fef3dc9 headers/vmlinux: Add more archs powerpc and arm64
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-06-01 17:05:28 +02:00
064bc31354 headers/vmlinux: Add arch specific vmlinux.h defines
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-06-01 16:23:33 +02:00
f34f8d5787 headers/vmlinux: Add header files to shadow vmlinux.h
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-06-01 16:23:08 +02:00
a25992973d Adjustments to README based on Toke's review
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-15 17:18:38 +01:00
b5fd346589 Move jhash out of headers/linux into include/
It is a bit strange we have this header file in this repo, but
it likely be very useful later.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 18:06:51 +01:00
d5031bfc92 headers/linux: add netlink.h from kernel source v5.11-rc7
This is included by linux/if_link.h.  Thus, we need it here if the
distro doesn't provide this include file.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 18:03:48 +01:00
10abd546ca headers/linux: update if_link.h and if_xdp.h from kernel v5.11-rc7
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 18:01:02 +01:00
27765e8449 headers/linux: update bpf.h from kernel source v5.11-rc7
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 17:55:17 +01:00
3a92b67a53 headers/linux: Add missing bpf_common.h
The include file linux/bpf_common.h was missing.  This is used/included
via linux/bpf.h.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 17:40:09 +01:00
7aee417036 Add README for headers/linux/ directory
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-12 17:22:12 +01:00
0264295d67 Add toplevel README describing project
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 19:32:41 +01:00
23ae3dcf45 Remove bpf_helper_defs.h as this comes via libbpf
The bpf_helper_defs.h is used by (ibbpf provided) bpf/bpf_helpers.h.
Thus, it doesn't belong under headers/ directory.

Remove file: headers/bpf/bpf_helper_defs.h

Fixes: f0fce8f62b ("Update kernel headers and libbpf version")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 18:13:57 +01:00
9bf3ee7010 Add headers/README explaining use of directory
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 17:43:21 +01:00
5cf96508df Move parsing_helpers.h into new include directory
Adjust makefile construct to use the new include direcory.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 17:03:55 +01:00
d59095d39f Remove libxdp header files not used by any bpf-examples
When some bpf example use libxdp then these can be re-added, along
with description of why projects needs to include these files.

Files removed:
 headers/xdp/libxdp.h
 headers/xdp/prog_dispatcher.h
 headers/xdp/xdp_helpers.h

Fixes: 4513664ca3 ("Initial import with encap-forward example")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 16:58:19 +01:00
bb48f0e8aa Remove header files not used by any bpf-examples
Files removed:
 headers/xdp/xdp_stats_kern.h
 headers/xdp/xdp_stats_kern_user.h

Fixes: 4513664ca3 ("Initial import with encap-forward example")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-02-09 16:49:13 +01:00
a47528b709 Merge branch 'master' of https://github.com/netoptimizer/bpf-examples into netoptimizer-master
Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
2021-01-08 14:54:40 +01:00
89aeeafa0e Update UAPI header file bpf.h
I need the struct bpf_cpumap_val definition for the next example.

Signed-off-by: Jesper D. Brouer <netoptimizer@brouer.com>
2020-12-15 16:34:26 +01:00
f0fce8f62b Update kernel headers and libbpf version
This makes the encap-forward example compile and fixes #3.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2020-11-25 11:19:24 +01:00
9ea235637e Add compiler.h to define some common compiler directives
This is taken from the Cilium project:
 https://github.com/cilium/cilium/blob/master/bpf/include/bpf/compiler.h

The use-case was adding READ_ONCE and WRITE_ONCE, but via re-using
the Cilium version we get a lot more useful compiler annotations.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-11-15 15:38:15 +01:00
c0cd6aedba parsing_helpers.h re-add IPv6 skip of extension headers
This code comes from xdp-tools repo.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-11-15 15:26:12 +01:00
097079cde1 Fix includes in parsing_helpers.h
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-11-15 15:17:00 +01:00
6ee640393b Update parsing_helpers.h from xdp-tutorial
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2020-11-15 15:12:20 +01:00
4513664ca3 Initial import with encap-forward example
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2020-10-06 15:53:55 +02:00