]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dns: wrap with HAVE_LUA
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 9 Dec 2021 09:24:50 +0000 (10:24 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 18 Jan 2022 11:21:55 +0000 (12:21 +0100)
This is just code style, to minimize the compiled code.

src/Makefile.am
src/detect-dns-query.c
src/detect-engine-dns.c [deleted file]
src/detect-engine-dns.h [deleted file]
src/detect-engine-mpm.c

index 618821c5de53203e3874c671b57cc8b53ad4c3bc..76fd7a2dbfc3db44d7223fe69de02b13b1abf0ce 100755 (executable)
@@ -135,7 +135,6 @@ noinst_HEADERS = \
        detect-engine-build.h \
        detect-engine-content-inspection.h \
        detect-engine-dcepayload.h \
-       detect-engine-dns.h \
        detect-engine-enip.h \
        detect-engine-event.h \
        detect-engine-file.h \
@@ -723,7 +722,6 @@ libsuricata_c_a_SOURCES = \
        detect-engine.c \
        detect-engine-content-inspection.c \
        detect-engine-dcepayload.c \
-       detect-engine-dns.c \
        detect-engine-enip.c \
        detect-engine-event.c \
        detect-engine-file.c \
index c256f2a30eea4dbde7e26c60777d9520b1aa82fd..60ff3b584357ba9c7bee42859d107e3f04ba6aa1 100644 (file)
@@ -56,7 +56,6 @@
 #include "app-layer.h"
 #include "app-layer-parser.h"
 #include "detect-dns-query.h"
-#include "detect-engine-dns.h"
 
 #include "util-unittest-helper.h"
 #include "rust.h"
@@ -199,6 +198,23 @@ static int PrefilterMpmDnsQueryRegister(DetectEngineCtx *de_ctx,
             pectx, PrefilterMpmDnsQueryFree, mpm_reg->pname);
 }
 
+#ifdef HAVE_LUA
+static int DetectEngineInspectDnsRequest(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
+        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
+        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
+{
+    return DetectEngineInspectGenericList(
+            de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
+}
+
+static int DetectEngineInspectDnsResponse(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
+        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
+        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
+{
+    return DetectEngineInspectGenericList(
+            de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
+}
+#endif
 
 /**
  * \brief Registration function for keyword: dns_query
@@ -229,6 +245,7 @@ void DetectDnsQueryRegister (void)
 
     g_dns_query_buffer_id = DetectBufferTypeGetByName("dns_query");
 
+#ifdef HAVE_LUA
     /* register these generic engines from here for now */
     DetectAppLayerInspectEngineRegister2(
             "dns_request", ALPROTO_DNS, SIG_FLAG_TOSERVER, 1, DetectEngineInspectDnsRequest, NULL);
@@ -239,6 +256,7 @@ void DetectDnsQueryRegister (void)
             "dns requests");
     DetectBufferTypeSetDescriptionByName("dns_response",
             "dns responses");
+#endif
 }
 
 
diff --git a/src/detect-engine-dns.c b/src/detect-engine-dns.c
deleted file mode 100644 (file)
index c3d6873..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 2013-2016 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/** \file
- *
- *  \author Victor Julien <victor@inliniac.net>
- *
- *  Based on detect-engine-uri.c
- */
-
-#include "suricata-common.h"
-#include "suricata.h"
-#include "decode.h"
-
-#include "detect.h"
-#include "detect-engine.h"
-#include "detect-parse.h"
-#include "detect-engine-state.h"
-#include "detect-engine-content-inspection.h"
-#include "detect-engine-prefilter.h"
-
-#include "flow-util.h"
-#include "util-debug.h"
-#include "util-print.h"
-#include "flow.h"
-
-#include "app-layer.h"
-#include "app-layer-parser.h"
-#include "app-layer-protos.h"
-#include "detect-engine-dns.h"
-
-#include "util-unittest.h"
-#include "util-unittest-helper.h"
-#include "util-validate.h"
-
-int DetectEngineInspectDnsRequest(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
-        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
-{
-    return DetectEngineInspectGenericList(
-            de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
-}
-
-int DetectEngineInspectDnsResponse(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
-        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
-{
-    return DetectEngineInspectGenericList(
-            de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
-}
diff --git a/src/detect-engine-dns.h b/src/detect-engine-dns.h
deleted file mode 100644 (file)
index ca886e3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2013 Open Information Security Foundation
- *
- * You can copy, redistribute or modify this Program under the terms of
- * the GNU General Public License version 2 as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-/** \file
- *
- *  \author Victor Julien <victor@inliniac.net>
- */
-
-#ifndef __DETECT_ENGINE_DNS_H__
-#define __DETECT_ENGINE_DNS_H__
-
-int DetectEngineInspectDnsRequest(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
-        uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
-int DetectEngineInspectDnsResponse(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
-        uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
-
-#endif /* __DETECT_ENGINE_DNS_H__ */
index c55c13f2f7fd3be86ab3e01c164a7a13e0d16843..5b11b88f64f9e6eb975b2ef6e720d4678d852290 100644 (file)
@@ -53,7 +53,6 @@
 #include "detect-content.h"
 
 #include "detect-engine-payload.h"
-#include "detect-engine-dns.h"
 
 #include "stream.h"