detect: make SigMatchSignatures void

None of the callers cared for it's retval, so get rid of it.
pull/2673/head
Victor Julien 9 years ago
parent f49150ddb9
commit 61c35d3c39

@ -887,11 +887,8 @@ DetectPostInspectFirstSGH(const Packet *p, Flow *pflow, const SigGroupHead *sgh)
/** /**
* \brief Signature match function * \brief Signature match function
*
* \retval 1 one or more signatures matched
* \retval 0 no matches were found
*/ */
int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p) void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
{ {
bool use_flow_sgh = false; bool use_flow_sgh = false;
uint8_t alert_flags = 0; uint8_t alert_flags = 0;
@ -903,23 +900,23 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
const Signature *s = NULL; const Signature *s = NULL;
const Signature *next_s = NULL; const Signature *next_s = NULL;
int state_alert = 0; int state_alert = 0;
int alerts = 0;
int app_decoder_events = 0; int app_decoder_events = 0;
bool has_state = false; /* do we have an alstate to work with? */ bool has_state = false; /* do we have an alstate to work with? */
SCEnter(); SCEnter();
SCLogDebug("pcap_cnt %"PRIu64, p->pcap_cnt); SCLogDebug("pcap_cnt %"PRIu64, p->pcap_cnt);
#ifdef UNITTESTS
det_ctx->ticker++;
p->alerts.cnt = 0; p->alerts.cnt = 0;
#endif
det_ctx->ticker++;
det_ctx->filestore_cnt = 0; det_ctx->filestore_cnt = 0;
det_ctx->base64_decoded_len = 0; det_ctx->base64_decoded_len = 0;
det_ctx->raw_stream_progress = 0; det_ctx->raw_stream_progress = 0;
/* No need to perform any detection on this packet, if the the given flag is set.*/ /* No need to perform any detection on this packet, if the the given flag is set.*/
if (p->flags & PKT_NOPACKET_INSPECTION) { if (p->flags & PKT_NOPACKET_INSPECTION) {
SCReturnInt(0); SCReturn;
} }
/* Load the Packet's flow early, even though it might not be needed. /* Load the Packet's flow early, even though it might not be needed.
@ -1117,7 +1114,6 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
} }
#endif #endif
PACKET_PROFILING_DETECT_START(p, PROF_DETECT_RULES); PACKET_PROFILING_DETECT_START(p, PROF_DETECT_RULES);
/* inspect the sigs against the packet */ /* inspect the sigs against the packet */
/* Prefetch the next signature. */ /* Prefetch the next signature. */
@ -1131,7 +1127,6 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
Signature **match_array = det_ctx->match_array; Signature **match_array = det_ctx->match_array;
SGH_PROFILING_RECORD(det_ctx, det_ctx->sgh); SGH_PROFILING_RECORD(det_ctx, det_ctx->sgh);
#ifdef PROFILING #ifdef PROFILING
#ifdef HAVE_LIBJANSSON #ifdef HAVE_LIBJANSSON
if (match_cnt >= de_ctx->profile_match_logging_threshold) if (match_cnt >= de_ctx->profile_match_logging_threshold)
@ -1144,21 +1139,19 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
next_s = *match_array++; next_s = *match_array++;
next_sflags = next_s->flags; next_sflags = next_s->flags;
} }
while (match_cnt--) { while (match_cnt--) {
RULE_PROFILING_START(p); RULE_PROFILING_START(p);
state_alert = 0; state_alert = 0;
#ifdef PROFILING #ifdef PROFILING
smatch = 0; smatch = 0;
#endif #endif
s = next_s; s = next_s;
sflags = next_sflags; sflags = next_sflags;
if (match_cnt) { if (match_cnt) {
next_s = *match_array++; next_s = *match_array++;
next_sflags = next_s->flags; next_sflags = next_s->flags;
} }
uint8_t s_proto_flags = s->proto.flags; const uint8_t s_proto_flags = s->proto.flags;
SCLogDebug("inspecting signature id %"PRIu32"", s->id); SCLogDebug("inspecting signature id %"PRIu32"", s->id);
@ -1373,7 +1366,6 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
/* apply actions even if not alerting */ /* apply actions even if not alerting */
DetectSignatureApplyActions(p, s); DetectSignatureApplyActions(p, s);
} }
alerts++;
next: next:
DetectVarProcessList(det_ctx, pflow, p); DetectVarProcessList(det_ctx, pflow, p);
DetectReplaceFree(det_ctx); DetectReplaceFree(det_ctx);
@ -1436,8 +1428,7 @@ end:
} }
} }
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_CLEANUP); PACKET_PROFILING_DETECT_END(p, PROF_DETECT_CLEANUP);
SCReturn;
SCReturnInt((int)(alerts > 0));
} }
/** \brief Apply action(s) and Set 'drop' sig info, /** \brief Apply action(s) and Set 'drop' sig info,

@ -1347,7 +1347,7 @@ char *DetectLoadCompleteSigPath(const DetectEngineCtx *, char *sig_file);
int SigLoadSignatures (DetectEngineCtx *, char *, int); int SigLoadSignatures (DetectEngineCtx *, char *, int);
void SigTableList(const char *keyword); void SigTableList(const char *keyword);
void SigTableSetup(void); void SigTableSetup(void);
int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx, Packet *p); DetectEngineThreadCtx *det_ctx, Packet *p);
int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s); int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s);

Loading…
Cancel
Save