]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/ebpf: fix deprecation warning 7401/head
authorEric Leblond <eric@regit.org>
Thu, 11 Feb 2021 22:32:38 +0000 (23:32 +0100)
committerEric Leblond <el@stamus-networks.com>
Wed, 11 May 2022 07:14:46 +0000 (09:14 +0200)
The function bpf_program__title has been deprecated in favor of
bpf_program__section_name.

(cherry picked from commit d477d3a8789d55828861c515e609d024e95a0dc8)

configure.ac
src/util-ebpf.c

index 9683dab246b7183f744b70bae64c7b7d16e4691a..a672d29ad7b77b183acf0817f3e7d7ea1f588f0c 100644 (file)
         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.
index 2019911403321bc1b1da8ec7c2f2f01c30f1211c..38fd9afc003b50b3ffffd32465a05d2ffb095f6f 100644 (file)
@@ -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);