summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2015-03-16 19:37:41 +0100
committerStephen Hemminger <shemming@brocade.com>2015-03-24 15:45:23 -0700
commit11c39b5e98a163889fe5e1840e1b2a105bc33680 (patch)
treea32c779f93181a077fd74083f400b4cf6be17924 /configure
parentcbdc3ed88a955e22d3a4fe0a6ed03ac17e339042 (diff)
downloadiproute2-11c39b5e98a163889fe5e1840e1b2a105bc33680.tar.gz
tc: add eBPF support to f_bpf
This work adds the tc frontend for kernel commit e2e9b6541dd4 ("cls_bpf: add initial eBPF support for programmable classifiers"). A C-like classifier program (f.e. see e2e9b6541dd4) is being compiled via LLVM's eBPF backend into an ELF file, that is then being passed to tc. tc then loads, if any, eBPF maps and eBPF opcodes (with fixed-up eBPF map file descriptors) out of its dedicated sections, and via bpf(2) into the kernel and then the resulting fd via netlink down to cls_bpf. cls_bpf allows for annotations, currently, I've used the file name for that, so that the user can easily identify his filter when dumping configurations back. Example usage: clang -O2 -emit-llvm -c cls.c -o - | llc -march=bpf -filetype=obj -o cls.o tc filter add dev em1 parent 1: bpf run object-file cls.o classid x:y tc filter show dev em1 [...] filter parent 1: protocol all pref 49152 bpf handle 0x1 flowid x:y cls.o I placed the parser bits derived from Alexei's kernel sample, into tc_bpf.c as my next step is to also add the same support for BPF action, so we can have a fully fledged eBPF classifier and action in tc. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure26
1 files changed, 26 insertions, 0 deletions
diff --git a/configure b/configure
index 631938e9..7bec8a95 100755
--- a/configure
+++ b/configure
@@ -266,6 +266,29 @@ EOF
rm -f $TMPDIR/ipsettest.c $TMPDIR/ipsettest
}
+check_elf()
+{
+ cat >$TMPDIR/elftest.c <<EOF
+#include <libelf.h>
+#include <gelf.h>
+int main(void)
+{
+ Elf_Scn *scn;
+ GElf_Shdr shdr;
+ return elf_version(EV_CURRENT);
+}
+EOF
+
+ if $CC -I$INCLUDE -o $TMPDIR/elftest $TMPDIR/elftest.c -lelf >/dev/null 2>&1
+ then
+ echo "TC_CONFIG_ELF:=y" >>Config
+ echo "yes"
+ else
+ echo "no"
+ fi
+ rm -f $TMPDIR/elftest.c $TMPDIR/elftest
+}
+
check_selinux()
# SELinux is a compile time option in the ss utility
{
@@ -306,5 +329,8 @@ check_netnsid
echo -n "SELinux support: "
check_selinux
+echo -n "ELF support: "
+check_elf
+
echo -e "\nDocs"
check_docs