]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http2: allow http1 keywords for http2 traffic
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 12 Jan 2021 15:42:48 +0000 (16:42 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 14 Jun 2021 19:05:19 +0000 (21:05 +0200)
Adding a special case in DetectSignatureSetAppProto

src/detect-parse.c

index 59517b55918d949a85335331ffd70063893523b9..5464835a7dc3bdc7ef4c231e18bd3d9b880cea87 100644 (file)
@@ -1491,14 +1491,18 @@ int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
         return -1;
     }
 
-    if (s->alproto != ALPROTO_UNKNOWN && s->alproto != alproto) {
+    if (s->alproto != ALPROTO_UNKNOWN && s->alproto != alproto &&
+            // allow to keep HTTP2 with HTTP1 keywords
+            !(s->alproto == ALPROTO_HTTP2 && alproto == ALPROTO_HTTP)) {
         SCLogError(SC_ERR_CONFLICTING_RULE_KEYWORDS,
             "can't set rule app proto to %s: already set to %s",
             AppProtoToString(alproto), AppProtoToString(s->alproto));
         return -1;
     }
 
-    s->alproto = alproto;
+    if (!(s->alproto == ALPROTO_HTTP2 && alproto == ALPROTO_HTTP)) {
+        s->alproto = alproto;
+    }
     s->flags |= SIG_FLAG_APPLAYER;
     return 0;
 }