detect: minor cleanup

pull/3108/head
Victor Julien 8 years ago
parent 948dee9a98
commit ccf202a4f0

@ -353,7 +353,8 @@ static void StoreStateTx(DetectEngineThreadCtx *det_ctx,
SCLogDebug("Stored for TX %"PRIu64, tx_id);
}
int DeStateDetectStartDetection(ThreadVars *tv,
/* returns: true match, false no match */
bool DeStateDetectStartDetection(ThreadVars *tv,
DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
const Signature *s, Packet *p, Flow *f,
@ -365,7 +366,7 @@ int DeStateDetectStartDetection(ThreadVars *tv,
/* TX based matches (inspect engines) */
void *alstate = FlowGetAppState(f);
if (unlikely(!StateIsValid(alproto, alstate))) {
return 0;
return false;
}
SigMatchData *smd = NULL;
@ -511,7 +512,7 @@ int DeStateDetectStartDetection(ThreadVars *tv,
det_ctx->tx_id = 0;
det_ctx->tx_id_set = 0;
det_ctx->p = NULL;
return alert_cnt ? 1:0;
return (alert_cnt > 0);
}
static int DoInspectItem(ThreadVars *tv,

@ -145,9 +145,9 @@ int DeStateFlowHasInspectableState(const Flow *f, const uint8_t flags);
* \param flags Flags.
* \param alproto App protocol.
*
* \retval >= 0 An integer value indicating the no of matches.
* \retval bool true is sig matched, false if it didn't
*/
int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
bool DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
const Signature *s, Packet *p, Flow *f,
const uint8_t flags, const AppProto alproto);

@ -417,7 +417,6 @@ void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineT
uint8_t flow_flags = 0; /* flow/state flags */
const Signature *s = NULL;
const Signature *next_s = NULL;
int state_alert = 0;
bool app_decoder_events = false;
bool has_state = false; /* do we have an alstate to work with? */
@ -662,7 +661,7 @@ void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineT
}
while (match_cnt--) {
RULE_PROFILING_START(p);
state_alert = 0;
bool state_alert = false;
#ifdef PROFILING
bool smatch = false; /* signature match */
#endif
@ -867,7 +866,7 @@ void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineT
state_alert = DeStateDetectStartDetection(th_v, de_ctx, det_ctx, s,
p, pflow, flow_flags, alproto);
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_STATEFUL_START);
if (state_alert == 0)
if (state_alert == false)
goto next;
/* match */

Loading…
Cancel
Save