]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-engine: check for tx detect flag support
authorJason Ish <jason.ish@oisf.net>
Mon, 25 Nov 2019 22:57:06 +0000 (16:57 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 27 Nov 2019 19:05:17 +0000 (13:05 -0600)
When registing a detection engine, check that the app-layer
protocol supports tx detect flags. Exit with a fatal
error if it does not as this is a code implementation
error that should be resolved during development.

src/detect-engine.c

index fac0a8a7a600801f94709efa92ade42c11e1987b..f1fca6235c6b8b9f401848a4e4d4ed3c4012d52e 100644 (file)
@@ -171,6 +171,13 @@ void DetectAppLayerInspectEngineRegister(const char *name,
         AppProto alproto, uint32_t dir,
         int progress, InspectEngineFuncPtr Callback)
 {
+    if (AppLayerParserIsTxAware(alproto)) {
+        if (!AppLayerParserSupportsTxDetectFlags(alproto)) {
+            FatalError(SC_ERR_INITIALIZATION,
+                "Inspect engine registered for app-layer protocol without "
+                "TX detect flag support: %s", AppProtoToString(alproto));
+        }
+    }
     DetectBufferTypeRegister(name);
     const int sm_list = DetectBufferTypeGetByName(name);
     if (sm_list == -1) {