Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ebpf: Update eBPF map to BTF defined map #9969

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,6 @@ jobs:
zlib1g \
zlib1g-dev \
clang \
libbpf-dev \
libelf-dev
- name: Install Rust
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_VERSION_KNOWN -y
Expand All @@ -2448,7 +2447,7 @@ jobs:
cp prep/cbindgen $HOME/.cargo/bin
chmod 755 $HOME/.cargo/bin/cbindgen
- run: ./autogen.sh
- run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --enable-fuzztargets --enable-ebpf --enable-ebpf-build
- run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --enable-fuzztargets
- run: make -j2
- run: make check
- run: tar xf prep/suricata-verify.tar.gz
Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,23 @@
AC_SUBST(LLC)
],
[AC_MSG_ERROR([clang needed to build ebpf files])])
AC_MSG_CHECKING([libbpf has bpf/bpf_helpers.h])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[
#include <stddef.h>
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
],
[
])],
[HAVE_BPF="yes"],
[HAVE_BPF="no"])
if test "$HAVE_BPF" = "no"; then
AC_MSG_ERROR([libbpf include bpf/bpf_helpers.h not found])
else
AC_MSG_RESULT([ok])
fi
])

# enable debug output
Expand Down
4 changes: 2 additions & 2 deletions ebpf/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTRA_DIST= include bypass_filter.c filter.c lb.c vlan_filter.c xdp_filter.c \
xdp_lb.c bpf_helpers.h hash_func01.h
xdp_lb.c hash_func01.h

if BUILD_EBPF

Expand All @@ -18,7 +18,7 @@ all: $(BPF_TARGETS)

$(BPF_TARGETS): %.bpf: %.c
# From C-code to LLVM-IR format suffix .ll (clang -S -emit-llvm)
${CLANG} -Wall $(BPF_CFLAGS) -O2 \
${CLANG} -Wall $(BPF_CFLAGS) -O2 -g \
-I/usr/include/$(build_cpu)-$(build_os)/ \
-D__KERNEL__ -D__ASM_SYSREG_H \
-target bpf -S -emit-llvm $< -o ${@:.bpf=.ll}
Expand Down
Loading
Loading