]> 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, 15 Feb 2021 10:04:32 +0000 (11:04 +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.

(cherry picked from commit 85327890f5bb3b9521a2dfb8268ace6645d02f72)

src/suricata.c

index 07b8023461ab0d596fd9c9eeee7c67dcce05e57e..15a84e2f9f25df27ae9f76d209b8f7c2e3bfb463 100644 (file)
@@ -2488,8 +2488,10 @@ int PostConfLoadedSetup(SCInstance *suri)
 
     StorageInit();
 #ifdef HAVE_PACKET_EBPF
-    EBPFRegisterExtension();
-    LiveDevRegisterExtension();
+    if (suri->run_mode == RUNMODE_AFP_DEV) {
+        EBPFRegisterExtension();
+        LiveDevRegisterExtension();
+    }
 #endif
     RegisterFlowBypassInfo();