After upgrading Ubuntu 16.04, it's no longer possible to compile eBPF. The bpf.h
file is missing key structs and the uapi
headers don't seem to be installed.
Sample code:
#include <linux/bpf.h>
int main()
{
return XDP_DROP;
}
Compiled with clang -target bpf -O2 -c xdp.c -o xdp.o
This returns the error:
udp.c:13:12: error: use of undeclared identifier 'XDP_DROP'
return XDP_DROP;
^
1 error generated.
$ cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
$ uname -r
4.4.0-148-generic
No mention of XDP
$ grep -r XDP_DROP /usr/include
$ grep -r XDP_DROP /lib/modules/
$
What's the issue?