]> git.proxmox.com Git - mirror_iproute2.git/commit
iproute2: add check_libbpf() and get_libbpf_version()
authorHangbin Liu <haliu@redhat.com>
Mon, 23 Nov 2020 13:11:57 +0000 (21:11 +0800)
committerDavid Ahern <dsahern@gmail.com>
Wed, 25 Nov 2020 05:14:02 +0000 (22:14 -0700)
commit503e9229b054b948cfb1b1b77bee97c1f74e491c
tree930e97399d992dc3268b637a9574278be75b3e25
parentee5d4b24e309aece108e86f9fb7ad3b0ca96d567
iproute2: add check_libbpf() and get_libbpf_version()

This patch aim to add basic checking functions for later iproute2
libbpf support.

First we add check_libbpf() in configure to see if we have bpf library
support. By default the system libbpf will be used, but static linking
against a custom libbpf version can be achieved by passing libbpf DESTDIR
to variable LIBBPF_DIR for configure.

Another variable LIBBPF_FORCE is used to control whether to build iproute2
with libbpf. If set to on, then force to build with libbpf and exit if
not available. If set to off, then force to not build with libbpf.

When dynamically linking against libbpf, we can't be sure that the
version we discovered at compile time is actually the one we are
using at runtime. This can lead to hard-to-debug errors. So we add
a new file lib/bpf_glue.c and a helper function get_libbpf_version()
to get correct libbpf version at runtime.

Signed-off-by: Hangbin Liu <haliu@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
configure
include/bpf_util.h
ip/ip.c
lib/Makefile
lib/bpf_glue.c [new file with mode: 0644]
tc/tc.c