Make sure we don't process TAG records from the flow multiple times and outside the flow lock.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent 6384b39f18
commit f4aad76bb4

@ -328,6 +328,8 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
DetectTagDataEntry *prev = NULL;
DetectTagDataEntry *iter = NULL;
DetectTagDataEntryList tdl;
DetectTagDataEntryList *tde_src = NULL;
DetectTagDataEntryList *tde_dst = NULL;
unsigned int current_tags = SC_ATOMIC_GET(num_tags);
/* If there's no tag, get out of here */
@ -439,6 +441,8 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
prev = iter;
iter = iter->next;
}
iter = NULL;
}
SCMutexUnlock(&p->flow->m);
}
@ -452,9 +456,6 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
tag_ctx->last_ts.tv_sec = ts.tv_sec;
}
DetectTagDataEntryList *tde_src = NULL;
DetectTagDataEntryList *tde_dst = NULL;
if (PKT_IS_IPV4(p)) {
tdl.ipv = 4;
/* search tags for source */
@ -475,7 +476,7 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
tde_dst = TagHashSearch(tag_ctx, &tdl, p);
}
if (tde_src != NULL)
if (tde_src != NULL) {
iter = tde_src->header_entry;
prev = NULL;
while (iter != NULL) {
@ -569,8 +570,9 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
prev = iter;
iter = iter->next;
}
}
if (tde_dst != NULL)
if (tde_dst != NULL) {
iter = tde_dst->header_entry;
prev = NULL;
while (iter != NULL) {
@ -664,6 +666,7 @@ void TagHandlePacket(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
prev = iter;
iter = iter->next;
}
}
SCMutexUnlock(&tag_ctx->lock);
}

Loading…
Cancel
Save