From 7517ba9f9864c8e37884816e22e2c8cc999ad8ad Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 30 Jun 2026 14:50:15 +0200 Subject: [PATCH] detect: give clear errors for http2 w/o substate http2 states were not yet supported even if the built-in states could already work. Clearly error out on a hook w/o substate. --- src/detect-parse.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 9c513170af..6b7f61b9ea 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -1411,19 +1411,19 @@ static int SigParseProtoHookApp( SCLogError("invalid tx type specification '%s'", hook); return -1; } - if (strcmp(p, "http2") == 0) { + if (strcmp(p, "http2") == 0 || strcmp(p, "doh2") == 0) { if (strcmp(t, "stream") == 0) { sub_state = HTTP2TxTypeStream; } else if (strcmp(t, "global") == 0) { sub_state = HTTP2TxTypeGlobal; } else { - SCLogError("unknown http/2 tx type specification '%s': valid values are 'stream' " + SCLogError("unknown %s tx type specification '%s': valid values are 'stream' " "and 'global'", - hook); + p, hook); return -1; } } else { - SCLogError("sub states currently only supported for http2"); + SCLogError("sub states currently only supported for http2 and doh2"); return -1; } /* FW hook LTE mode */ @@ -1466,6 +1466,12 @@ static int SigParseProtoHookApp( } snprintf(generic_hook_name, sizeof(generic_hook_name), "%s:%s:%s:generic", p, t, h); } else { + if (AppLayerParserSupportsSubStates(s->alproto)) { + SCLogError( + "protocol %s requires a substate specification: %s::%s", p, p, hook); + return -1; + } + /* FW hook LTE mode */ if (*h == '<') { h++;