-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
New Update can't make #41
Comments
Hey! What Linux distro are you using when building the program and can you give the output of the following? # Kernel version
uname -r
# Release file
cat /etc/*-release I've ran into this error before, but I don't remember what I did to fix it and I'm pretty sure it's related to LibXDP (missing a dependency). If you want something quickly, you can try checking out the commit before moving to LibXDP which is detailed here. There haven't been many changes to the XDP code itself, so you should be running the same program with the exception of using LibXDP to load the BPF/XDP program. |
root@filter:~# uname -r 5.4.0-139-generic root@filter:~# cat /etc/*-release DISTRIB_ID=Ubuntu |
I spun up a vanilla Ubuntu 20.04 VM with the same kernel version as you and ran into the same issue. I couldn't even compile sudo apt install linux-image-5.15.0-86-generic linux-headers-5.15.0-86-generic linux-tools-5.15.0-86-generic I tried installing # Clone BPFTool and its submodules.
git clone --recurse-submodules https://github.com/libbpf/bpftool.git
# Change directory to source.
cd bpftool/src
# Make and install.
make -j 2
sudo make install I also installed version 14 of # Download and use LVM 14 install script.
wget https://apt.llvm.org/llvm.sh
chmod x llvm.sh
sudo ./llvm.sh 14
# Replace older version of Clang with 14.
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang -14 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 100
# Remove old LLC link and use LLVM/LLC-14 instead.
sudo rm -f /usr/bin/llc
sudo ln -s /usr/lib/llvm-14/bin/llc /usr/bin/llc I hope this helps and I'll let you know once I reinstall the VM! |
After a full reinstall of the VM, I was able to get away with installing kernel image I didn't need to build Here are the commands I performed from the start of the vanilla VM: # Update and upgrade packages
sudo apt update
sudo apt upgrade
# Install kernel 5.15.0-86-generic and its tools for bpftool
sudo apt install -y linux-image-5.15.0-86-generic linux-headers-5.15.0-86-generic linux-tools-5.15.0-86-generic
# Reboot to load new kernel
sudo reboot
# Confirm kernel version
uname -r
# Install dependencies for XDP Firewall
sudo apt install -y libconfig-dev llvm clang libelf-dev build-essential
sudo apt install -y libpcap-dev m4 gcc-multilib
# Install Clang 12
sudo apt install -y clang-12
# Update primary clang binaries to use version 12
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang -12 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100
# Confirm Clang version
clang -v
# Replace LLVM/LLC 10 with version 14 (otherwise an error occurs when building).
# Note - I'm not sure what to use with `update-alternatives` since `llc` and `llvm` doesn't work with it. So instead, I manually remove the old symbolic link and create a new one pointed towards LLVM 12.
sudo rm -f /usr/bin/llc
sudo ln -s /usr/lib/llvm-12/bin/llc /usr/bin/llc
# Confirm LLVM/LLC version
llc --version
# Clone XDP Firewall and its sub-modules
git clone --recursive https://github.com/gamemann/XDP-Firewall.git
# Change directory
cd XDP-Firewall
# Make and install LibXDP
make libxdp
# Make XDP Firewall
make
# Install Firewall
sudo make install
# Edit /etc/xdpfw/xdpfw.conf if needed (e.g. using different interface name)
# Run Firewall
sudo xdpfw When building, I do receive a warning, but I believe it's harmless.
I hope this helps and if you have any questions or run into other issues, please let me know! |
XDP-Firewall# make && sudo make install any ideas ? |
@GermanKingYT Hey! It appears you have mismatched Clang and LLVM versions. Can you provide the output of the following commands please? llc --version
clang --version Can you also provide the Linux distro you're using and its release version/kernel? You can do that by providing the outputs of the following commands. cat /etc/*-release
uname -a I believe it'll be best if we started a separate issue related to this issue as well since it looks like the error you received is unrelated to the initial issue's error. I plan on closing this one soon. |
i use old kernel, clang 11 but clang -lconfig -lelf -lz -I modules/xdp-tools/lib/libbpf/src -I /usr/include -I /usr/local/include -o build/xdpfw modules/xdp-tools/lib/libbpf/src/staticobjs/bpf_prog_linfo.o modules/xdp-tools/lib/libbpf/src/staticobjs/bpf.o modules/xdp-tools/lib/libbpf/src/staticobjs/btf_dump.o modules/xdp-tools/lib/libbpf/src/staticobjs/btf.o modules/xdp-tools/lib/libbpf/src/staticobjs/gen_loader.o modules/xdp-tools/lib/libbpf/src/staticobjs/hashmap.o modules/xdp-tools/lib/libbpf/src/staticobjs/libbpf_errno.o modules/xdp-tools/lib/libbpf/src/staticobjs/libbpf_probes.o modules/xdp-tools/lib/libbpf/src/staticobjs/libbpf.o modules/xdp-tools/lib/libbpf/src/staticobjs/linker.o modules/xdp-tools/lib/libbpf/src/staticobjs/netlink.o modules/xdp-tools/lib/libbpf/src/staticobjs/nlattr.o modules/xdp-tools/lib/libbpf/src/staticobjs/relo_core.o modules/xdp-tools/lib/libbpf/src/staticobjs/ringbuf.o modules/xdp-tools/lib/libbpf/src/staticobjs/str_error.o modules/xdp-tools/lib/libbpf/src/staticobjs/strset.o modules/xdp-tools/lib/libbpf/src/staticobjs/usdt.o modules/xdp-tools/lib/libxdp/sharedobjs/xsk.o modules/xdp-tools/lib/libxdp/sharedobjs/libxdp.o build/config.o build/cmdline.o src/xdpfw.c how to fix? i can't change kernel but some interface issue |
@namecloudz The errors you're receiving are related to ZIP functions and references missing in the version of LibBPF you're using. The latest version of LibBPF appears to compile a new zip.c file into a shared/static object while this firewall currently uses an outdated version of LibBPF that does not. Since we still use raw LibBPF functionality in the XDP Firewall loader (which I should definitely look into eliminating when I have the time so that we only rely on There are two options that will most likely resolve this issue. The first option is downgrading the The second option is to edit the I hope this helps! Edit |
I've updated the project's I tested these changes in a dev environment and they appear to be working fine. The GitHub workflow I made also succeeded in building the project. |
thank you, and i will try test in 22.04 libbpf: elf: skipping unrecognized data section(7) .xdp_run_config |
@namecloudz You're welcome! It looks like it's working from the output you gave. Can you confirm this? If so, would it be alright to close this issue? |
What you mean is that XDP Firewall can't be built nor use the packages version of xdp-tools at run-time? |
The firewall does use For example, if we didn't need to link the LibBPF objects directly in our I hope this clarifies what I meant, but if not, feel free to open a new issue (this one was closed, so I don't think you can reply)! 😄 |
root@filter:
/XDP-Firewall# makeexp1mkdir -p build/
clang -O2 -c -o build/config.o src/config.c
clang -O2 -c -o build/cmdline.o src/cmdline.c
make -C modules/xdp-tools
make[1]: Entering directory '/root/XDP-Firewall/modules/xdp-tools'
sh configure
Found clang binary 'clang' with version 11 (from 'Ubuntu clang version 11.1.0- 20211011094159 1fdec59bffc1-1
20211011214622.5')/XDP-Firewall# make libxdpbpftool doesn't support skeleton generation
make[1]: *** [Makefile:49: config.mk] Error 1
make[1]: Leaving directory '/root/XDP-Firewall/modules/xdp-tools'
make: *** [Makefile:75: libxdp] Error 2
root@filter:
make -C modules/xdp-tools
make[1]: Entering directory '/root/XDP-Firewall/modules/xdp-tools'
sh configure
Found clang binary 'clang' with version 11 (from 'Ubuntu clang version 11.1.0- 20211011094159 1fdec59bffc1-1
exp120211011214622.5')bpftool doesn't support skeleton generation
make[1]: *** [Makefile:49: config.mk] Error 1
make[1]: Leaving directory '/root/XDP-Firewall/modules/xdp-tools'
make: *** [Makefile:75: libxdp] Error 2
root@filter:~/XDP-Firewall#
The text was updated successfully, but these errors were encountered: