]> 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)
committerJeff Lucovsky <jeff@lucovsky.org>
Mon, 15 Feb 2021 18:25:41 +0000 (13:25 -0500)
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.

(cherry picked from commit 85327890f5bb3b9521a2dfb8268ace6645d02f72)

src/suricata.c

index 5b76b0559f1bbb8cefc61a5ec9af92c85c7c7ca5..9f4c8d4ba35196860548deadbd0cd639a720af6b 100644 (file)
@@ -2775,8 +2775,10 @@ static int PostConfLoadedSetup(SCInstance *suri)
 
     StorageInit();
 #ifdef HAVE_PACKET_EBPF
-    EBPFRegisterExtension();
-    LiveDevRegisterExtension();
+    if (suri->run_mode == RUNMODE_AFP_DEV) {
+        EBPFRegisterExtension();
+        LiveDevRegisterExtension();
+    }
 #endif
     RegisterFlowBypassInfo();
     AppLayerSetup();