detect/prefilter: add de_ctx to registration

pull/3246/head
Victor Julien 9 years ago
parent efbd901385
commit 91296d1eec

@ -48,7 +48,7 @@ static int DetectAckMatch(ThreadVars *, DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static void DetectAckRegisterTests(void);
static void DetectAckFree(void *);
static int PrefilterSetupTcpAck(SigGroupHead *sgh);
static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTcpAckIsPrefilterable(const Signature *s);
void DetectAckRegister(void)
@ -183,9 +183,9 @@ PrefilterPacketAckCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupTcpAck(SigGroupHead *sgh)
static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_ACK,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ACK,
PrefilterPacketAckSet,
PrefilterPacketAckCompare,
PrefilterPacketAckMatch);

@ -238,9 +238,9 @@ PrefilterPacketAppProtoCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupAppProto(SigGroupHead *sgh)
static int PrefilterSetupAppProto(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_AL_APP_LAYER_PROTOCOL,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_AL_APP_LAYER_PROTOCOL,
PrefilterPacketAppProtoSet,
PrefilterPacketAppProtoCompare,
PrefilterPacketAppProtoMatch);

@ -90,15 +90,16 @@ static void PrefilterTxDceStubDataRequest(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxDceStubDataRequestRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxDceStubDataRequestRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
ALPROTO_DCERPC, 0,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
if (r == 0) {
r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
ALPROTO_SMB, 0,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
}
@ -135,15 +136,16 @@ static void PrefilterTxDceStubDataResponse(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxDceStubDataResponseRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxDceStubDataResponseRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
ALPROTO_DCERPC, 0,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
if (r == 0) {
r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
ALPROTO_SMB, 0,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
}

@ -56,7 +56,7 @@ static int DetectDsizeSetup (DetectEngineCtx *, Signature *s, const char *str);
static void DsizeRegisterTests(void);
static void DetectDsizeFree(void *);
static int PrefilterSetupDsize(SigGroupHead *sgh);
static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterDsizeIsPrefilterable(const Signature *s);
/**
@ -354,9 +354,9 @@ PrefilterPacketDsizeCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupDsize(SigGroupHead *sgh)
static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_DSIZE,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_DSIZE,
PrefilterPacketDsizeSet,
PrefilterPacketDsizeCompare,
PrefilterPacketDsizeMatch);

@ -169,11 +169,12 @@ static void PrefilterTxDnsQuery(DetectEngineThreadCtx *det_ctx,
#endif
}
int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxDnsQuery,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDnsQuery,
ALPROTO_DNS, 1,
mpm_ctx, NULL, "dns_query");
}

@ -23,7 +23,8 @@
#ifndef __DETECT_ENGINE_DNS_H__
#define __DETECT_ENGINE_DNS_H__
int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectDnsQueryName(ThreadVars *,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,

@ -23,6 +23,9 @@
#ifndef __DETECT_ENGINE_FILEDATA_H__
#define __DETECT_ENGINE_FILEDATA_H__
int PrefilterMpmFiledataRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx,
const void *pectx,
Packet *p, Flow *f, void *txv,

@ -251,11 +251,12 @@ static void PrefilterTxHttpRequestBody(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestBody,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestBody,
ALPROTO_HTTP, HTP_REQUEST_BODY,
mpm_ctx, NULL, "http_client_body");
}

@ -27,7 +27,8 @@
#include "app-layer-htp.h"
int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpClientBody(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -97,11 +97,12 @@ static void PrefilterTxRequestCookie(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxRequestCookie,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestCookie,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_cookie (request)");
}
@ -143,11 +144,12 @@ static void PrefilterTxResponseCookie(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxResponseCookie,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseCookie,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, "http_cookie (response)");
}

@ -25,8 +25,10 @@
#include "app-layer-htp.h"
int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpCookie(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -92,11 +92,12 @@ static void PrefilterTxHostname(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHostname,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostname,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_host");
}

@ -25,7 +25,8 @@
#include "app-layer-htp.h"
int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpHH(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -91,9 +91,10 @@ static void PrefilterTxMethod(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
return PrefilterAppendTxEngine(sgh, PrefilterTxMethod,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxMethod,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_method");
}

@ -30,7 +30,8 @@ int DetectEngineInspectHttpMethod(ThreadVars *tv,
const Signature *s, const SigMatchData *smd,
Flow *f, uint8_t flags, void *alstate, void *tx, uint64_t tx_id);
int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
void DetectEngineHttpMethodRegisterTests(void);

@ -91,16 +91,17 @@ static void PrefilterTxRequestHeadersRaw(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
ALPROTO_HTTP, HTP_REQUEST_HEADERS+1, /* inspect when headers complete */
mpm_ctx, NULL, "http_raw_header (request)");
if (r != 0)
return r;
return PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
ALPROTO_HTTP, HTP_REQUEST_TRAILER+1, /* inspect when trailer complete */
mpm_ctx, NULL, "http_raw_header (request)");
}
@ -135,16 +136,17 @@ static void PrefilterTxResponseHeadersRaw(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS+1, /* inspect when headers complete */
mpm_ctx, NULL, "http_raw_header (response)");
if (r != 0)
return r;
return PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
ALPROTO_HTTP, HTP_RESPONSE_TRAILER+1, /* inspect when trailer complete */
mpm_ctx, NULL, "http_raw_header (response)");
}

@ -25,8 +25,10 @@
#include "app-layer-htp.h"
int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpRawHeader(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -104,11 +104,12 @@ static void PrefilterTxHostnameRaw(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHostnameRaw,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostnameRaw,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_raw_host");
}

@ -25,7 +25,8 @@
#include "app-layer-htp.h"
int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpHRH(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -89,11 +89,12 @@ static void PrefilterTxRawUri(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxRawUri,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRawUri,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_raw_uri");
}

@ -26,7 +26,8 @@
#include "app-layer-htp.h"
int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpRawUri(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -284,11 +284,12 @@ static void PrefilterTxHttpResponseBody(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseBody,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseBody,
ALPROTO_HTTP, HTP_RESPONSE_BODY,
mpm_ctx, NULL, "file_data (http response)");
}

@ -27,7 +27,8 @@
#include "app-layer-htp.h"
int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpServerBody(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -87,11 +87,12 @@ static void PrefilterTxHttpStatCode(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatCode,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatCode,
ALPROTO_HTTP,
HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
mpm_ctx, NULL, "http_stat_code");

@ -25,7 +25,8 @@
#include "app-layer-htp.h"
int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpStatCode(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -87,11 +87,12 @@ static void PrefilterTxHttpStatMsg(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatMsg,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatMsg,
ALPROTO_HTTP,
HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
mpm_ctx, NULL, "http_stat_msg");

@ -25,7 +25,8 @@
#include "app-layer-htp.h"
int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpStatMsg(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -97,11 +97,12 @@ static void PrefilterTxUA(DetectEngineThreadCtx *det_ctx, const void *pectx,
}
}
int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxUA,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUA,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_user_agent");
}

@ -25,7 +25,8 @@
#include "app-layer-htp.h"
int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpUA(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -97,7 +97,8 @@ static int g_app_mpms_list_cnt = 0;
*/
void DetectAppLayerMpmRegister2(const char *name,
int direction, int priority,
int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
InspectionBufferGetDataPtr GetData,
AppProto alproto, int tx_min_progress)
@ -149,7 +150,8 @@ void DetectAppLayerMpmRegister2(const char *name,
void DetectAppLayerMpmRegister(const char *name,
int direction, int priority,
int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx))
int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx))
{
SCLogDebug("registering %s/%d/%d/%p",
name, direction, priority, PrefilterRegister);
@ -1357,12 +1359,12 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
if (SGH_DIRECTION_TS(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TS);
if (mpm_store != NULL) {
PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TS);
if (mpm_store != NULL) {
PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
SetRawReassemblyFlag(de_ctx, sh);
@ -1370,12 +1372,12 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
if (SGH_DIRECTION_TC(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TC);
if (mpm_store != NULL) {
PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TC);
if (mpm_store != NULL) {
PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
SetRawReassemblyFlag(de_ctx, sh);
@ -1384,19 +1386,19 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
if (SGH_DIRECTION_TS(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TS);
if (mpm_store != NULL) {
PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
if (SGH_DIRECTION_TC(sh)) {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TC);
if (mpm_store != NULL) {
PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
} else {
mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_OTHERIP);
if (mpm_store != NULL) {
PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
}
}
@ -1430,12 +1432,13 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
/* if we have just certain types of negated patterns,
* mpm_ctx can be NULL */
if (a->reg->v2.PrefilterRegisterWithListId && mpm_store->mpm_ctx) {
BUG_ON(a->reg->v2.PrefilterRegisterWithListId(sh, mpm_store->mpm_ctx,
BUG_ON(a->reg->v2.PrefilterRegisterWithListId(de_ctx,
sh, mpm_store->mpm_ctx,
a->reg, a->reg->sm_list) != 0);
SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
}
else if (a->reg->PrefilterRegister && mpm_store->mpm_ctx) {
BUG_ON(a->reg->PrefilterRegister(sh, mpm_store->mpm_ctx) != 0);
BUG_ON(a->reg->PrefilterRegister(de_ctx, sh, mpm_store->mpm_ctx) != 0);
SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
}
}

@ -89,10 +89,12 @@ int DetectSetFastPatternAndItsId(DetectEngineCtx *de_ctx);
*/
void DetectAppLayerMpmRegister(const char *name,
int direction, int priority,
int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx));
int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx));
void DetectAppLayerMpmRegister2(const char *name,
int direction, int priority,
int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
InspectionBufferGetDataPtr GetData,
AppProto alproto, int tx_min_progress);

@ -103,9 +103,11 @@ static void PrefilterPktStream(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
return PrefilterAppendPayloadEngine(sgh, PrefilterPktStream, mpm_ctx, NULL, "stream");
return PrefilterAppendPayloadEngine(de_ctx, sgh,
PrefilterPktStream, mpm_ctx, NULL, "stream");
}
static void PrefilterPktPayload(DetectEngineThreadCtx *det_ctx,
@ -122,9 +124,11 @@ static void PrefilterPktPayload(DetectEngineThreadCtx *det_ctx,
p->payload, p->payload_len);
}
int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
return PrefilterAppendPayloadEngine(sgh, PrefilterPktPayload, mpm_ctx, NULL, "payload");
return PrefilterAppendPayloadEngine(de_ctx, sgh,
PrefilterPktPayload, mpm_ctx, NULL, "payload");
}

@ -24,8 +24,10 @@
#ifndef __DETECT_ENGINE_PAYLOAD_H__
#define __DETECT_ENGINE_PAYLOAD_H__
int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectPacketPayload(DetectEngineCtx *,
DetectEngineThreadCtx *, const Signature *, Flow *, Packet *);

@ -93,8 +93,8 @@ static void GetExtraMatch(const Signature *s, uint16_t *type, uint16_t *value)
/** \internal
*/
static int
SetupEngineForPacketHeader(SigGroupHead *sgh, int sm_type,
PrefilterPacketHeaderHashCtx *hctx,
SetupEngineForPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
int sm_type, PrefilterPacketHeaderHashCtx *hctx,
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
{
@ -142,8 +142,8 @@ SetupEngineForPacketHeader(SigGroupHead *sgh, int sm_type,
SCLogDebug("%s: ctx %p extra type %u extra value %u, sig cnt %u",
sigmatch_table[sm_type].name, ctx, ctx->type, ctx->value,
ctx->sigs_cnt);
PrefilterAppendEngine(sgh, Match, ctx, PrefilterPacketHeaderFree,
sigmatch_table[sm_type].name);
PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
PrefilterPacketHeaderFree, sigmatch_table[sm_type].name);
return 0;
}
@ -197,8 +197,8 @@ static void ApplyToU8Hash(PrefilterPacketU8HashCtx *ctx, PrefilterPacketHeaderVa
* \todo deduplicate sigs arrays
*/
static int
SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_type,
uint32_t *counts,
SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type, uint32_t *counts,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
@ -240,7 +240,7 @@ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_typ
}
if (cnt) {
PrefilterAppendEngine(sgh, Match, ctx,
PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
PrefilterPacketU8HashCtxFree,
sigmatch_table[sm_type].name);
} else {
@ -252,7 +252,7 @@ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_typ
/** \internal
* \brief setup a engine for each unique value
*/
static void SetupSingle(HashListTable *hash_table,
static void SetupSingle(DetectEngineCtx *de_ctx, HashListTable *hash_table,
SigGroupHead *sgh, int sm_type,
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
@ -262,7 +262,7 @@ static void SetupSingle(HashListTable *hash_table,
for ( ; hb != NULL; hb = HashListTableGetListNext(hb)) {
PrefilterPacketHeaderHashCtx *ctx = HashListTableGetListData(hb);
SetupEngineForPacketHeader(sgh, sm_type,
SetupEngineForPacketHeader(de_ctx, sgh, sm_type,
ctx, Compare, Match);
}
}
@ -270,7 +270,7 @@ static void SetupSingle(HashListTable *hash_table,
/** \internal
* \brief setup a single engine with a hash map for u8 values
*/
static void SetupU8Hash(HashListTable *hash_table,
static void SetupU8Hash(DetectEngineCtx *de_ctx, HashListTable *hash_table,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
@ -318,11 +318,12 @@ static void SetupU8Hash(HashListTable *hash_table,
}
}
SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(sgh, sm_type,
SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(de_ctx, sgh, sm_type,
counts, Set, Compare, Match);
}
static int PrefilterSetupPacketHeaderCommon(SigGroupHead *sgh, int sm_type,
static int PrefilterSetupPacketHeaderCommon(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
@ -379,9 +380,9 @@ static int PrefilterSetupPacketHeaderCommon(SigGroupHead *sgh, int sm_type,
}
if (u8hash == FALSE) {
SetupSingle(hash_table, sgh, sm_type, Compare, Match);
SetupSingle(de_ctx, hash_table, sgh, sm_type, Compare, Match);
} else {
SetupU8Hash(hash_table, sgh, sm_type, Set, Compare, Match);
SetupU8Hash(de_ctx, hash_table, sgh, sm_type, Set, Compare, Match);
}
HashListTableFree(hash_table);
@ -391,22 +392,24 @@ error:
return -1;
}
int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx))
{
return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
Set, Compare, Match, TRUE);
}
int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx))
{
return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
Set, Compare, Match, FALSE);
}

@ -56,13 +56,15 @@ typedef struct PrefilterPacketU8HashCtx_ {
#define PREFILTER_U8HASH_MODE_GT 2
#define PREFILTER_U8HASH_MODE_RA 3
int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,
Packet *p, const void *pectx));
int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, int sm_type,
void (*Set)(PrefilterPacketHeaderValue *v, void *),
_Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
void (*Match)(DetectEngineThreadCtx *det_ctx,

@ -55,7 +55,8 @@
#include "util-profiling.h"
static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *));
static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
const char *name, void (*FreeFunc)(void *));
static const PrefilterStore *PrefilterStoreGetStore(const uint32_t id);
static inline void QuickSortSigIntId(SigIntId *sids, uint32_t n)
@ -183,7 +184,7 @@ void Prefilter(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh,
}
}
int PrefilterAppendEngine(SigGroupHead *sgh,
int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name)
@ -213,11 +214,11 @@ int PrefilterAppendEngine(SigGroupHead *sgh,
}
e->name = name;
e->gid = PrefilterStoreGetId(e->name, e->Free);
e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name)
@ -247,11 +248,11 @@ int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
}
e->name = name;
e->gid = PrefilterStoreGetId(e->name, e->Free);
e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
int PrefilterAppendTxEngine(SigGroupHead *sgh,
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterTxFunc)(DetectEngineThreadCtx *det_ctx, const void *pectx,
Packet *p, Flow *f, void *tx,
const uint64_t idx, const uint8_t flags),
@ -286,7 +287,7 @@ int PrefilterAppendTxEngine(SigGroupHead *sgh,
}
e->name = name;
e->gid = PrefilterStoreGetId(e->name, e->Free);
e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
return 0;
}
@ -351,7 +352,7 @@ void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
for (i = 0; i < DETECT_TBLSIZE; i++)
{
if (sigmatch_table[i].SetupPrefilter != NULL) {
sigmatch_table[i].SetupPrefilter(sgh);
sigmatch_table[i].SetupPrefilter(de_ctx, sgh);
}
}
}
@ -496,7 +497,8 @@ static void PrefilterInit(void)
SCMutexUnlock(&g_prefilter_mutex);
}
static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *))
static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
const char *name, void (*FreeFunc)(void *))
{
PrefilterStore ctx = { name, FreeFunc, 0 };
@ -626,7 +628,8 @@ static void PrefilterGenericMpmFree(void *ptr)
SCFree(ptr);
}
int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id)
{
SCEnter();
@ -638,7 +641,7 @@ int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
pectx->mpm_ctx = mpm_ctx;
pectx->transforms = &mpm_reg->v2.transforms;
int r = PrefilterAppendTxEngine(sgh, PrefilterMpm,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterMpm,
mpm_reg->v2.alproto, mpm_reg->v2.tx_min_progress,
pectx, PrefilterGenericMpmFree, mpm_reg->pname);
if (r != 0) {

@ -35,15 +35,15 @@ typedef struct PrefilterStore_ {
void Prefilter(DetectEngineThreadCtx *, const SigGroupHead *, Packet *p,
const uint8_t flags);
int PrefilterAppendEngine(SigGroupHead *sgh,
int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name);
int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
void *pectx, void (*FreeFunc)(void *pectx),
const char *name);
int PrefilterAppendTxEngine(SigGroupHead *sgh,
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx,
Packet *p, Flow *f, void *tx,
const uint64_t idx, const uint8_t flags),
@ -69,7 +69,8 @@ void PrefilterCleanupRuleGroup(SigGroupHead *sgh);
const char *PrefilterStoreGetName(const uint32_t id);
#endif
int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx,
const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
#endif

@ -76,11 +76,12 @@ static void PrefilterTxTlsSni(DetectEngineThreadCtx *det_ctx, const void *pectx,
}
}
int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSni,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSni,
ALPROTO_TLS, 0, // TODO a special 'cert ready' state might be good to add
mpm_ctx, NULL, "tls_sni");
}
@ -151,11 +152,12 @@ static void PrefilterTxTlsIssuer(DetectEngineThreadCtx *det_ctx, const void *pec
}
}
int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxTlsIssuer,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsIssuer,
ALPROTO_TLS, TLS_STATE_CERT_READY,
mpm_ctx, NULL, "tls_cert_issuer");
}
@ -226,11 +228,12 @@ static void PrefilterTxTlsSubject(DetectEngineThreadCtx *det_ctx, const void *pe
}
}
int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSubject,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSubject,
ALPROTO_TLS, TLS_STATE_CERT_READY,
mpm_ctx, NULL, "tls_cert_subject");
}
@ -301,11 +304,12 @@ static void PrefilterTxTlsSerial(DetectEngineThreadCtx *det_ctx, const void *pec
}
}
int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
TLS_STATE_CERT_READY, mpm_ctx, NULL,
"tls_cert_serial");
}
@ -378,11 +382,12 @@ static void PrefilterTxTlsFingerprint(DetectEngineThreadCtx *det_ctx,
}
}
int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
TLS_STATE_CERT_READY, mpm_ctx, NULL,
"tls_cert_fingerprint");
}

@ -23,11 +23,16 @@
#ifndef __DETECT_ENGINE_TLS_H__
#define __DETECT_ENGINE_TLS_H__
int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectTlsSni(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -81,11 +81,12 @@ static void PrefilterTxUri(DetectEngineThreadCtx *det_ctx, const void *pectx,
}
}
int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxUri,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUri,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_uri");
}

@ -24,7 +24,8 @@
#ifndef __DETECT_ENGINE_URICONTENT_H__
#define __DETECT_ENGINE_URICONTENT_H__
int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
int DetectEngineInspectHttpUri(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,

@ -54,7 +54,8 @@ static void DetectFiledataRegisterTests(void);
static void DetectFiledataSetupCallback(Signature *s);
static int g_file_data_buffer_id = 0;
static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
/**
* \brief Registration function for keyword: file_data
@ -91,11 +92,12 @@ void DetectFiledataRegister(void)
g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
}
static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxFiledata,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxFiledata,
ALPROTO_SMTP, 0,
mpm_ctx, NULL, "file_data (smtp)");
}

@ -64,7 +64,7 @@ static int DetectFlagsSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectFlagsFree(void *);
static _Bool PrefilterTcpFlagsIsPrefilterable(const Signature *s);
static int PrefilterSetupTcpFlags(SigGroupHead *sgh);
static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
/**
* \brief Registration function for flags: keyword
@ -594,9 +594,9 @@ PrefilterPacketFlagsCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupTcpFlags(SigGroupHead *sgh)
static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_FLAGS,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLAGS,
PrefilterPacketFlagsSet,
PrefilterPacketFlagsCompare,
PrefilterPacketFlagsMatch);

@ -55,7 +55,7 @@ static int DetectFlowSetup (DetectEngineCtx *, Signature *, const char *);
void DetectFlowRegisterTests(void);
void DetectFlowFree(void *);
static int PrefilterSetupFlow(SigGroupHead *sgh);
static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFlowIsPrefilterable(const Signature *s);
/**
@ -426,9 +426,9 @@ PrefilterPacketFlowCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupFlow(SigGroupHead *sgh)
static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_FLOW,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLOW,
PrefilterPacketFlowSet,
PrefilterPacketFlowCompare,
PrefilterPacketFlowMatch);

@ -73,7 +73,7 @@ static int DetectFragBitsMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *,
static int DetectFragBitsSetup (DetectEngineCtx *, Signature *, const char *);
static void DetectFragBitsFree(void *);
static int PrefilterSetupFragBits(SigGroupHead *sgh);
static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFragBitsIsPrefilterable(const Signature *s);
/**
@ -358,9 +358,9 @@ PrefilterPacketFragBitsCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupFragBits(SigGroupHead *sgh)
static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_FRAGBITS,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGBITS,
PrefilterPacketFragBitsSet,
PrefilterPacketFragBitsCompare,
PrefilterPacketFragBitsMatch);

@ -50,7 +50,7 @@ static int DetectFragOffsetSetup(DetectEngineCtx *, Signature *, const char *);
void DetectFragOffsetRegisterTests(void);
void DetectFragOffsetFree(void *);
static int PrefilterSetupFragOffset(SigGroupHead *sgh);
static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterFragOffsetIsPrefilterable(const Signature *s);
/**
@ -302,9 +302,9 @@ PrefilterPacketFragOffsetCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupFragOffset(SigGroupHead *sgh)
static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_FRAGOFFSET,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGOFFSET,
PrefilterPacketFragOffsetSet,
PrefilterPacketFragOffsetCompare,
PrefilterPacketFragOffsetMatch);

@ -214,11 +214,12 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
}
}
#endif
static int PrefilterTxHttpRequestHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestHeaderNamesRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaderNames,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaderNames,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -294,11 +295,12 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
}
}
#endif
static int PrefilterTxHttpResponseHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseHeaderNamesRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaderNames,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaderNames,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -215,16 +215,17 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpRequestHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestHeadersRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaders,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaders,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, "http_header (request)");
if (r != 0)
return r;
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestTrailers,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestTrailers,
ALPROTO_HTTP, HTP_REQUEST_TRAILER,
mpm_ctx, NULL, "http_header (request trailer)");
}
@ -295,16 +296,17 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpResponseHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseHeadersRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaders,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaders,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, "http_header (response)");
if (r != 0)
return r;
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseTrailers,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseTrailers,
ALPROTO_HTTP, HTP_RESPONSE_TRAILER,
mpm_ctx, NULL, "http_header (response trailer)");
}

@ -116,11 +116,12 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
}
}
#endif
static int PrefilterTxHttpRequestHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestHeaderRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeader,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeader,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -202,11 +203,12 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
}
}
#endif
static int PrefilterTxHttpResponseHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseHeaderRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeader,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeader,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -101,11 +101,12 @@ static void PrefilterTxHttpRequestProtocol(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestProtocolRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestProtocol,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestProtocol,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -141,11 +142,12 @@ static void PrefilterTxHttpResponseProtocol(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseProtocolRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseProtocol,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseProtocol,
ALPROTO_HTTP, HTP_RESPONSE_LINE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -62,7 +62,8 @@
static int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectHttpRequestLineRegisterTests(void);
static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int DetectEngineInspectHttpRequestLine(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
const Signature *s, const SigMatchData *smd,
@ -146,11 +147,12 @@ static void PrefilterTxHttpRequestLine(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestLine,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestLine,
ALPROTO_HTTP, HTP_REQUEST_LINE,
mpm_ctx, NULL, "http_request_line");
}

@ -62,7 +62,8 @@
static int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectHttpResponseLineRegisterTests(void);
static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx);
static int DetectEngineInspectHttpResponseLine(ThreadVars *tv,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
const Signature *s, const SigMatchData *smd,
@ -146,11 +147,12 @@ static void PrefilterTxHttpResponseLine(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseLine,
return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseLine,
ALPROTO_HTTP, HTP_RESPONSE_LINE,
mpm_ctx, NULL, "http_response_line");
}

@ -199,11 +199,12 @@ static void PrefilterTxHttpRequestStart(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpRequestStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpRequestStartRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestStart,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestStart,
ALPROTO_HTTP, HTP_REQUEST_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -238,11 +239,12 @@ static void PrefilterTxHttpResponseStart(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxHttpResponseStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxHttpResponseStartRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseStart,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseStart,
ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -48,7 +48,7 @@ static int DetectIcmpIdMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *,
static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpIdRegisterTests(void);
void DetectIcmpIdFree(void *);
static int PrefilterSetupIcmpId(SigGroupHead *sgh);
static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
/**
@ -299,9 +299,9 @@ PrefilterPacketIcmpIdCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupIcmpId(SigGroupHead *sgh)
static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_ID,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_ID,
PrefilterPacketIcmpIdSet,
PrefilterPacketIcmpIdCompare,
PrefilterPacketIcmpIdMatch);

@ -48,7 +48,7 @@ static int DetectIcmpSeqMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *,
static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
void DetectIcmpSeqRegisterTests(void);
void DetectIcmpSeqFree(void *);
static int PrefilterSetupIcmpSeq(SigGroupHead *sgh);
static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
/**
@ -302,9 +302,9 @@ PrefilterPacketIcmpSeqCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupIcmpSeq(SigGroupHead *sgh)
static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_SEQ,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_SEQ,
PrefilterPacketIcmpSeqSet,
PrefilterPacketIcmpSeqCompare,
PrefilterPacketIcmpSeqMatch);

@ -52,7 +52,7 @@ static int DetectICodeSetup(DetectEngineCtx *, Signature *, const char *);
void DetectICodeRegisterTests(void);
void DetectICodeFree(void *);
static int PrefilterSetupICode(SigGroupHead *sgh);
static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterICodeIsPrefilterable(const Signature *s);
/**
@ -331,9 +331,9 @@ PrefilterPacketICodeCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupICode(SigGroupHead *sgh)
static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ICODE,
return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ICODE,
PrefilterPacketICodeSet,
PrefilterPacketICodeCompare,
PrefilterPacketICodeMatch);

@ -55,7 +55,7 @@ static int DetectIdSetup (DetectEngineCtx *, Signature *, const char *);
void DetectIdRegisterTests(void);
void DetectIdFree(void *);
static int PrefilterSetupId(SigGroupHead *sgh);
static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterIdIsPrefilterable(const Signature *s);
/**
@ -257,9 +257,9 @@ PrefilterPacketIdCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupId(SigGroupHead *sgh)
static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_ID,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ID,
PrefilterPacketIdSet,
PrefilterPacketIdCompare,
PrefilterPacketIdMatch);

@ -52,7 +52,7 @@ static int DetectITypeSetup(DetectEngineCtx *, Signature *, const char *);
void DetectITypeRegisterTests(void);
void DetectITypeFree(void *);
static int PrefilterSetupIType(SigGroupHead *sgh);
static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterITypeIsPrefilterable(const Signature *s);
/**
@ -335,9 +335,9 @@ PrefilterPacketITypeCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupIType(SigGroupHead *sgh)
static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ITYPE,
return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ITYPE,
PrefilterPacketITypeSet,
PrefilterPacketITypeCompare,
PrefilterPacketITypeMatch);

@ -45,7 +45,7 @@ static int DetectSeqMatch(ThreadVars *, DetectEngineThreadCtx *,
Packet *, const Signature *, const SigMatchCtx *);
static void DetectSeqRegisterTests(void);
static void DetectSeqFree(void *);
static int PrefilterSetupTcpSeq(SigGroupHead *sgh);
static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTcpSeqIsPrefilterable(const Signature *s);
void DetectSeqRegister(void)
@ -178,9 +178,9 @@ PrefilterPacketSeqCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupTcpSeq(SigGroupHead *sgh)
static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_SEQ,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_SEQ,
PrefilterPacketSeqSet,
PrefilterPacketSeqCompare,
PrefilterPacketSeqMatch);

@ -83,11 +83,12 @@ static void PrefilterTxSshRequestProtocol(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxSshRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxSshRequestProtocolRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestProtocol,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestProtocol,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -123,11 +124,12 @@ static void PrefilterTxSshResponseProtocol(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxSshResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxSshResponseProtocolRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseProtocol,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseProtocol,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -83,11 +83,12 @@ static void PrefilterTxSshRequestSoftware(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxSshRequestSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxSshRequestSoftwareRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestSoftware,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestSoftware,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (request)");
return r;
@ -123,11 +124,12 @@ static void PrefilterTxSshResponseSoftware(DetectEngineThreadCtx *det_ctx,
}
}
static int PrefilterTxSshResponseSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
static int PrefilterTxSshResponseSoftwareRegister(DetectEngineCtx *de_ctx,
SigGroupHead *sgh, MpmCtx *mpm_ctx)
{
SCEnter();
int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseSoftware,
int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseSoftware,
ALPROTO_SSH, SSH_STATE_BANNER_DONE,
mpm_ctx, NULL, KEYWORD_NAME " (response)");
return r;

@ -49,7 +49,7 @@ static int DetectTtlSetup (DetectEngineCtx *, Signature *, const char *);
void DetectTtlFree (void *);
void DetectTtlRegisterTests (void);
static int PrefilterSetupTtl(SigGroupHead *sgh);
static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
static _Bool PrefilterTtlIsPrefilterable(const Signature *s);
/**
@ -360,9 +360,9 @@ PrefilterPacketTtlCompare(PrefilterPacketHeaderValue v, void *smctx)
return FALSE;
}
static int PrefilterSetupTtl(SigGroupHead *sgh)
static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
{
return PrefilterSetupPacketHeader(sgh, DETECT_TTL,
return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_TTL,
PrefilterPacketTtlSet,
PrefilterPacketTtlCompare,
PrefilterPacketTtlMatch);

@ -557,12 +557,14 @@ typedef struct DetectMpmAppLayerRegistery_ {
int direction; /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
int sm_list;
int (*PrefilterRegister)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
int (*PrefilterRegister)(struct DetectEngineCtx_ *de_ctx,
struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
int priority;
struct {
int (*PrefilterRegisterWithListId)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
int (*PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx,
struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
const struct DetectMpmAppLayerRegistery_ *mpm_reg, int list_id);
InspectionBufferGetDataPtr GetData;
AppProto alproto;
@ -1130,7 +1132,7 @@ typedef struct SigTableElmt_ {
int (*Setup)(DetectEngineCtx *, Signature *, const char *);
_Bool (*SupportsPrefilter)(const Signature *s);
int (*SetupPrefilter)(struct SigGroupHead_ *sgh);
int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh);
void (*Free)(void *);
void (*RegisterTests)(void);

Loading…
Cancel
Save