gamemann / XDP-Firewall

A firewall that utilizes the Linux kernel's XDP hook. The XDP hook allows for very fast network processing on Linux systems. This is great for dropping malicious traffic from a (D)DoS attack. IPv6 is supported with this firewall! I hope this helps network engineers/programmers interested in utilizing XDP!
https://deaconn.net/
MIT License
558 stars 92 forks source link

An error #6

Closed OpenSource03 closed 3 years ago

OpenSource03 commented 3 years ago

Hello there!

Trying to execute make command, I'm getting the following error:

root@ubuntu-s-1vcpu-1gb-amd-lon1-01:~/XDP-Firewall# make
mkdir -p build/
clang -O2 -c -o build/config.o src/config.c
clang -O2 -c -o build/cmdline.o src/cmdline.c
make -C libbpf/src
make[1]: Entering directory '/root/XDP-Firewall/libbpf/src'
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -c libbpf.c -o staticobjs/libbpf.o
In file included from libbpf.c:47:
../include/tools/libc_compat.h:11:21: error: static declaration of 'reallocarray' follows non-static declaration
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
                    ^
/usr/include/stdlib.h:559:14: note: previous declaration is here
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
             ^
1 error generated.
make[1]: *** [Makefile:102: staticobjs/libbpf.o] Error 1
make[1]: Leaving directory '/root/XDP-Firewall/libbpf/src'
make: *** [Makefile:43: libbpf] Error 2

I installed all the required dependencies:

root@ubuntu-s-1vcpu-1gb-amd-lon1-01:~/XDP-Firewall# apt install libconfig-dev llvm clang libelf-dev make
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libelf-dev is already the newest version (0.176-1.1build1).
make is already the newest version (4.2.1-1.2).
clang is already the newest version (1:10.0-50~exp1).
libconfig-dev is already the newest version (1.5-0.4build1).
llvm is already the newest version (1:10.0-50~exp1).
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.

OS: Ubuntu 20.04

gamemann commented 3 years ago

Hey! I've seen this error before and it was due to a missing dependency that I remember installing with apt. However, I don't remember the exact package name.

Can you try ensuring the build-essential package is installed via apt install build-essential (using sudo or as root)? Can you also ensure you have the kernel headers installed which can be installed via the apt install linux-headers-$(uname -r) command?

OpenSource03 commented 3 years ago

Thanks! I've created for you a merge request at https://github.com/gamemann/XDP-Firewall/pulls

You can merge it in order to let people better know how to install the application. It's basically just a README.md update.