From: Eric Leblond Date: Thu, 11 Feb 2021 22:32:38 +0000 (+0100) Subject: util/ebpf: fix deprecation warning X-Git-Tag: suricata-6.0.6~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11159b3a2176372ae0ead53e2aef96b8fc08f3ad;p=thirdparty%2Fsuricata.git util/ebpf: fix deprecation warning The function bpf_program__title has been deprecated in favor of bpf_program__section_name. (cherry picked from commit d477d3a8789d55828861c515e609d024e95a0dc8) --- diff --git a/configure.ac b/configure.ac index 9683dab246..a672d29ad7 100644 --- a/configure.ac +++ b/configure.ac @@ -1836,6 +1836,7 @@ if test "$have_xdp" = "yes"; then AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available]) fi + AC_CHECK_FUNCS(bpf_program__section_name) fi; # Check for DAG support. diff --git a/src/util-ebpf.c b/src/util-ebpf.c index 2019911403..38fd9afc00 100644 --- a/src/util-ebpf.c +++ b/src/util-ebpf.c @@ -365,7 +365,11 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section, /* Let's check that our section is here */ bpf_object__for_each_program(bpfprog, bpfobj) { +#ifdef HAVE_BPF_PROGRAM__SECTION_NAME + const char *title = bpf_program__section_name(bpfprog); +#else const char *title = bpf_program__title(bpfprog, 0); +#endif if (!strcmp(title, section)) { if (config->flags & EBPF_SOCKET_FILTER) { bpf_program__set_socket_filter(bpfprog);