From: Jason Ish Date: Fri, 17 Jan 2025 20:46:07 +0000 (-0600) Subject: detect: split new keyword id from registration X-Git-Tag: suricata-8.0.0-beta1~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3835bbb11ca70a3482a510cdd92f4f5757a55fd;p=thirdparty%2Fsuricata.git detect: split new keyword id from registration Split DetectHelperKeywordRegister into 2 functions, one for acquiring a new keyword ID, and another to perform the registration. This makes it easier to do the traditional C keyword initialization with a dynamic ID. --- diff --git a/plugins/ndpi/ndpi.c b/plugins/ndpi/ndpi.c index c1879c212f..ec0342c78a 100644 --- a/plugins/ndpi/ndpi.c +++ b/plugins/ndpi/ndpi.c @@ -466,8 +466,7 @@ static void NdpInitRiskKeyword(void) * support all the fields required to register the nDPI keywords, * so we'll just register with an empty keyword specifier to get * the ID, then fill in the ID. */ - SCSigTableElmt keyword = {}; - ndpi_protocol_keyword_id = DetectHelperKeywordRegister(&keyword); + ndpi_protocol_keyword_id = SCDetectHelperNewKeywordId(); SCLogDebug("Registered new ndpi-protocol keyword with ID %" PRIu32, ndpi_protocol_keyword_id); sigmatch_table[ndpi_protocol_keyword_id].name = "ndpi-protocol"; @@ -479,7 +478,7 @@ static void NdpInitRiskKeyword(void) sigmatch_table[ndpi_protocol_keyword_id].flags = (SIGMATCH_QUOTES_OPTIONAL | SIGMATCH_HANDLE_NEGATION); - ndpi_risk_keyword_id = DetectHelperKeywordRegister(&keyword); + ndpi_risk_keyword_id = SCDetectHelperNewKeywordId(); SCLogDebug("Registered new ndpi-risk keyword with ID %" PRIu32, ndpi_risk_keyword_id); sigmatch_table[ndpi_risk_keyword_id].name = "ndpi-risk";