From b86fc135519c63ede554b5c83be61a95aee52c5f Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Fri, 20 Apr 2012 10:57:11 +0530 Subject: [PATCH 2/2] code cleanup - indentation fix --- src/detect.c | 51 ++++++++++++++++++++++----------------------------- 1 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/detect.c b/src/detect.c index f1467b3..8f8d879 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1555,37 +1555,30 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh uint8_t pmq_idx = 0; StreamMsg *smsg_inspect = smsg; for ( ; smsg_inspect != NULL; smsg_inspect = smsg_inspect->next, pmq_idx++) { - //if (det_ctx->smsg_pmq[pmq_idx].pattern_id_array_cnt == 0) { - // SCLogDebug("no match in smsg_inspect %p (%u), idx %d", smsg_inspect, smsg_inspect->data.data_len, pmq_idx); - // continue; - //} - - //if (det_ctx->smsg_pmq[pmq_idx].pattern_id_bitarray != NULL) { - /* filter out sigs that want pattern matches, but - * have no matches */ - if ((s->flags & SIG_FLAG_MPM_STREAM) && !(s->flags & SIG_FLAG_MPM_STREAM_NEG) && - !(det_ctx->smsg_pmq[pmq_idx].pattern_id_bitarray[(s->mpm_pattern_id_div_8)] & s->mpm_pattern_id_mod_8)) { - SCLogDebug("no match in this smsg"); - continue; - } - - if (DetectEngineInspectStreamPayload(de_ctx, det_ctx, s, p->flow, smsg_inspect->data.data, smsg_inspect->data.data_len) == 1) { - SCLogDebug("match in smsg %p", smsg); - pmatch = 1; - /* Tell the engine that this reassembled stream can drop the - * rest of the pkts with no further inspection */ - if (s->action & ACTION_DROP) - alert_flags |= PACKET_ALERT_FLAG_DROP_FLOW; - - /* store ptr to current smsg */ - if (alert_msg == NULL) { - alert_msg = smsg_inspect; - p->alerts.alert_msgs = smsg; - } + /* filter out sigs that want pattern matches, but + * have no matches */ + if ((s->flags & SIG_FLAG_MPM_STREAM) && !(s->flags & SIG_FLAG_MPM_STREAM_NEG) && + !(det_ctx->smsg_pmq[pmq_idx].pattern_id_bitarray[(s->mpm_pattern_id_div_8)] & s->mpm_pattern_id_mod_8)) { + SCLogDebug("no match in this smsg"); + continue; + } - break; + if (DetectEngineInspectStreamPayload(de_ctx, det_ctx, s, p->flow, smsg_inspect->data.data, smsg_inspect->data.data_len) == 1) { + SCLogDebug("match in smsg %p", smsg); + pmatch = 1; + /* Tell the engine that this reassembled stream can drop the + * rest of the pkts with no further inspection */ + if (s->action & ACTION_DROP) + alert_flags |= PACKET_ALERT_FLAG_DROP_FLOW; + + /* store ptr to current smsg */ + if (alert_msg == NULL) { + alert_msg = smsg_inspect; + p->alerts.alert_msgs = smsg; } - //} + + break; + } } } /* if (smsg != NULL) */ -- 1.7.1