aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@kernel.org>2022-02-06 17:32:43 -0700
committerDavid Ahern <dsahern@kernel.org>2022-03-07 08:52:08 -0700
commit873bb9751f84252542040ad68632651144fbf1d3 (patch)
tree42037cd989e3822871d0402344bc2233a5dcbfcb
parent5e17b715295f76709f4088ae5374ae1cadcc2029 (diff)
downloadiproute2-873bb9751f84252542040ad68632651144fbf1d3.tar.gz
bpf_glue: Remove use of bpf_load_program from libbpf
bpf_load_program is deprecated starting in v0.7. The preferred bpf_prog_load requires bpf_prog_load_opts from v0.6. This creates an ugly scenario for iproute2 to work across libbpf versions from v0.1 and up. Since bpf_program_load is only used to load the builtin vrf program, just remove the libbpf call and use the legacy code. Signed-off-by: David Ahern <dsahern@kernel.org>
-rw-r--r--lib/bpf_glue.c12
-rw-r--r--lib/bpf_legacy.c7
2 files changed, 7 insertions, 12 deletions
diff --git a/lib/bpf_glue.c b/lib/bpf_glue.c
index 70d001840..cc3015487 100644
--- a/lib/bpf_glue.c
+++ b/lib/bpf_glue.c
@@ -11,18 +11,6 @@
#include <bpf/bpf.h>
#endif
-int bpf_program_load(enum bpf_prog_type type, const struct bpf_insn *insns,
- size_t size_insns, const char *license, char *log,
- size_t size_log)
-{
-#ifdef HAVE_LIBBPF
- return bpf_load_program(type, insns, size_insns / sizeof(struct bpf_insn),
- license, 0, log, size_log);
-#else
- return bpf_prog_load_dev(type, insns, size_insns, license, 0, log, size_log);
-#endif
-}
-
int bpf_program_attach(int prog_fd, int target_fd, enum bpf_attach_type type)
{
#ifdef HAVE_LIBBPF
diff --git a/lib/bpf_legacy.c b/lib/bpf_legacy.c
index 6e3891c9f..3779ae90c 100644
--- a/lib/bpf_legacy.c
+++ b/lib/bpf_legacy.c
@@ -1126,6 +1126,13 @@ int bpf_prog_load_dev(enum bpf_prog_type type, const struct bpf_insn *insns,
return bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
}
+int bpf_program_load(enum bpf_prog_type type, const struct bpf_insn *insns,
+ size_t size_insns, const char *license, char *log,
+ size_t size_log)
+{
+ return bpf_prog_load_dev(type, insns, size_insns, license, 0, log, size_log);
+}
+
#ifdef HAVE_ELF
struct bpf_elf_prog {
enum bpf_prog_type type;