Work around some Tcp session free issues in the app layer parsers.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 391e69e699
commit 7715e8f0fc

@ -369,7 +369,12 @@ void *AppLayerDetectProtoThread(void *td)
mutex_lock(&smsg->flow->m); mutex_lock(&smsg->flow->m);
if (store == 1) { if (store == 1) {
/* store */ /* store */
if (ssn != NULL && ssn->l7data != NULL) {
ssn->l7data[al_proto_id] = (void *)al_proto; ssn->l7data[al_proto_id] = (void *)al_proto;
} else {
al_proto->proto = 0;
PoolReturn(al_detect_proto_pool,(void *)al_proto);
}
store = 0; store = 0;
} }
/* XXX we need to improve this logic */ /* XXX we need to improve this logic */

@ -456,6 +456,7 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, uint32_
return -1; return -1;
mutex_lock(&f->m); mutex_lock(&f->m);
if (ssn->l7data != NULL) /** \todo remove once we fixed ssn timeouts */
ssn->l7data[app_layer_sid] = (void *)parser_state_store; ssn->l7data[app_layer_sid] = (void *)parser_state_store;
mutex_unlock(&f->m); mutex_unlock(&f->m);
} }
@ -492,13 +493,18 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, uint32_
parser_state->flags |= APP_LAYER_PARSER_EOF; parser_state->flags |= APP_LAYER_PARSER_EOF;
/* See if we already have a 'app layer' state */ /* See if we already have a 'app layer' state */
void *app_layer_state = ssn->l7data[p->storage_id]; void *app_layer_state = NULL;
mutex_lock(&f->m);
if (ssn->l7data != NULL) /** \todo remove once we fixed ssn timeouts */
app_layer_state = ssn->l7data[p->storage_id];
mutex_unlock(&f->m);
if (app_layer_state == NULL) { if (app_layer_state == NULL) {
app_layer_state = p->StateAlloc(); app_layer_state = p->StateAlloc();
if (app_layer_state == NULL) if (app_layer_state == NULL)
return -1; return -1;
mutex_lock(&f->m); mutex_lock(&f->m);
if (ssn->l7data != NULL) /** \todo remove once we fixed ssn timeouts */
ssn->l7data[p->storage_id] = app_layer_state; ssn->l7data[p->storage_id] = app_layer_state;
mutex_unlock(&f->m); mutex_unlock(&f->m);
} }

Loading…
Cancel
Save