]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-ebpf: change return of pinned maps loading
authorEric Leblond <eric@regit.org>
Sun, 10 Feb 2019 22:30:00 +0000 (23:30 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2019 05:07:02 +0000 (07:07 +0200)
The calling function needs to be able to see when this is a success
and XDP do not need to be reloaded.

src/util-ebpf.c

index f10435f7b28106eb91bc713b7c58381d37504dff..28e9da158dedbaa8aa0b723fc1a5915d1e1fcd6a 100644 (file)
@@ -259,7 +259,7 @@ static int EBPFLoadPinnedMaps(LiveDevice *livedev, struct ebpf_timeout_config *c
  * \param path the path of the eBPF file to load
  * \param section the section in the eBPF file to load
  * \param val a pointer to an integer that will be the file desc
- * \return -1 in case of error and 0 in case of success
+ * \return -1 in case of error, 0 in case of success, 1 if pinned maps is loaded
  */
 int EBPFLoadFile(const char *iface, const char *path, const char * section,
                  int *val, struct ebpf_timeout_config *config)
@@ -276,10 +276,10 @@ int EBPFLoadFile(const char *iface, const char *path, const char * section,
     if (livedev == NULL)
         return -1;
 
-    if (config->flags & EBPF_XDP_CODE) {
+    if (config->flags & EBPF_XDP_CODE && config->flags & EBPF_PINNED_MAPS) {
         /* We try to get our flow table maps and if we have them we can simply return */
         if (EBPFLoadPinnedMaps(livedev, config) == 0) {
-            return 0;
+            return 1;
         }
     }