for ( ; smsg != NULL; smsg = smsg->next) {
r = mpm_table[det_ctx->sgh->mpm_stream_ctx_ts->mpm_type].
Search(det_ctx->sgh->mpm_stream_ctx_ts, &det_ctx->mtcs,
- &det_ctx->smsg_pmq[cnt], smsg->data, smsg->data_len);
+ &det_ctx->pmq, smsg->data, smsg->data_len);
if (r > 0) {
ret += r;
-
- SCLogDebug("smsg match stored in det_ctx->smsg_pmq[%u]", cnt);
-
- /* merge results with overall pmq */
- PmqMerge(&det_ctx->smsg_pmq[cnt], &det_ctx->pmq);
}
cnt++;
for ( ; smsg != NULL; smsg = smsg->next) {
r = mpm_table[det_ctx->sgh->mpm_stream_ctx_tc->mpm_type].
Search(det_ctx->sgh->mpm_stream_ctx_tc, &det_ctx->mtcs,
- &det_ctx->smsg_pmq[cnt], smsg->data, smsg->data_len);
+ &det_ctx->pmq, smsg->data, smsg->data_len);
if (r > 0) {
ret += r;
-
- SCLogDebug("smsg match stored in det_ctx->smsg_pmq[%u]", cnt);
-
- /* merge results with overall pmq */
- PmqMerge(&det_ctx->smsg_pmq[cnt], &det_ctx->pmq);
}
cnt++;
return;
}
-void StreamPatternCleanup(ThreadVars *t, DetectEngineThreadCtx *det_ctx, StreamMsg *smsg)
-{
- uint8_t cnt = 0;
-
- while (smsg != NULL) {
- PmqReset(&det_ctx->smsg_pmq[cnt]);
-
- smsg = smsg->next;
- cnt++;
- }
-}
-
void PatternMatchDestroy(MpmCtx *mpm_ctx, uint16_t mpm_matcher)
{
SCLogDebug("mpm_ctx %p, mpm_matcher %"PRIu16"", mpm_ctx, mpm_matcher);
uint32_t SMTPFiledataPatternSearch(DetectEngineThreadCtx *det_ctx, uint8_t *buffer, uint32_t buffer_len, uint8_t flags);
void PacketPatternCleanup(ThreadVars *, DetectEngineThreadCtx *);
-void StreamPatternCleanup(ThreadVars *t, DetectEngineThreadCtx *det_ctx, StreamMsg *smsg);
void PatternMatchPrepare(MpmCtx *, uint16_t);
void PatternMatchThreadPrepare(MpmThreadCtx *, uint16_t type);
*/
static TmEcode ThreadCtxDoInit (DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx)
{
- int i;
-
PatternMatchThreadPrepare(&det_ctx->mtc, de_ctx->mpm_matcher);
PatternMatchThreadPrepare(&det_ctx->mtcs, de_ctx->mpm_matcher);
PatternMatchThreadPrepare(&det_ctx->mtcu, de_ctx->mpm_matcher);
PmqSetup(&det_ctx->pmq);
- for (i = 0; i < DETECT_SMSG_PMQ_NUM; i++) {
- PmqSetup(&det_ctx->smsg_pmq[i]);
- }
/* sized to the max of our sgh settings. A max setting of 0 implies that all
* sgh's have: sgh->non_mpm_store_cnt == 0 */
void DetectEngineThreadCtxFree(DetectEngineThreadCtx *det_ctx)
{
+ int i;
+
if (det_ctx->tenant_array != NULL) {
SCFree(det_ctx->tenant_array);
det_ctx->tenant_array = NULL;
}
PmqFree(&det_ctx->pmq);
- int i;
- for (i = 0; i < DETECT_SMSG_PMQ_NUM; i++) {
- PmqFree(&det_ctx->smsg_pmq[i]);
- }
if (det_ctx->non_mpm_id_array != NULL)
SCFree(det_ctx->non_mpm_id_array);
#define SMS_USE_FLOW_SGH 0x01
#define SMS_USED_PM 0x02
-#define SMS_USED_STREAM_PM 0x04
/**
* \internal
PACKET_PROFILING_DETECT_START(p, PROF_DETECT_MPM_STREAM);
StreamPatternSearch(det_ctx, p, smsg, flags);
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_MPM_STREAM);
-
- *sms_runflags |= SMS_USED_STREAM_PM;
} else {
SCLogDebug("smsg NULL or no stream mpm for this sgh");
}
* up again for the next packet. Also return any stream chunk we processed
* to the pool. */
if (p->flags & PKT_HAS_FLOW) {
- if (sms_runflags & SMS_USED_STREAM_PM) {
- StreamPatternCleanup(th_v, det_ctx, smsg);
- }
-
FLOWLOCK_WRLOCK(pflow);
if (debuglog_enabled) {
if (p->alerts.cnt > 0) {
} FiledataReassembledBody;
#define DETECT_FILESTORE_MAX 15
-/** \todo review how many we actually need here */
-#define DETECT_SMSG_PMQ_NUM 256
typedef struct SignatureNonMpmStore_ {
SigIntId id;
MpmThreadCtx mtcu; /**< thread ctx for uricontent mpm */
MpmThreadCtx mtcs; /**< thread ctx for stream mpm */
PatternMatcherQueue pmq;
- PatternMatcherQueue smsg_pmq[DETECT_SMSG_PMQ_NUM];
/** ip only rules ctx */
DetectEngineIPOnlyThreadCtx io_ctx;