int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
Signature *s, Packet *p, Flow *f, uint8_t flags,
- void *alstate, AppProto alproto, uint16_t alversion)
+ AppProto alproto, uint16_t alversion)
{
DetectEngineAppInspectionEngine *engine = NULL;
SigMatch *sm = NULL;
uint16_t file_no_match = 0;
uint32_t inspect_flags = 0;
+ void *alstate = NULL;
HtpState *htp_state = NULL;
SMBState *smb_state = NULL;
int alert_cnt = 0;
- if (alstate == NULL)
- goto end;
-
if (AppLayerParserProtocolSupportsTxs(f->proto, alproto)) {
FLOWLOCK_WRLOCK(f);
-
+ alstate = FlowGetAppState(f);
+ if (alstate == NULL) {
+ FLOWLOCK_UNLOCK(f);
+ goto end;
+ }
if (alproto == ALPROTO_HTTP) {
htp_state = (HtpState *)alstate;
if (htp_state->conn == NULL) {
(alproto == ALPROTO_DCERPC || alproto == ALPROTO_SMB ||
alproto == ALPROTO_SMB2))
{
+ FLOWLOCK_WRLOCK(f);
+ alstate = FlowGetAppState(f);
+ if (alstate == NULL) {
+ FLOWLOCK_UNLOCK(f);
+ goto end;
+ }
+
KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_DMATCH);
if (alproto == ALPROTO_SMB || alproto == ALPROTO_SMB2) {
smb_state = (SMBState *)alstate;
}
}
+ FLOWLOCK_UNLOCK(f);
}
KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_AMATCH);
/* RDLOCK would be nicer, but at least tlsstore needs
* write lock currently. */
FLOWLOCK_WRLOCK(f);
+ alstate = FlowGetAppState(f);
+ if (alstate == NULL) {
+ FLOWLOCK_UNLOCK(f);
+ goto end;
+ }
for (match = 0; sm != NULL; sm = sm->next) {
match = 0;
* \param s Pointer to the signature.
* \param f Pointer to the flow.
* \param flags Flags.
- * \param alstate App state.
* \param alproto App protocol.
* \param alversion Current app layer version.
*
int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
Signature *s, Packet *p, Flow *f, uint8_t flags,
- void *alstate, AppProto alproto,
- uint16_t alversion);
+ AppProto alproto, uint16_t alversion);
/**
* \brief Continue DeState detection of the signatures stored in the state.
* can store the tx_id with the alert */
PACKET_PROFILING_DETECT_START(p, PROF_DETECT_STATEFUL);
state_alert = DeStateDetectStartDetection(th_v, de_ctx, det_ctx, s,
- p, pflow, flags, alstate, alproto, alversion);
+ p, pflow, flags, alproto, alversion);
PACKET_PROFILING_DETECT_END(p, PROF_DETECT_STATEFUL);
if (state_alert == 0)
goto next;