]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: xdp pinned maps need to be read
authorEric Leblond <eric@regit.org>
Tue, 11 Jun 2019 22:43:47 +0000 (00:43 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2019 05:07:02 +0000 (07:07 +0200)
src/runmode-af-packet.c

index 13625295d341d366d8b55e15cb403418b243c197..480c833f3b53483531b0ded9fc20aec8fa35c12f 100644 (file)
@@ -473,6 +473,19 @@ static void *ParseAFPConfig(const char *iface)
             SCLogConfig("Using bypass kernel functionality for AF_PACKET (iface %s)",
                     aconf->iface);
             aconf->flags |= AFP_XDPBYPASS;
+            /* if maps are pinned we need to read them at start */
+            if (aconf->ebpf_t_config.flags & EBPF_PINNED_MAPS) {
+                RunModeEnablesBypassManager();
+                struct ebpf_timeout_config *ebt = SCCalloc(1, sizeof(struct ebpf_timeout_config));
+                if (ebt == NULL) {
+                    SCLogError(SC_ERR_MEM_ALLOC, "Flow bypass alloc error");
+                } else {
+                    memcpy(ebt, &(aconf->ebpf_t_config), sizeof(struct ebpf_timeout_config));
+                    BypassedFlowManagerRegisterCheckFunc(NULL,
+                            EBPFCheckBypassedFlowCreate,
+                            (void *)ebt);
+                }
+            }
             BypassedFlowManagerRegisterUpdateFunc(EBPFUpdateFlow, NULL);
         }
 #else