]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: logs an error if a protocol is disabled
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 9 Dec 2021 14:40:09 +0000 (15:40 +0100)
committerVictor Julien <vjulien@oisf.net>
Fri, 28 Jan 2022 17:53:08 +0000 (18:53 +0100)
So that the user knows that the rule cannot match

src/detect-parse.c

index e3cb589729b26ba0a18ae35b0bda801b4a31489c..e52a20aae121335c9679560c2b284c46177f1f0c 100644 (file)
@@ -1507,6 +1507,11 @@ int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
         }
     }
 
+    if (AppLayerProtoDetectGetProtoName(alproto) == NULL) {
+        SCLogError(SC_ERR_INVALID_ARGUMENT, "disabled alproto %s, rule can never match",
+                AppProtoToString(alproto));
+        return -1;
+    }
     s->alproto = alproto;
     s->flags |= SIG_FLAG_APPLAYER;
     return 0;