]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/ebpf: fix deprecation warning
authorEric Leblond <eric@regit.org>
Thu, 11 Feb 2021 22:32:38 +0000 (23:32 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Apr 2021 13:45:14 +0000 (15:45 +0200)
The function bpf_program__title has been deprecated in favor of
bpf_program__section_name.

configure.ac
src/util-ebpf.c

index 8f298d30a9f36c04fde3ef7574da5fa9803e1c7f..30d2b4f0930077d08a7fc5434980842d6f2d5cee 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 83526de8cc0b7d90ed5786f86435547c40925e2d..c616346f2ac80c747cae1c3fba7b2cbee8f08a6f 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);