diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index 774069d1a1..a9d6c573cf 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -1607,7 +1607,7 @@ int DCERPCParserTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcbind, bindlen, FALSE); + int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcbind, bindlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; @@ -1640,7 +1640,7 @@ int DCERPCParserTest01(void) { goto end; } - r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpcbindack, bindacklen, FALSE); + r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpcbindack, bindacklen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; @@ -1824,7 +1824,7 @@ int DCERPCParserTest02(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen, FALSE); + int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; @@ -2012,7 +2012,7 @@ int DCERPCParserTest03(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen, FALSE); + int r = AppLayerParse(&f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 30a886b8b2..de115b27d4 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -350,18 +350,16 @@ end: return proto; } -int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg, char need_lock) +int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg) { SCEnter(); uint16_t alproto = ALPROTO_UNKNOWN; int r = 0; - if (need_lock == TRUE) SCMutexLock(&smsg->flow->m); TcpSession *ssn = smsg->flow->protoctx; if (ssn != NULL) { alproto = ssn->alproto; } - if (need_lock == TRUE) SCMutexUnlock(&smsg->flow->m); if (ssn != NULL) { if (smsg->flags & STREAM_START) { @@ -376,17 +374,14 @@ int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg, char nee smsg->data.data, smsg->data.data_len, smsg->flags); if (alproto != ALPROTO_UNKNOWN) { /* store the proto and setup the L7 data array */ - if (need_lock == TRUE) SCMutexLock(&smsg->flow->m); StreamL7DataPtrInit(ssn,StreamL7GetStorageSize()); ssn->alproto = alproto; - if (need_lock == TRUE) SCMutexUnlock(&smsg->flow->m); r = AppLayerParse(smsg->flow, alproto, smsg->flags, - smsg->data.data, smsg->data.data_len, need_lock); + smsg->data.data, smsg->data.data_len); } else { SCLogDebug("ALPROTO_UNKNOWN flow %p", smsg->flow); - if (need_lock == TRUE) SCMutexLock(&smsg->flow->m); TcpSession *ssn = smsg->flow->protoctx; if (ssn != NULL) { if (smsg->flags & STREAM_TOCLIENT) { @@ -395,7 +390,6 @@ int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg, char nee StreamTcpSetSessionNoReassemblyFlag(ssn, 0); } } - if (need_lock == TRUE) SCMutexUnlock(&smsg->flow->m); } } else { @@ -411,16 +405,15 @@ int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg, char nee * a start msg should have gotten us one */ if (alproto != ALPROTO_UNKNOWN) { r = AppLayerParse(smsg->flow, alproto, smsg->flags, - smsg->data.data, smsg->data.data_len, need_lock); + smsg->data.data, smsg->data.data_len); } else { SCLogDebug(" smsg not start, but no l7 data? Weird"); } } } - if (need_lock == TRUE) SCMutexLock(&smsg->flow->m); + /* flow is free again */ smsg->flow->use_cnt--; - if (need_lock == TRUE) SCMutexUnlock(&smsg->flow->m); /* return the used message to the queue */ StreamMsgReturnToPool(smsg); diff --git a/src/app-layer-detect-proto.h b/src/app-layer-detect-proto.h index 1307b110ee..b916ff9688 100644 --- a/src/app-layer-detect-proto.h +++ b/src/app-layer-detect-proto.h @@ -13,7 +13,7 @@ typedef struct AlpProtoDetectThreadCtx_ { AlpProtoDetectDirectionThread toclient; } AlpProtoDetectThreadCtx; -int AppLayerHandleMsg(AlpProtoDetectThreadCtx *, StreamMsg *smsg, char); +int AppLayerHandleMsg(AlpProtoDetectThreadCtx *, StreamMsg *smsg); void *AppLayerDetectProtoThread(void *td); void AppLayerDetectProtoThreadInit(void); diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 5a2ae4d4ac..06914184d3 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -280,7 +280,7 @@ int FTPParserTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf, ftplen, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf, ftplen); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -321,21 +321,21 @@ int FTPParserTest03(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2, FALSE); + r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf3, ftplen3, FALSE); + r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf3, ftplen3); if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -373,7 +373,7 @@ int FTPParserTest06(void) { f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, ftpbuf1, ftplen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -413,14 +413,14 @@ int FTPParserTest07(void) { f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf2, ftplen2, FALSE); + r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -466,7 +466,7 @@ int FTPParserTest10(void) { else if (u == (ftplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - r = AppLayerParse(&f, ALPROTO_FTP, flags, &ftpbuf1[u], 1, FALSE); + r = AppLayerParse(&f, ALPROTO_FTP, flags, &ftpbuf1[u], 1); if (r != 0) { SCLogDebug("toserver chunk %" PRIu32 " returned %" PRId32 ", expected 0: ", u, r); result = 0; diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 90a391e1ed..712f85f8dc 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -290,7 +290,7 @@ htp_tx_t *HTPTransactionMain(const HtpState *htp_state) SCReturnPtr(list_get(htp_state->connp->conn->transactions, 0), "htp_tx_t"); } -//#ifdef UNITTESTS +#ifdef UNITTESTS /** \test Test case where chunks are sent in smaller chunks and check the * response of the parser from HTP library. */ int HTPParserTest01(void) { @@ -314,7 +314,7 @@ int HTPParserTest01(void) { else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1, FALSE); + r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); @@ -369,7 +369,7 @@ int HTPParserTest02(void) { f.protoctx = (void *)&ssn; int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| - STREAM_EOF, httpbuf1, httplen1, FALSE); + STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -423,7 +423,7 @@ int HTPParserTest03(void) { else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1, FALSE); + r = AppLayerParse(&f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); @@ -475,7 +475,7 @@ int HTPParserTest04(void) { f.protoctx = (void *)&ssn; r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| - STREAM_EOF, httpbuf1, httplen1, FALSE); + STREAM_EOF, httpbuf1, httplen1); HtpState *htp_state = ssn.aldata[AlpGetStateIdx(ALPROTO_HTTP)]; if (htp_state == NULL) { @@ -532,7 +532,7 @@ int HTPParserTest05(void) { f.protoctx = (void *)&ssn; int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, - httpbuf1, httplen1, FALSE); + httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -540,21 +540,21 @@ int HTPParserTest05(void) { } r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, httpbuf4, - httplen4, FALSE); + httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf5, httplen5, FALSE); + r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2, FALSE); + r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -562,7 +562,7 @@ int HTPParserTest05(void) { } r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, - httplen3, FALSE); + httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -570,7 +570,7 @@ int HTPParserTest05(void) { } r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, httpbuf6, - httplen6, FALSE); + httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -671,7 +671,7 @@ int HTPParserTest06(void) { f.protoctx = (void *)&ssn; int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, - httpbuf1, httplen1, FALSE); + httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -679,7 +679,7 @@ int HTPParserTest06(void) { } r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, httpbuf2, - httplen2, FALSE); + httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -723,7 +723,8 @@ int HTPParserTest06(void) { end: return result; } -//#endif /* UNITTESTS */ +#endif /* UNITTESTS */ + /** * \brief Register the Unit tests for the HTTP protocol */ diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 44f28fe048..0333251c57 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -618,7 +618,7 @@ static void AppLayerParserResultCleanup(AppLayerParserResult *result) static int AppLayerDoParse(Flow *f, void *app_layer_state, AppLayerParserState *parser_state, uint8_t *input, uint32_t input_len, uint16_t parser_idx, - uint16_t proto, char need_lock) + uint16_t proto) { SCEnter(); int retval = 0; @@ -663,7 +663,7 @@ static int AppLayerDoParse(Flow *f, void *app_layer_state, AppLayerParserState * parser_state->flags |= APP_LAYER_PARSER_EOF; r = AppLayerDoParse(f, app_layer_state, parser_state, e->data_ptr, - e->data_len, idx, proto, need_lock); + e->data_len, idx, proto); /* restore */ parser_state->flags &= ~APP_LAYER_PARSER_EOF; @@ -692,13 +692,12 @@ static int AppLayerDoParse(Flow *f, void *app_layer_state, AppLayerParserState * * \param flags Stream flags * \param input Input L7 data * \param input_len Length of the input data. - * \param need_lock bool controlling locking for the flow * * \retval -1 error * \retval 0 ok */ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, - uint32_t input_len, char need_lock) + uint32_t input_len) { SCEnter(); @@ -718,13 +717,11 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, parser_state_store = (AppLayerParserStateStore *) ssn->aldata[app_layer_sid]; if (parser_state_store == NULL) { - if (need_lock == TRUE) SCMutexLock(&f->m); parser_state_store = AppLayerParserStateStoreAlloc(); if (parser_state_store == NULL) goto error; ssn->aldata[app_layer_sid] = (void *)parser_state_store; - if (need_lock == TRUE) SCMutexUnlock(&f->m); } } else { SCLogDebug("No App Layer Data"); @@ -774,7 +771,6 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, /* See if we already have a 'app layer' state */ void *app_layer_state = NULL; - if (need_lock == TRUE) SCMutexLock(&f->m); app_layer_state = ssn->aldata[p->storage_id]; if (app_layer_state == NULL) { @@ -782,7 +778,6 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, * alloc more than one otherwise */ app_layer_state = p->StateAlloc(); if (app_layer_state == NULL) { - if (need_lock == TRUE) SCMutexUnlock(&f->m); goto error; } @@ -791,18 +786,15 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, } else { SCLogDebug("using existing app layer state %p (p->storage_id %u, name %s))", app_layer_state, p->storage_id, al_proto_table[ssn->alproto].name); } - if (need_lock == TRUE) SCMutexUnlock(&f->m); /* invoke the recursive parser */ int r = AppLayerDoParse(f, app_layer_state, parser_state, input, input_len, - parser_idx, proto, need_lock); + parser_idx, proto); if (r < 0) goto error; /* set the packets to no inspection and reassembly for the TLS sessions */ if (parser_state->flags & APP_LAYER_PARSER_NO_INSPECTION) { - if (need_lock == TRUE) SCMutexLock(&f->m); - FlowSetNoPayloadInspectionFlag(f); /* Set the no reassembly flag for both the stream in this TcpSession */ @@ -812,7 +804,6 @@ int AppLayerParse(Flow *f, uint8_t proto, uint8_t flags, uint8_t *input, StreamTcpSetSessionNoReassemblyFlag(ssn, flags & STREAM_TOSERVER ? 1 : 0); } - if (need_lock == TRUE) SCMutexUnlock(&f->m); } SCReturnInt(0); @@ -820,7 +811,6 @@ error: if (ssn != NULL) { /* Clear the app layer protocol state memory and the given function also * cleans the parser state memory */ - if (need_lock == TRUE) SCMutexLock(&f->m); if (f->use_cnt == 0) AppLayerParserCleanupState(ssn); @@ -857,7 +847,6 @@ error: "dst port %"PRIu16"", al_proto_table[ssn->alproto].name, f->proto, src6, dst6, f->sp, f->dp); } - if (need_lock == TRUE) SCMutexUnlock(&f->m); } SCReturnInt(-1); @@ -1072,7 +1061,7 @@ static int AppLayerParserTest01 (void) f.proto = IPPROTO_TCP; int r = AppLayerParse(&f, ALPROTO_TEST, STREAM_TOSERVER|STREAM_EOF, testbuf, - testlen, FALSE); + testlen); if (r != -1) { printf("returned %" PRId32 ", expected -1: \n", r); result = 0; diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 46b0406650..79375e100e 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -100,7 +100,7 @@ void AppLayerRegisterStateFuncs(uint16_t proto, void *(*StateAlloc)(void), void (*StateFree)(void *)); int AppLayerParse(Flow *, uint8_t proto, uint8_t flags, uint8_t *input, - uint32_t input_len, char); + uint32_t input_len); int AlpParseFieldBySize(AppLayerParserResult *, AppLayerParserState *, uint16_t, uint32_t, uint8_t *, uint32_t, uint32_t *); diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index f920396bc0..8e1e72a29e 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -1167,7 +1167,7 @@ int SMBParserTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_EOF, smbbuf, smblen, FALSE); + int r = AppLayerParse(&f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_EOF, smbbuf, smblen); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/app-layer-smb2.c b/src/app-layer-smb2.c index 0879e0f740..df1144c820 100644 --- a/src/app-layer-smb2.c +++ b/src/app-layer-smb2.c @@ -443,7 +443,7 @@ int SMB2ParserTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_SMB2, STREAM_TOSERVER|STREAM_EOF, smb2buf, smb2len, FALSE); + int r = AppLayerParse(&f, ALPROTO_SMB2, STREAM_TOSERVER|STREAM_EOF, smb2buf, smb2len); if (r != 0) { printf("smb2 header check returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/app-layer-tls.c b/src/app-layer-tls.c index e43b0ec368..1db41ebd97 100644 --- a/src/app-layer-tls.c +++ b/src/app-layer-tls.c @@ -546,8 +546,7 @@ static int TLSParserTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER|STREAM_EOF, tlsbuf, - tlslen, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER|STREAM_EOF, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -593,15 +592,14 @@ static int TLSParserTest02(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -649,22 +647,21 @@ static int TLSParserTest03(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -714,29 +711,28 @@ static int TLSParserTest04(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4,FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -781,16 +777,14 @@ static int TLSParserTest05(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -799,8 +793,7 @@ static int TLSParserTest05(void) { tlsbuf[0] = 0x14; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -809,8 +802,7 @@ static int TLSParserTest05(void) { tlsbuf[0] = 0x14; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -819,8 +811,7 @@ static int TLSParserTest05(void) { tlsbuf[0] = 0x17; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -886,16 +877,14 @@ static int TLSParserTest06(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -904,8 +893,7 @@ static int TLSParserTest06(void) { tlsbuf[0] = 0x14; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -914,8 +902,7 @@ static int TLSParserTest06(void) { tlsbuf[0] = 0x17; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -958,8 +945,7 @@ static int TLSParserTest06(void) { tlsbuf[0] = 0x14; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -968,8 +954,7 @@ static int TLSParserTest06(void) { tlsbuf[0] = 0x17; - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, - tlslen, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -1034,8 +1019,7 @@ static int TLSParserMultimsgTest01(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -1106,8 +1090,7 @@ static int TLSParserMultimsgTest02(void) { StreamL7DataPtrInit(&ssn,StreamL7GetStorageSize()); f.protoctx = (void *)&ssn; - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf1, tlslen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/detect-ftpbounce.c b/src/detect-ftpbounce.c index d761546d48..bd0f83f57c 100644 --- a/src/detect-ftpbounce.c +++ b/src/detect-ftpbounce.c @@ -331,29 +331,28 @@ static int DetectFtpbounceTestALMatch02(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, - ftplen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf3, ftplen3, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf3, ftplen3); if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf4, ftplen4, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf4, ftplen4); if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -450,29 +449,28 @@ static int DetectFtpbounceTestALMatch03(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, - ftplen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf3, ftplen3, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf3, ftplen3); if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; goto end; } - r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf4, ftplen4, FALSE); + r = AppLayerParse(&f,ALPROTO_FTP, STREAM_TOSERVER, ftpbuf4, ftplen4); if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/detect-http-cookie.c b/src/detect-http-cookie.c index 02c1273450..ae1f0ed591 100644 --- a/src/detect-http-cookie.c +++ b/src/detect-http-cookie.c @@ -420,8 +420,7 @@ static int DetectHttpCookieSigTest01(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; @@ -502,8 +501,7 @@ static int DetectHttpCookieSigTest02(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; diff --git a/src/detect-http-method.c b/src/detect-http-method.c index 3943e1da7c..3a6e1eb703 100755 --- a/src/detect-http-method.c +++ b/src/detect-http-method.c @@ -419,8 +419,7 @@ static int DetectHttpMethodSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; @@ -511,8 +510,7 @@ static int DetectHttpMethodSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; @@ -593,8 +591,7 @@ static int DetectHttpMethodSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; diff --git a/src/detect-tls-version.c b/src/detect-tls-version.c index 1cdb869d12..ab0768b5b7 100644 --- a/src/detect-tls-version.c +++ b/src/detect-tls-version.c @@ -326,25 +326,25 @@ static int DetectTlsVersionTestDetect01(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); goto end; @@ -436,25 +436,25 @@ static int DetectTlsVersionTestDetect02(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); goto end; @@ -548,25 +548,25 @@ static int DetectTlsVersionTestDetect03(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1, FALSE); + int r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); goto end; } - r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4, FALSE); + r = AppLayerParse(&f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); goto end; diff --git a/src/detect-urilen.c b/src/detect-urilen.c index f6aa544549..c6ce4e0dd3 100644 --- a/src/detect-urilen.c +++ b/src/detect-urilen.c @@ -512,8 +512,7 @@ static int DetectUrilenSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1, - FALSE); + int r = AppLayerParse(&f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); goto end; @@ -561,4 +560,4 @@ void DetectUrilenRegisterTests(void) UtRegisterTest("DetectUrilenSetpTest01", DetectUrilenSetpTest01, 1); UtRegisterTest("DetectUrilenSigTest01", DetectUrilenSigTest01, 1); #endif /* UNITTESTS */ -} \ No newline at end of file +} diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 89c58da4d5..d067988b50 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -1519,8 +1519,8 @@ int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx) break; /** Handle the stream msg. No need to use locking, flow is already - * locked */ - r = AppLayerHandleMsg(&ra_ctx->dp_ctx, smsg, FALSE); + * locked at this point. */ + r = AppLayerHandleMsg(&ra_ctx->dp_ctx, smsg); if (r < 0) break; } while (ra_ctx->stream_q->len > 0);