From: Eric Leblond Date: Sun, 24 Jan 2021 21:40:02 +0000 (+0100) Subject: suricata: avoid at exit crash in nfq mode X-Git-Tag: suricata-5.0.6~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e573433ed7e41e2f82b55eeacb8f29d5428fb212;p=thirdparty%2Fsuricata.git suricata: avoid at exit crash in nfq mode 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) --- diff --git a/src/suricata.c b/src/suricata.c index 5b76b0559f..9f4c8d4ba3 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -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();