]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricata: avoid at exit crash in nfq mode
authorEric Leblond <eric@regit.org>
Sun, 24 Jan 2021 21:40:02 +0000 (22:40 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 25 Jan 2021 10:00:48 +0000 (11:00 +0100)
When Suricata was build with ebpf support and when it was started
in NFQ mode, it was crashing at exit because it was trying to free
the device extension.

This patch fixes the issue by only trigger the eBPF related code
when Suricata is running in AFP_PACKET mode.

src/suricata.c

index 548d4c238ce50e2aac41f8823dee6c0e52ccd133..4f054aeb1dbce1a13da5e63c23a06425eb0d74a0 100644 (file)
@@ -2479,8 +2479,10 @@ int PostConfLoadedSetup(SCInstance *suri)
 
     StorageInit();
 #ifdef HAVE_PACKET_EBPF
-    EBPFRegisterExtension();
-    LiveDevRegisterExtension();
+    if (suri->run_mode == RUNMODE_AFP_DEV) {
+        EBPFRegisterExtension();
+        LiveDevRegisterExtension();
+    }
 #endif
     RegisterFlowBypassInfo();