From: Victor Julien Date: Sat, 24 Sep 2016 06:40:33 +0000 (+0200) Subject: unittests: replace SCMutex* calls by FLOWLOCK_* X-Git-Tag: suricata-3.2beta1~306 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6530c3d0d820d3aea02360dbd31f7c90c3881efe;p=thirdparty%2Fsuricata.git unittests: replace SCMutex* calls by FLOWLOCK_* --- diff --git a/src/app-layer-dcerpc-udp.c b/src/app-layer-dcerpc-udp.c index 218f58e65e..56ed637f86 100644 --- a/src/app-layer-dcerpc-udp.c +++ b/src/app-layer-dcerpc-udp.c @@ -1075,15 +1075,15 @@ int DCERPCUDPParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCUDPState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index ece676e7f1..6efe6d029e 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -2421,15 +2421,15 @@ int DCERPCParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcbind, bindlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -2457,15 +2457,15 @@ int DCERPCParserTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpcbindack, bindacklen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (dcerpc_state->dcerpc.dcerpchdr.type != BIND_ACK) { printf("expected dcerpc type 0x%02x , got 0x%02x : ", BIND_ACK, dcerpc_state->dcerpc.dcerpchdr.type); result = 0; @@ -2481,15 +2481,15 @@ int DCERPCParserTest01(void) printUUID("BIND_ACK", uuid_entry); } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_EOF, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (dcerpc_state->dcerpc.dcerpchdr.type != REQUEST) { printf("expected dcerpc type 0x%02x , got 0x%02x : ", REQUEST, dcerpc_state->dcerpc.dcerpchdr.type); result = 0; @@ -2653,15 +2653,15 @@ int DCERPCParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -2853,15 +2853,15 @@ int DCERPCParserTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, dcerpcrequest, requestlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4302,16 +4302,16 @@ int DCERPCParserTest05(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, bind1, bind1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4328,16 +4328,16 @@ int DCERPCParserTest05(void) m++; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind2, bind2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); item = NULL; m = 0; @@ -4477,16 +4477,16 @@ int DCERPCParserTest06(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, bind1, bind1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4500,16 +4500,16 @@ int DCERPCParserTest06(void) result &= (dcerpc_state->dcerpc.dcerpcbindbindack.numctxitems == 16); result &= (dcerpc_state->dcerpc.dcerpcbindbindack.numctxitemsleft == 8); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind2, bind2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.dcerpcbindbindack.ctxbytesprocessed == 0); @@ -4563,16 +4563,16 @@ int DCERPCParserTest07(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, request1, request1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4586,32 +4586,32 @@ int DCERPCParserTest07(void) dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer_len == 12); result &= (dcerpc_state->dcerpc.pdu_fragged = 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 38); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer != NULL && dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer_len == 14); result &= (dcerpc_state->dcerpc.pdu_fragged = 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer != NULL && @@ -4655,16 +4655,16 @@ int DCERPCParserTest08(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, request, request_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4715,16 +4715,16 @@ int DCERPCParserTest09(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, request, request_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4789,16 +4789,16 @@ int DCERPCParserTest10(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER|STREAM_START, fault, fault_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4807,31 +4807,31 @@ int DCERPCParserTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 2); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer == NULL); result &= (dcerpc_state->dcerpc.pdu_fragged == 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer != NULL && @@ -4890,16 +4890,16 @@ int DCERPCParserTest11(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -4913,30 +4913,30 @@ int DCERPCParserTest11(void) dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer_len == 12); result &= (dcerpc_state->dcerpc.pdu_fragged == 0); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 2); result &= (dcerpc_state->dcerpc.pdu_fragged == 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer != NULL && @@ -4989,16 +4989,16 @@ int DCERPCParserTest12(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack1, bind_ack1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5010,16 +5010,16 @@ int DCERPCParserTest12(void) result &= (dcerpc_state->dcerpc.bytesprocessed == 24); result &= (dcerpc_state->dcerpc.pdu_fragged == 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack2, bind_ack2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.pdu_fragged == 0); @@ -5067,16 +5067,16 @@ int DCERPCParserTest13(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind, bind_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5158,16 +5158,16 @@ int DCERPCParserTest14(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind, bind_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5220,16 +5220,16 @@ int DCERPCParserTest15(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack, bind_ack_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5682,16 +5682,16 @@ int DCERPCParserTest16(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind1, bind1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5700,16 +5700,16 @@ int DCERPCParserTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack1, bind_ack1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5732,16 +5732,16 @@ int DCERPCParserTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind2, bind2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5752,16 +5752,16 @@ int DCERPCParserTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack2, bind_ack2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5784,16 +5784,16 @@ int DCERPCParserTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind3, bind3_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5804,16 +5804,16 @@ int DCERPCParserTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack3, bind_ack3_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5928,16 +5928,16 @@ int DCERPCParserTest17(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, bind, bind_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -5946,16 +5946,16 @@ int DCERPCParserTest17(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, bind_ack, bind_ack_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5978,16 +5978,16 @@ int DCERPCParserTest17(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, alter_context, alter_context_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -5998,16 +5998,16 @@ int DCERPCParserTest17(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, alter_context_resp, alter_context_resp_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); count = 0; TAILQ_FOREACH(item, &dcerpc_state->dcerpc.dcerpcbindbindack.accepted_uuid_list, next) { @@ -6073,16 +6073,16 @@ int DCERPCParserTest18(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -6095,16 +6095,16 @@ int DCERPCParserTest18(void) result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer == NULL); result &= (dcerpc_state->dcerpc.pdu_fragged == 1); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result &= (dcerpc_state->dcerpc.bytesprocessed == 0); result &= (dcerpc_state->dcerpc.dcerpcrequest.stub_data_buffer != NULL && @@ -6339,14 +6339,14 @@ int DCERPCParserTest19(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpcbind, bindlen); if (r != 0) { printf("dcerpc header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); DCERPCState *dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -6359,14 +6359,14 @@ int DCERPCParserTest19(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpcbindack, bindacklen); if (r == 0) { printf("dce parser didn't return fail\n"); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result = 1; end: diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 541fa24e90..e9b2480e7f 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -3341,14 +3341,14 @@ static int AppLayerProtoDetectTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3434,14 +3434,14 @@ static int AppLayerProtoDetectTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3529,14 +3529,14 @@ static int AppLayerProtoDetectTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3620,14 +3620,14 @@ static int AppLayerProtoDetectTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_FTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); @@ -3722,14 +3722,14 @@ static int AppLayerProtoDetectTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 985a75e02e..6e90a4a00e 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -392,15 +392,15 @@ int FTPParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf, ftplen); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -444,35 +444,35 @@ int FTPParserTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf3, ftplen3); if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -513,15 +513,15 @@ int FTPParserTest06(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &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; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -565,25 +565,25 @@ int FTPParserTest07(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_START, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER|STREAM_EOF, ftpbuf2, ftplen2); if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -635,15 +635,15 @@ int FTPParserTest10(void) else if (u == (ftplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, flags, &ftpbuf1[u], 1); if (r != 0) { SCLogDebug("toserver chunk %" PRIu32 " returned %" PRId32 ", expected 0: ", u, r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); } FtpState *ftp_state = f.alstate; diff --git a/src/app-layer-htp-file.c b/src/app-layer-htp-file.c index 0045bbaad7..a3505f3110 100644 --- a/src/app-layer-htp-file.c +++ b/src/app-layer-htp-file.c @@ -313,26 +313,26 @@ static int HTPFileParserTest01(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -405,48 +405,48 @@ static int HTPFileParserTest02(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -529,70 +529,70 @@ static int HTPFileParserTest03(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 5 size %u <<<<\n", httplen5); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 6 size %u <<<<\n", httplen6); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -684,70 +684,70 @@ static int HTPFileParserTest04(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 5 size %u <<<<\n", httplen5); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 6 size %u <<<<\n", httplen6); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -821,26 +821,26 @@ static int HTPFileParserTest05(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 size %u <<<<\n", httplen1); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -933,26 +933,26 @@ static int HTPFileParserTest06(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 size %u <<<<\n", httplen1); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1034,26 +1034,26 @@ static int HTPFileParserTest07(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 size %u <<<<\n", httplen1); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1128,26 +1128,26 @@ static int HTPFileParserTest08(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1156,14 +1156,14 @@ static int HTPFileParserTest08(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events == NULL) { printf("no app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); if (decoder_events->cnt != 2) { printf("expected 2 events: "); @@ -1224,48 +1224,48 @@ static int HTPFileParserTest09(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1274,14 +1274,14 @@ static int HTPFileParserTest09(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events == NULL) { printf("no app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); if (decoder_events->cnt != 1) { printf("expected 1 event: "); @@ -1340,48 +1340,48 @@ static int HTPFileParserTest10(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1390,14 +1390,14 @@ static int HTPFileParserTest10(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events != NULL) { printf("app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); result = 1; end: @@ -1479,44 +1479,44 @@ static int HTPFileParserTest11(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 3 size %u <<<<\n", httplen3); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 4 size %u <<<<\n", httplen4); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -1524,14 +1524,14 @@ static int HTPFileParserTest11(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events != NULL) { printf("app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); htp_tx_t *tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, http_state, 0); if (tx == NULL) { diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index d87abd18fb..93925d4ed2 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -2848,15 +2848,15 @@ int HTPParserTest01(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -2925,15 +2925,15 @@ static int HTPParserTest01a(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -2987,15 +2987,15 @@ int HTPParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3052,15 +3052,15 @@ int HTPParserTest03(void) else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; if (htp_state == NULL) { @@ -3113,14 +3113,14 @@ int HTPParserTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -3182,12 +3182,12 @@ int HTPParserTest05(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -3195,21 +3195,21 @@ int HTPParserTest05(void) httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -3217,7 +3217,7 @@ int HTPParserTest05(void) httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -3225,10 +3225,10 @@ int HTPParserTest05(void) httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3327,12 +3327,12 @@ int HTPParserTest06(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -3340,10 +3340,10 @@ int HTPParserTest06(void) httplen2); if (r != 0) { printf("toclient chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -3416,15 +3416,15 @@ int HTPParserTest07(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3515,16 +3515,16 @@ libhtp:\n\ uint8_t flags = 0; flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk returned %" PRId32 ", expected" " 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -3602,15 +3602,15 @@ libhtp:\n\ uint8_t flags = 0; flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk returned %" PRId32 ", expected" " 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -3678,15 +3678,15 @@ int HTPParserTest10(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3770,15 +3770,15 @@ static int HTPParserTest11(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3855,15 +3855,15 @@ static int HTPParserTest12(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -3943,15 +3943,15 @@ int HTPParserTest13(void) else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4354,16 +4354,16 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4537,15 +4537,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4706,15 +4706,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -4873,15 +4873,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5010,15 +5010,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5120,15 +5120,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5230,15 +5230,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5341,15 +5341,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5449,15 +5449,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5558,15 +5558,15 @@ libhtp:\n\ else if (u == (httplen1 - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, &httpbuf1[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; @@ -5713,23 +5713,23 @@ libhtp:\n\ StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SCLogDebug("\n>>>> processing chunk 1 again <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -5737,14 +5737,14 @@ libhtp:\n\ goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetDecoderEvents(f->alparser); if (decoder_events != NULL) { printf("app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); result = 1; end: if (alp_tctx != NULL) @@ -5831,28 +5831,28 @@ libhtp:\n\ else if (u == (len - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, (uint8_t *)&httpbuf[u], 1); if (u < 18294) { /* first 18294 bytes should result in 0 */ if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } } else if (u == 18294UL) { /* byte 18294 should result in error */ if (r != -1) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " -1: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } /* break out, htp state is in error state now */ - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); break; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; if (htp_state == NULL) { @@ -5869,14 +5869,14 @@ libhtp:\n\ goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events == NULL) { printf("no app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); if (decoder_events->events[0] != HTTP_DECODER_EVENT_REQUEST_FIELD_TOO_LONG) { printf("HTTP_DECODER_EVENT_REQUEST_FIELD_TOO_LONG not set: "); @@ -5973,15 +5973,15 @@ libhtp:\n\ else if (u == (len - 1)) flags = STREAM_TOSERVER|STREAM_EOF; else flags = STREAM_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, (uint8_t *)&httpbuf[u], 1); if (r != 0) { printf("toserver chunk %" PRIu32 " returned %" PRId32 ", expected" " 0: ", u, r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); } htp_state = f->alstate; if (htp_state == NULL) { @@ -5998,14 +5998,14 @@ libhtp:\n\ goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events != NULL) { printf("app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); result = 1; end: @@ -6056,14 +6056,14 @@ int HTPParserTest16(void) uint8_t flags = STREAM_TOSERVER|STREAM_START|STREAM_EOF; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, flags, (uint8_t *)httpbuf, len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); htp_state = f->alstate; if (htp_state == NULL) { @@ -6080,14 +6080,14 @@ int HTPParserTest16(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); AppLayerDecoderEvents *decoder_events = AppLayerParserGetEventsByTx(IPPROTO_TCP, ALPROTO_HTTP,f->alstate, 0); if (decoder_events == NULL) { printf("no app events: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); if (decoder_events->events[0] != HTTP_DECODER_EVENT_METHOD_DELIM_NON_COMPLIANT) { printf("HTTP_DECODER_EVENT_METHOD_DELIM_NON_COMPLIANT not set: "); @@ -6139,12 +6139,12 @@ int HTPParserTest17(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -6152,14 +6152,14 @@ int HTPParserTest17(void) httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -6167,11 +6167,11 @@ int HTPParserTest17(void) httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -6262,12 +6262,12 @@ int HTPParserTest18(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -6275,21 +6275,21 @@ int HTPParserTest18(void) httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -6298,11 +6298,11 @@ int HTPParserTest18(void) httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { @@ -6389,12 +6389,12 @@ int HTPParserTest19(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } @@ -6402,18 +6402,18 @@ int HTPParserTest19(void) httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); http_state = f->alstate; if (http_state == NULL) { diff --git a/src/app-layer-modbus.c b/src/app-layer-modbus.c index f02c2124d8..14dff540cc 100644 --- a/src/app-layer-modbus.c +++ b/src/app-layer-modbus.c @@ -1723,15 +1723,15 @@ static int ModbusParserTest01(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -1748,15 +1748,15 @@ static int ModbusParserTest01(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsRsp, sizeof(readCoilsRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -1788,15 +1788,15 @@ static int ModbusParserTest02(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, writeMultipleRegistersReq, sizeof(writeMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -1817,15 +1817,15 @@ static int ModbusParserTest02(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeMultipleRegistersRsp, sizeof(writeMultipleRegistersRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -1887,15 +1887,15 @@ static int ModbusParserTest03(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readWriteMultipleRegistersReq, sizeof(readWriteMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -1920,15 +1920,15 @@ static int ModbusParserTest03(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readWriteMultipleRegistersRsp, sizeof(readWriteMultipleRegistersRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -1975,15 +1975,15 @@ static int ModbusParserTest04(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, forceListenOnlyMode, sizeof(forceListenOnlyMode)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2054,15 +2054,15 @@ static int ModbusParserTest05(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidProtocolIdReq, sizeof(invalidProtocolIdReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2140,15 +2140,15 @@ static int ModbusParserTest06(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsRsp, sizeof(readCoilsRsp)); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2226,16 +2226,16 @@ static int ModbusParserTest07(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidLengthWriteMultipleRegistersReq, sizeof(invalidLengthWriteMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2313,15 +2313,15 @@ static int ModbusParserTest08(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2338,15 +2338,15 @@ static int ModbusParserTest08(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, readCoilsErrorRsp, sizeof(readCoilsErrorRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -2396,12 +2396,12 @@ static int ModbusParserTest09(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len - part2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -2409,10 +2409,10 @@ static int ModbusParserTest09(void) { input, input_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2433,12 +2433,12 @@ static int ModbusParserTest09(void) { part2_len = 10; input = readCoilsRsp; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len - part2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -2446,10 +2446,10 @@ static int ModbusParserTest09(void) { input, input_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -2491,15 +2491,15 @@ static int ModbusParserTest10(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, input, input_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2535,15 +2535,15 @@ static int ModbusParserTest10(void) { memcpy(input, readCoilsRsp, sizeof(readCoilsRsp)); memcpy(input + sizeof(readCoilsRsp), writeMultipleRegistersRsp, sizeof(writeMultipleRegistersRsp)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, sizeof(input_len)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result = 1; end: @@ -2602,16 +2602,16 @@ static int ModbusParserTest11(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, exceededLengthWriteMultipleRegistersReq, sizeof(exceededLengthWriteMultipleRegistersReq) + 65523 /* header.length - 7 */ * sizeof(uint8_t)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2689,16 +2689,16 @@ static int ModbusParserTest12(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidLengthPDUWriteMultipleRegistersReq, sizeof(invalidLengthPDUWriteMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2746,15 +2746,15 @@ static int ModbusParserTest13(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, maskWriteRegisterReq, sizeof(maskWriteRegisterReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2771,15 +2771,15 @@ static int ModbusParserTest13(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, maskWriteRegisterRsp, sizeof(maskWriteRegisterRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -2811,15 +2811,15 @@ static int ModbusParserTest14(void) { StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, writeSingleRegisterReq, sizeof(writeSingleRegisterReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2836,15 +2836,15 @@ static int ModbusParserTest14(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeSingleRegisterRsp, sizeof(writeSingleRegisterRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -2906,16 +2906,16 @@ static int ModbusParserTest15(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidMaskWriteRegisterReq, sizeof(invalidMaskWriteRegisterReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -2938,15 +2938,15 @@ static int ModbusParserTest15(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, maskWriteRegisterRsp, sizeof(maskWriteRegisterRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); @@ -3015,15 +3015,15 @@ static int ModbusParserTest16(void) { SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, invalidWriteSingleRegisterReq, sizeof(invalidWriteSingleRegisterReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -3047,15 +3047,15 @@ static int ModbusParserTest16(void) { goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, writeSingleRegisterRsp, sizeof(writeSingleRegisterRsp)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (modbus_state->transaction_max !=1) { printf("expected transaction_max %" PRIu8 ", got %" PRIu64 ": ", 1, modbus_state->transaction_max); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 4d95fe12b3..be47acf542 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1511,15 +1511,15 @@ static int AppLayerParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_TEST, STREAM_TOSERVER|STREAM_EOF, testbuf, testlen); if (r != -1) { printf("returned %" PRId32 ", expected -1: ", r); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); if (!(ssn.flags & STREAMTCP_FLAG_APP_LAYER_DISABLED)) { printf("flag should have been set, but is not: "); @@ -1564,16 +1564,16 @@ static int AppLayerParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_TEST, STREAM_TOSERVER|STREAM_EOF, testbuf, testlen); if (r != -1) { printf("returned %" PRId32 ", expected -1: \n", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); end: AppLayerParserRestoreParserTable(); diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index d79b5b9591..2e007a0959 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -1590,14 +1590,14 @@ int SMBParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_EOF, smbbuf, smblen); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -1667,14 +1667,14 @@ int SMBParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_EOF, smbbuf, smblen); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -1963,14 +1963,14 @@ int SMBParserTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -1983,22 +1983,22 @@ int SMBParserTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf2, smblen2); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf3, smblen3); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); printUUID("BIND", smb_state->dcerpc.dcerpcbindbindack.uuid_entry); result = 1; end: @@ -2080,14 +2080,14 @@ int SMBParserTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER|STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -2100,30 +2100,30 @@ int SMBParserTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf2, smblen2); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf3, smblen3); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf4, smblen4); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result = 1; end: @@ -2335,14 +2335,14 @@ int SMBParserTest07(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOCLIENT | STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -2409,14 +2409,14 @@ int SMBParserTest08(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOCLIENT | STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -2440,14 +2440,14 @@ int SMBParserTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOCLIENT, smbbuf2, smblen2); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smb_state->smb.command != SMB_COM_NEGOTIATE) { printf("we should expect SMB command 0x%02x , got 0x%02x : ", @@ -2523,14 +2523,14 @@ int SMBParserTest09(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER | STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -2554,14 +2554,14 @@ int SMBParserTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER, smbbuf2, smblen2); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smb_state->smb.command != SMB_COM_NEGOTIATE) { printf("we should expect SMB command 0x%02x , got 0x%02x : ", @@ -2645,14 +2645,14 @@ int SMBParserTest10(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOSERVER | STREAM_START, smbbuf1, smblen1); if (r != 0) { printf("smb header check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMBState *smb_state = f.alstate; if (smb_state == NULL) { @@ -2665,14 +2665,14 @@ int SMBParserTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB, STREAM_TOCLIENT, smbbuf2, smblen2); if (r == 0) { printf("smb parser didn't return fail\n"); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result = 1; end: diff --git a/src/app-layer-smb2.c b/src/app-layer-smb2.c index 7f5ea2051b..90a3698898 100644 --- a/src/app-layer-smb2.c +++ b/src/app-layer-smb2.c @@ -640,15 +640,15 @@ int SMB2ParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMB2, STREAM_TOSERVER|STREAM_EOF, smb2buf, smb2len); if (r != 0) { printf("smb2 header check returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMB2State *smb2_state = f.alstate; if (smb2_state == NULL) { diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index a28e299fb3..739511a134 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1797,15 +1797,15 @@ static int SMTPParserTest01(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -1819,15 +1819,15 @@ static int SMTPParserTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -1837,15 +1837,15 @@ static int SMTPParserTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -1854,15 +1854,15 @@ static int SMTPParserTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -1872,15 +1872,15 @@ static int SMTPParserTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2156,15 +2156,15 @@ static int SMTPParserTest02(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2178,15 +2178,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2196,15 +2196,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2213,15 +2213,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2231,15 +2231,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2248,15 +2248,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2266,15 +2266,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2283,15 +2283,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2301,15 +2301,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4, reply4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2319,15 +2319,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_1, request5_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2338,15 +2338,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_2, request5_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2357,15 +2357,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_3, request5_3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2376,15 +2376,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_4, request5_4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2395,15 +2395,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5_5, request5_5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2413,15 +2413,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply5, reply5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2430,15 +2430,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request6, request6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2448,15 +2448,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply6, reply6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2465,15 +2465,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request7, request7_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2483,15 +2483,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply7, reply7_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2500,15 +2500,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request8, request8_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2518,15 +2518,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply8, reply8_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2536,15 +2536,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_1, request9_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2555,15 +2555,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_2, request9_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2574,15 +2574,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_3, request9_3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2593,15 +2593,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_4, request9_4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2612,15 +2612,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request9_5, request9_5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2630,15 +2630,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply9, reply9_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2647,15 +2647,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request10, request10_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2665,15 +2665,15 @@ static int SMTPParserTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply10, reply10_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2791,15 +2791,15 @@ static int SMTPParserTest03(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2813,15 +2813,15 @@ static int SMTPParserTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -2831,15 +2831,15 @@ static int SMTPParserTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2848,15 +2848,15 @@ static int SMTPParserTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 3 || smtp_state->cmds_idx != 0 || @@ -2868,15 +2868,15 @@ static int SMTPParserTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -2939,15 +2939,15 @@ static int SMTPParserTest04(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -2961,15 +2961,15 @@ static int SMTPParserTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3087,15 +3087,15 @@ static int SMTPParserTest05(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3109,15 +3109,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3127,15 +3127,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3144,15 +3144,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3162,15 +3162,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3186,15 +3186,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3204,15 +3204,15 @@ static int SMTPParserTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3384,15 +3384,15 @@ static int SMTPParserTest06(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3406,15 +3406,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3424,15 +3424,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3441,15 +3441,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3459,15 +3459,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3476,15 +3476,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3494,15 +3494,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -3511,15 +3511,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3532,15 +3532,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5, request5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3552,15 +3552,15 @@ static int SMTPParserTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request6, request6_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -3623,15 +3623,15 @@ static int SMTPParserTest07(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_1, request1_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3647,15 +3647,15 @@ static int SMTPParserTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_2, request1_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 1 || smtp_state->ts_db == NULL || smtp_state->ts_db_len != (int32_t)strlen(request1_str) || @@ -3666,15 +3666,15 @@ static int SMTPParserTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 0 || smtp_state->ts_db != NULL || smtp_state->ts_db_len != 0 || @@ -3737,15 +3737,15 @@ static int SMTPParserTest08(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_1, request1_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3761,15 +3761,15 @@ static int SMTPParserTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_2, request1_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 1 || smtp_state->ts_db == NULL || smtp_state->ts_db_len != (int32_t)strlen(request1_str) || @@ -3780,15 +3780,15 @@ static int SMTPParserTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 0 || smtp_state->ts_db != NULL || smtp_state->ts_db_len != 0 || @@ -3851,15 +3851,15 @@ static int SMTPParserTest09(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_1, request1_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3875,15 +3875,15 @@ static int SMTPParserTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_2, request1_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 1 || smtp_state->ts_db == NULL || smtp_state->ts_db_len != (int32_t)strlen(request1_str) || @@ -3894,15 +3894,15 @@ static int SMTPParserTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 0 || smtp_state->ts_db != NULL || smtp_state->ts_db_len != 0 || @@ -3965,15 +3965,15 @@ static int SMTPParserTest10(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_1, request1_1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -3989,15 +3989,15 @@ static int SMTPParserTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1_2, request1_2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 1 || smtp_state->ts_db == NULL || smtp_state->ts_db_len != (int32_t)strlen(request1_str) || @@ -4008,15 +4008,15 @@ static int SMTPParserTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 0 || smtp_state->ts_db != NULL || smtp_state->ts_db_len != 0 || @@ -4073,15 +4073,15 @@ static int SMTPParserTest11(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -4097,15 +4097,15 @@ static int SMTPParserTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->ts_current_line_db != 0 || smtp_state->ts_db != NULL || smtp_state->ts_db_len != 0 || @@ -4188,15 +4188,15 @@ static int SMTPParserTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER | STREAM_START, request1, request1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { @@ -4212,15 +4212,15 @@ static int SMTPParserTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT | STREAM_TOCLIENT, reply1, reply1_len); if (r == 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -4329,15 +4329,15 @@ static int SMTPParserTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER | STREAM_START, request1, request1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { @@ -4353,15 +4353,15 @@ static int SMTPParserTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -4371,15 +4371,15 @@ static int SMTPParserTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -4591,16 +4591,16 @@ static int SMTPParserTest14(void) StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* Welcome reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, welcome_reply, welcome_reply_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SMTPState *smtp_state = f.alstate; if (smtp_state == NULL) { printf("no smtp state: "); @@ -4614,15 +4614,15 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -4632,23 +4632,23 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* EHLO Reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply1, reply1_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } if ((smtp_state->helo_len != 7) || strncmp("boo.com", (char *)smtp_state->helo, 7)) { printf("incorrect parsing of HELO field '%s' (%d)\n", smtp_state->helo, smtp_state->helo_len); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -4657,16 +4657,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* MAIL FROM Request */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request2, request2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -4676,13 +4676,13 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* MAIL FROM Reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply2, reply2_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -4691,11 +4691,11 @@ static int SMTPParserTest14(void) printf("incorrect parsing of MAIL FROM field '%s' (%d)\n", smtp_state->curr_tx->mail_from, smtp_state->curr_tx->mail_from_len); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -4704,16 +4704,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* RCPT TO Request */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request3, request3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -4723,16 +4723,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* RCPT TO Reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply3, reply3_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -4747,16 +4747,16 @@ static int SMTPParserTest14(void) smtp_config.mime_config.decode_quoted_printable = 1; MimeDecSetConfig(&smtp_config.mime_config); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* DATA request */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4, request4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || @@ -4767,16 +4767,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* Data reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4, reply4_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -4786,16 +4786,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* DATA message */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4_msg, request4_msg_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || @@ -4807,16 +4807,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* DATA . request */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request4_end, request4_end_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || @@ -4868,16 +4868,16 @@ static int SMTPParserTest14(void) } } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* DATA . reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply4_end, reply4_end_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || @@ -4886,16 +4886,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* QUIT Request */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, request5, request5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 1 || smtp_state->cmds_idx != 0 || @@ -4905,16 +4905,16 @@ static int SMTPParserTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* QUIT Reply */ r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOCLIENT, reply5, reply5_len); if (r != 0) { printf("smtp check returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (smtp_state->input_len != 0 || smtp_state->cmds_cnt != 0 || smtp_state->cmds_idx != 0 || diff --git a/src/app-layer-ssh.c b/src/app-layer-ssh.c index 98b5c76a54..823c3080a2 100644 --- a/src/app-layer-ssh.c +++ b/src/app-layer-ssh.c @@ -561,14 +561,14 @@ static int SSHParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER|STREAM_EOF, sshbuf, sshlen); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -627,14 +627,14 @@ static int SSHParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER|STREAM_EOF, sshbuf, sshlen); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -693,14 +693,14 @@ static int SSHParserTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER|STREAM_EOF, sshbuf, sshlen); if (r == 0) { printf("toclient chunk 1 returned %" PRId32 ", expected != 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -745,14 +745,14 @@ static int SSHParserTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT|STREAM_EOF, sshbuf, sshlen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -811,14 +811,14 @@ static int SSHParserTest05(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT|STREAM_EOF, sshbuf, sshlen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -876,14 +876,14 @@ static int SSHParserTest06(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT|STREAM_EOF, sshbuf, sshlen); if (r == 0) { printf("toserver chunk 1 returned %" PRId32 ", expected != 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* Ok, it returned an error. Let's make sure we didn't parse the string at all */ SshState *ssh_state = f.alstate; @@ -930,23 +930,23 @@ static int SSHParserTest07(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1008,32 +1008,32 @@ static int SSHParserTest08(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1091,23 +1091,23 @@ static int SSHParserTest09(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1169,32 +1169,32 @@ static int SSHParserTest10(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1253,23 +1253,23 @@ static int SSHParserTest11(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1335,32 +1335,32 @@ static int SSHParserTest12(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1427,33 +1427,33 @@ static int SSHParserTest13(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); for (u = 0; u < sshlen2; u++) { - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, &sshbuf2[u], 1); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); } for (u = 0; u < sshlen3; u++) { - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, &sshbuf3[u], 1); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); } SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1526,46 +1526,46 @@ static int SSHParserTest14(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf5, sshlen5); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1638,46 +1638,46 @@ static int SSHParserTest15(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); - SCMutexLock(&f.m); + FLOWLOCK_UNLOCK(&f); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf5, sshlen5); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1743,32 +1743,32 @@ static int SSHParserTest16(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1836,41 +1836,41 @@ static int SSHParserTest17(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -1946,50 +1946,50 @@ static int SSHParserTest18(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, server1, serverlen1); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, server2, serverlen2); if (r != 0) { printf("toclient chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -2052,41 +2052,41 @@ static int SSHParserTest19(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -2172,42 +2172,42 @@ static int SSHParserTest20(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCLogDebug("chunk 4:"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -2279,42 +2279,42 @@ static int SSHParserTest21(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCLogDebug("chunk 4:"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -2414,42 +2414,42 @@ static int SSHParserTest22(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); #if 0 SCLogDebug("chunk 4:"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOCLIENT, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); #endif SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -2506,14 +2506,14 @@ static int SSHParserTest23(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER|STREAM_EOF, sshbuf, sshlen); if (r == 0) { printf("toclient chunk 1 returned 0 expected non null: "); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); result = 1; end: @@ -2539,14 +2539,14 @@ static int SSHParserTest24(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER|STREAM_EOF, sshbuf, sshlen); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 1107fb2f8a..3470977737 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -1816,15 +1816,15 @@ static int SSLParserTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_EOF, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -1872,25 +1872,25 @@ static int SSLParserTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -1940,35 +1940,35 @@ static int SSLParserTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2020,45 +2020,45 @@ static int SSLParserTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2364,15 +2364,15 @@ static int SSLParserMultimsgTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2445,15 +2445,15 @@ static int SSLParserMultimsgTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2515,15 +2515,15 @@ static int SSLParserTest07(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf, tlslen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2701,25 +2701,25 @@ static int SSLParserTest09(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2789,25 +2789,25 @@ static int SSLParserTest10(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2876,25 +2876,25 @@ static int SSLParserTest11(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -2968,35 +2968,35 @@ static int SSLParserTest12(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf3, buf3_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -3075,45 +3075,45 @@ static int SSLParserTest13(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf3, buf3_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf4, buf4_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -3171,25 +3171,25 @@ static int SSLParserTest14(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -3228,15 +3228,15 @@ static int SSLParserTest15(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r == 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); end: if (alp_tctx != NULL) @@ -3268,15 +3268,15 @@ static int SSLParserTest16(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r == 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); end: if (alp_tctx != NULL) @@ -3308,15 +3308,15 @@ static int SSLParserTest17(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r == 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); end: if (alp_tctx != NULL) @@ -3354,25 +3354,25 @@ static int SSLParserTest18(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -3412,15 +3412,15 @@ static int SSLParserTest19(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -3460,15 +3460,15 @@ static int SSLParserTest20(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r == 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); end: if (alp_tctx != NULL) @@ -3502,15 +3502,15 @@ static int SSLParserTest21(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_EOF, buf, buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { @@ -3569,16 +3569,16 @@ static int SSLParserTest22(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT | STREAM_EOF, buf, buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { @@ -3874,16 +3874,16 @@ static int SSLParserTest23(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_START, chello_buf, chello_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { @@ -3915,16 +3915,16 @@ static int SSLParserTest23(void) } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, shello_buf, shello_buf_len); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (app_state->server_connp.content_type != SSLV3_HANDSHAKE_PROTOCOL) { printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", @@ -3949,16 +3949,16 @@ static int SSLParserTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_change_cipher_spec_buf, client_change_cipher_spec_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* with multiple records the client content type hold the type from the last * record */ @@ -3988,16 +3988,16 @@ static int SSLParserTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_change_cipher_spec_buf, server_change_cipher_spec_buf_len); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* with multiple records the serve content type hold the type from the last * record */ @@ -4029,16 +4029,16 @@ static int SSLParserTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, toserver_app_data_buf, toserver_app_data_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (app_state->client_connp.content_type != SSLV3_APPLICATION_PROTOCOL) { printf("expected content_type %" PRIu8 ", got %" PRIu8 ": ", @@ -4122,25 +4122,25 @@ static int SSLParserTest24(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf1, buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf2, buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -4501,14 +4501,14 @@ static int SSLParserTest25(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, client_hello_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -4523,16 +4523,16 @@ static int SSLParserTest25(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello_certificate_done, server_hello_certificate_done_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); if (ssl_state->client_connp.bytes_processed != 0 || ssl_state->client_connp.hs_bytes_processed != 0) @@ -4541,16 +4541,16 @@ static int SSLParserTest25(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_key_exchange_cipher_enc_hs, client_key_exchange_cipher_enc_hs_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* The reason hs_bytes_processed is 2 is because, the record * immediately after the client key exchange is 2 bytes long, diff --git a/src/detect-dce-iface.c b/src/detect-dce-iface.c index 6a712041ba..10cf7f5e6b 100644 --- a/src/detect-dce-iface.c +++ b/src/detect-dce-iface.c @@ -894,15 +894,15 @@ static int DetectDceIfaceTestParse12(void) SCLogDebug("handling to_server chunk"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -920,15 +920,15 @@ static int DetectDceIfaceTestParse12(void) SCLogDebug("handling to_client chunk"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -938,15 +938,15 @@ static int DetectDceIfaceTestParse12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1400,15 +1400,15 @@ static int DetectDceIfaceTestParse14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1422,15 +1422,15 @@ static int DetectDceIfaceTestParse14(void) if (PacketAlertCheck(p, 1)) goto end; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1440,15 +1440,15 @@ static int DetectDceIfaceTestParse14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1610,15 +1610,15 @@ static int DetectDceIfaceTestParse15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1634,15 +1634,15 @@ static int DetectDceIfaceTestParse15(void) if (PacketAlertCheck(p, 2)) goto end; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1656,15 +1656,15 @@ static int DetectDceIfaceTestParse15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_alter_context, dcerpc_alter_context_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1678,15 +1678,15 @@ static int DetectDceIfaceTestParse15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_alter_context_resp, dcerpc_alter_context_resp_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1700,15 +1700,15 @@ static int DetectDceIfaceTestParse15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request1, dcerpc_request1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1722,15 +1722,15 @@ static int DetectDceIfaceTestParse15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response1, dcerpc_response1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1744,15 +1744,15 @@ static int DetectDceIfaceTestParse15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request2, dcerpc_request2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-dce-opnum.c b/src/detect-dce-opnum.c index 50544fd14b..f5d3f1d55e 100644 --- a/src/detect-dce-opnum.c +++ b/src/detect-dce-opnum.c @@ -1160,15 +1160,15 @@ static int DetectDceOpnumTestParse08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1176,25 +1176,25 @@ static int DetectDceOpnumTestParse08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_EOF, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1699,15 +1699,15 @@ static int DetectDceOpnumTestParse09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { diff --git a/src/detect-dce-stub-data.c b/src/detect-dce-stub-data.c index 987a9b9fa3..d39ed27786 100644 --- a/src/detect-dce-stub-data.c +++ b/src/detect-dce-stub-data.c @@ -620,15 +620,15 @@ static int DetectDceStubDataTestParse02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -646,15 +646,15 @@ static int DetectDceStubDataTestParse02(void) goto end; /* do detect */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -665,15 +665,15 @@ static int DetectDceStubDataTestParse02(void) if (PacketAlertCheck(p, 1)) goto end; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_EOF, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1175,15 +1175,15 @@ static int DetectDceStubDataTestParse03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_request, dcerpc_request_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1381,15 +1381,15 @@ static int DetectDceStubDataTestParse04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_bind, dcerpc_bind_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1400,29 +1400,29 @@ static int DetectDceStubDataTestParse04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_bindack, dcerpc_bindack_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; SigMatchSignatures(&th_v, de_ctx, det_ctx, p); /* request1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request1, dcerpc_request1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1433,15 +1433,15 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response1, dcerpc_response1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1452,15 +1452,15 @@ static int DetectDceStubDataTestParse04(void) goto end; /* request2 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request2, dcerpc_request2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1471,15 +1471,15 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response2 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response2, dcerpc_response2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1490,15 +1490,15 @@ static int DetectDceStubDataTestParse04(void) goto end; /* request3 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request3, dcerpc_request3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1509,15 +1509,15 @@ static int DetectDceStubDataTestParse04(void) goto end; /* response3 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT | STREAM_EOF, dcerpc_response3, dcerpc_response3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1692,15 +1692,15 @@ static int DetectDceStubDataTestParse05(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER | STREAM_START, dcerpc_request1, dcerpc_request1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dcerpc_state = f.alstate; if (dcerpc_state == NULL) { @@ -1717,15 +1717,15 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response1, dcerpc_response1_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1736,15 +1736,15 @@ static int DetectDceStubDataTestParse05(void) goto end; /* request2 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request2, dcerpc_request2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1755,15 +1755,15 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response2 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT, dcerpc_response2, dcerpc_response2_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; @@ -1774,15 +1774,15 @@ static int DetectDceStubDataTestParse05(void) goto end; /* request3 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, dcerpc_request3, dcerpc_request3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOCLIENT; p->flowflags |= FLOW_PKT_TOSERVER; @@ -1793,15 +1793,15 @@ static int DetectDceStubDataTestParse05(void) goto end; /* response3 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOCLIENT | STREAM_EOF, dcerpc_response3, dcerpc_response3_len); if (r != 0) { SCLogDebug("AppLayerParse for dcerpc failed. Returned %" PRId32, r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); p->flowflags &=~ FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_TOCLIENT; diff --git a/src/detect-dns-query.c b/src/detect-dns-query.c index 9df4387154..2463fd2e94 100644 --- a/src/detect-dns-query.c +++ b/src/detect-dns-query.c @@ -149,14 +149,14 @@ static int DetectDnsQueryTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -287,14 +287,14 @@ static int DetectDnsQueryTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -314,14 +314,14 @@ static int DetectDnsQueryTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOCLIENT, buf2, sizeof(buf2)); if (r != 0) { printf("toserver client 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -335,14 +335,14 @@ static int DetectDnsQueryTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf3, sizeof(buf3)); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p3); @@ -433,14 +433,14 @@ static int DetectDnsQueryTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -539,14 +539,14 @@ static int DetectDnsQueryTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -562,14 +562,14 @@ static int DetectDnsQueryTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf2, sizeof(buf2)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -709,14 +709,14 @@ static int DetectDnsQueryTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -736,14 +736,14 @@ static int DetectDnsQueryTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf2, sizeof(buf2)); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -757,14 +757,14 @@ static int DetectDnsQueryTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOCLIENT, buf3, sizeof(buf3)); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p3); @@ -778,14 +778,14 @@ static int DetectDnsQueryTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf4, sizeof(buf4)); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p4); @@ -881,14 +881,14 @@ static int DetectDnsQueryTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -1030,14 +1030,14 @@ static int DetectDnsQueryTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf1, sizeof(buf1)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); dns_state = f.alstate; if (dns_state == NULL) { @@ -1057,14 +1057,14 @@ static int DetectDnsQueryTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOCLIENT, buf2, sizeof(buf2)); if (r != -1) { printf("toserver client 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -1082,14 +1082,14 @@ static int DetectDnsQueryTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DNS, STREAM_TOSERVER, buf3, sizeof(buf3)); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p3); diff --git a/src/detect-engine-dcepayload.c b/src/detect-engine-dcepayload.c index c28f05752a..79182f41ca 100644 --- a/src/detect-engine-dcepayload.c +++ b/src/detect-engine-dcepayload.c @@ -6538,15 +6538,15 @@ int DcePayloadTest15(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -6654,15 +6654,15 @@ int DcePayloadTest16(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -6770,15 +6770,15 @@ int DcePayloadTest17(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -6886,15 +6886,15 @@ int DcePayloadTest18(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -7002,15 +7002,15 @@ int DcePayloadTest19(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -7118,15 +7118,15 @@ int DcePayloadTest20(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -7223,15 +7223,15 @@ int DcePayloadTest21(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -7324,15 +7324,15 @@ int DcePayloadTest22(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -7426,15 +7426,15 @@ int DcePayloadTest23(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -9642,15 +9642,15 @@ int DcePayloadTest42(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -9744,15 +9744,15 @@ int DcePayloadTest43(void) DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); /* request 1 */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_DCERPC, STREAM_TOSERVER, request1, request1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* detection phase */ SigMatchSignatures(&tv, de_ctx, det_ctx, p); if ( !(PacketAlertCheck(p, 1))) { diff --git a/src/detect-engine-filedata-smtp.c b/src/detect-engine-filedata-smtp.c index e8bcf7769d..45b2e80a60 100644 --- a/src/detect-engine-filedata-smtp.c +++ b/src/detect-engine-filedata-smtp.c @@ -372,14 +372,14 @@ static int DetectEngineSMTPFiledataTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, mimemsg, mimemsg_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %d", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { @@ -504,21 +504,21 @@ static int DetectEngineSMTPFiledataTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = 0; r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, mimemsg1, mimemsg1_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %d", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SMTP, STREAM_TOSERVER, mimemsg2, mimemsg2_len); if (r != 0) { printf("AppLayerParse for smtp failed. Returned %d", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); smtp_state = f.alstate; if (smtp_state == NULL) { diff --git a/src/detect-engine-hcbd.c b/src/detect-engine-hcbd.c index fddfaa56d0..1e25976158 100644 --- a/src/detect-engine-hcbd.c +++ b/src/detect-engine-hcbd.c @@ -385,17 +385,17 @@ static int RunTest (struct TestSteps *steps, const char *sig, const char *yaml) p->flowflags |= FLOW_PKT_ESTABLISHED; p->flags |= PKT_HAS_FLOW|PKT_STREAM_EST; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, b->direction, (uint8_t *)b->input, b->input_size ? b->input_size : strlen((const char *)b->input)); if (r != 0) { printf("toserver chunk %d returned %" PRId32 ", expected 0: ", i+1, r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-engine-hcd.c b/src/detect-engine-hcd.c index f7ec7fca1a..6217a3bff8 100644 --- a/src/detect-engine-hcd.c +++ b/src/detect-engine-hcd.c @@ -249,15 +249,15 @@ static int DetectEngineHttpCookieTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -347,15 +347,15 @@ static int DetectEngineHttpCookieTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -445,15 +445,15 @@ static int DetectEngineHttpCookieTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -543,15 +543,15 @@ static int DetectEngineHttpCookieTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -641,15 +641,15 @@ static int DetectEngineHttpCookieTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -739,15 +739,15 @@ static int DetectEngineHttpCookieTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -837,15 +837,15 @@ static int DetectEngineHttpCookieTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -935,15 +935,15 @@ static int DetectEngineHttpCookieTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1033,15 +1033,15 @@ static int DetectEngineHttpCookieTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1132,15 +1132,15 @@ static int DetectEngineHttpCookieTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1231,15 +1231,15 @@ static int DetectEngineHttpCookieTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1330,15 +1330,15 @@ static int DetectEngineHttpCookieTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1429,15 +1429,15 @@ static int DetectEngineHttpCookieTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1528,15 +1528,15 @@ static int DetectEngineHttpCookieTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1627,15 +1627,15 @@ static int DetectEngineHttpCookieTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1726,15 +1726,15 @@ static int DetectEngineHttpCookieTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1825,15 +1825,15 @@ static int DetectEngineHttpCookieTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hhd.c b/src/detect-engine-hhd.c index d5863ecf4b..6d05b2837c 100644 --- a/src/detect-engine-hhd.c +++ b/src/detect-engine-hhd.c @@ -384,15 +384,15 @@ static int DetectEngineHttpHeaderTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -480,15 +480,15 @@ static int DetectEngineHttpHeaderTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -576,15 +576,15 @@ static int DetectEngineHttpHeaderTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -672,15 +672,15 @@ static int DetectEngineHttpHeaderTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -768,15 +768,15 @@ static int DetectEngineHttpHeaderTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -864,15 +864,15 @@ static int DetectEngineHttpHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -960,15 +960,15 @@ static int DetectEngineHttpHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1056,15 +1056,15 @@ static int DetectEngineHttpHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1152,15 +1152,15 @@ static int DetectEngineHttpHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1248,15 +1248,15 @@ static int DetectEngineHttpHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1344,15 +1344,15 @@ static int DetectEngineHttpHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1440,15 +1440,15 @@ static int DetectEngineHttpHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1536,15 +1536,15 @@ static int DetectEngineHttpHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1632,15 +1632,15 @@ static int DetectEngineHttpHeaderTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1728,15 +1728,15 @@ static int DetectEngineHttpHeaderTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1824,15 +1824,15 @@ static int DetectEngineHttpHeaderTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1920,15 +1920,15 @@ static int DetectEngineHttpHeaderTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2174,15 +2174,15 @@ static int DetectEngineHttpHeaderTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2199,15 +2199,15 @@ static int DetectEngineHttpHeaderTest20(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2298,15 +2298,15 @@ static int DetectEngineHttpHeaderTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2323,15 +2323,15 @@ static int DetectEngineHttpHeaderTest21(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2422,15 +2422,15 @@ static int DetectEngineHttpHeaderTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2447,15 +2447,15 @@ static int DetectEngineHttpHeaderTest22(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2546,15 +2546,15 @@ static int DetectEngineHttpHeaderTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2571,15 +2571,15 @@ static int DetectEngineHttpHeaderTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2670,15 +2670,15 @@ static int DetectEngineHttpHeaderTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2695,15 +2695,15 @@ static int DetectEngineHttpHeaderTest24(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2794,15 +2794,15 @@ static int DetectEngineHttpHeaderTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2819,15 +2819,15 @@ static int DetectEngineHttpHeaderTest25(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2918,15 +2918,15 @@ static int DetectEngineHttpHeaderTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2943,15 +2943,15 @@ static int DetectEngineHttpHeaderTest26(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3042,15 +3042,15 @@ static int DetectEngineHttpHeaderTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3067,15 +3067,15 @@ static int DetectEngineHttpHeaderTest27(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3170,16 +3170,16 @@ static int DetectEngineHttpHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3196,15 +3196,15 @@ static int DetectEngineHttpHeaderTest28(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3299,16 +3299,16 @@ static int DetectEngineHttpHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3325,15 +3325,15 @@ static int DetectEngineHttpHeaderTest29(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3461,16 +3461,16 @@ static int DetectEngineHttpHeaderTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3487,15 +3487,15 @@ static int DetectEngineHttpHeaderTest30(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3583,15 +3583,15 @@ static int DetectEngineHttpHeaderTest31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3686,15 +3686,15 @@ static int DetectEngineHttpHeaderTest32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3797,15 +3797,15 @@ static int DetectEngineHttpHeaderTest33(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3822,15 +3822,15 @@ static int DetectEngineHttpHeaderTest33(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-engine-hhhd.c b/src/detect-engine-hhhd.c index e0d8ac9e96..b3ab4aa893 100644 --- a/src/detect-engine-hhhd.c +++ b/src/detect-engine-hhhd.c @@ -214,15 +214,15 @@ static int DetectEngineHttpHHTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -312,15 +312,15 @@ static int DetectEngineHttpHHTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -410,15 +410,15 @@ static int DetectEngineHttpHHTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -508,15 +508,15 @@ static int DetectEngineHttpHHTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -606,15 +606,15 @@ static int DetectEngineHttpHHTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -704,15 +704,15 @@ static int DetectEngineHttpHHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -802,15 +802,15 @@ static int DetectEngineHttpHHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -900,15 +900,15 @@ static int DetectEngineHttpHHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -998,15 +998,15 @@ static int DetectEngineHttpHHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1097,15 +1097,15 @@ static int DetectEngineHttpHHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1196,15 +1196,15 @@ static int DetectEngineHttpHHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1295,15 +1295,15 @@ static int DetectEngineHttpHHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1394,15 +1394,15 @@ static int DetectEngineHttpHHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1493,15 +1493,15 @@ static int DetectEngineHttpHHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1592,15 +1592,15 @@ static int DetectEngineHttpHHTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1691,15 +1691,15 @@ static int DetectEngineHttpHHTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1790,15 +1790,15 @@ static int DetectEngineHttpHHTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1884,15 +1884,15 @@ static int DetectEngineHttpHHTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1978,15 +1978,15 @@ static int DetectEngineHttpHHTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2072,15 +2072,15 @@ static int DetectEngineHttpHHTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2165,15 +2165,15 @@ static int DetectEngineHttpHHTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2258,15 +2258,15 @@ static int DetectEngineHttpHHTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2351,15 +2351,15 @@ static int DetectEngineHttpHHTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2445,15 +2445,15 @@ static int DetectEngineHttpHHTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2539,15 +2539,15 @@ static int DetectEngineHttpHHTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hmd.c b/src/detect-engine-hmd.c index 00c7dc9904..924db480fe 100644 --- a/src/detect-engine-hmd.c +++ b/src/detect-engine-hmd.c @@ -205,15 +205,15 @@ static int DetectEngineHttpMethodTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -302,15 +302,15 @@ static int DetectEngineHttpMethodTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -399,15 +399,15 @@ static int DetectEngineHttpMethodTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -496,15 +496,15 @@ static int DetectEngineHttpMethodTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -593,15 +593,15 @@ static int DetectEngineHttpMethodTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -690,15 +690,15 @@ static int DetectEngineHttpMethodTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -787,15 +787,15 @@ static int DetectEngineHttpMethodTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -884,15 +884,15 @@ static int DetectEngineHttpMethodTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -981,15 +981,15 @@ static int DetectEngineHttpMethodTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1079,15 +1079,15 @@ static int DetectEngineHttpMethodTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1177,15 +1177,15 @@ static int DetectEngineHttpMethodTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1275,15 +1275,15 @@ static int DetectEngineHttpMethodTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1373,15 +1373,15 @@ static int DetectEngineHttpMethodTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1471,15 +1471,15 @@ static int DetectEngineHttpMethodTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1569,15 +1569,15 @@ static int DetectEngineHttpMethodTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1667,15 +1667,15 @@ static int DetectEngineHttpMethodTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1765,15 +1765,15 @@ static int DetectEngineHttpMethodTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hrhd.c b/src/detect-engine-hrhd.c index e4d6c5e20a..9c757a9dd2 100644 --- a/src/detect-engine-hrhd.c +++ b/src/detect-engine-hrhd.c @@ -256,15 +256,15 @@ static int DetectEngineHttpRawHeaderTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -352,15 +352,15 @@ static int DetectEngineHttpRawHeaderTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -448,15 +448,15 @@ static int DetectEngineHttpRawHeaderTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -544,15 +544,15 @@ static int DetectEngineHttpRawHeaderTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -640,15 +640,15 @@ static int DetectEngineHttpRawHeaderTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -736,15 +736,15 @@ static int DetectEngineHttpRawHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -832,15 +832,15 @@ static int DetectEngineHttpRawHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -928,15 +928,15 @@ static int DetectEngineHttpRawHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1024,15 +1024,15 @@ static int DetectEngineHttpRawHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1120,15 +1120,15 @@ static int DetectEngineHttpRawHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1216,15 +1216,15 @@ static int DetectEngineHttpRawHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1312,15 +1312,15 @@ static int DetectEngineHttpRawHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1408,15 +1408,15 @@ static int DetectEngineHttpRawHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1504,15 +1504,15 @@ static int DetectEngineHttpRawHeaderTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1600,15 +1600,15 @@ static int DetectEngineHttpRawHeaderTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1696,15 +1696,15 @@ static int DetectEngineHttpRawHeaderTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1792,15 +1792,15 @@ static int DetectEngineHttpRawHeaderTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2046,15 +2046,15 @@ static int DetectEngineHttpRawHeaderTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2071,15 +2071,15 @@ static int DetectEngineHttpRawHeaderTest20(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2170,15 +2170,15 @@ static int DetectEngineHttpRawHeaderTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2195,15 +2195,15 @@ static int DetectEngineHttpRawHeaderTest21(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2294,15 +2294,15 @@ static int DetectEngineHttpRawHeaderTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2319,15 +2319,15 @@ static int DetectEngineHttpRawHeaderTest22(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2418,15 +2418,15 @@ static int DetectEngineHttpRawHeaderTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2443,15 +2443,15 @@ static int DetectEngineHttpRawHeaderTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2542,15 +2542,15 @@ static int DetectEngineHttpRawHeaderTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2567,15 +2567,15 @@ static int DetectEngineHttpRawHeaderTest24(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2666,15 +2666,15 @@ static int DetectEngineHttpRawHeaderTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2691,15 +2691,15 @@ static int DetectEngineHttpRawHeaderTest25(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2790,15 +2790,15 @@ static int DetectEngineHttpRawHeaderTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2815,15 +2815,15 @@ static int DetectEngineHttpRawHeaderTest26(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2912,15 +2912,15 @@ static int DetectEngineHttpRawHeaderTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2937,15 +2937,15 @@ static int DetectEngineHttpRawHeaderTest27(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3040,16 +3040,16 @@ static int DetectEngineHttpRawHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3066,15 +3066,15 @@ static int DetectEngineHttpRawHeaderTest28(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3169,16 +3169,16 @@ static int DetectEngineHttpRawHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3195,15 +3195,15 @@ static int DetectEngineHttpRawHeaderTest29(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3325,15 +3325,15 @@ static int DetectEngineHttpRawHeaderTest31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3437,15 +3437,15 @@ static int DetectEngineHttpRawHeaderTest32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3462,15 +3462,15 @@ static int DetectEngineHttpRawHeaderTest32(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-engine-hrhhd.c b/src/detect-engine-hrhhd.c index b3c894dd4e..c5a51d6351 100644 --- a/src/detect-engine-hrhhd.c +++ b/src/detect-engine-hrhhd.c @@ -242,15 +242,15 @@ static int DetectEngineHttpHRHTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -340,15 +340,15 @@ static int DetectEngineHttpHRHTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -438,15 +438,15 @@ static int DetectEngineHttpHRHTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -536,15 +536,15 @@ static int DetectEngineHttpHRHTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -634,15 +634,15 @@ static int DetectEngineHttpHRHTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -732,15 +732,15 @@ static int DetectEngineHttpHRHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -830,15 +830,15 @@ static int DetectEngineHttpHRHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -928,15 +928,15 @@ static int DetectEngineHttpHRHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1026,15 +1026,15 @@ static int DetectEngineHttpHRHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1125,15 +1125,15 @@ static int DetectEngineHttpHRHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1224,15 +1224,15 @@ static int DetectEngineHttpHRHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1323,15 +1323,15 @@ static int DetectEngineHttpHRHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1422,15 +1422,15 @@ static int DetectEngineHttpHRHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1521,15 +1521,15 @@ static int DetectEngineHttpHRHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1620,15 +1620,15 @@ static int DetectEngineHttpHRHTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1719,15 +1719,15 @@ static int DetectEngineHttpHRHTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1818,15 +1818,15 @@ static int DetectEngineHttpHRHTest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1912,15 +1912,15 @@ static int DetectEngineHttpHRHTest18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2006,15 +2006,15 @@ static int DetectEngineHttpHRHTest19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2100,15 +2100,15 @@ static int DetectEngineHttpHRHTest20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2193,15 +2193,15 @@ static int DetectEngineHttpHRHTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2286,15 +2286,15 @@ static int DetectEngineHttpHRHTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2379,15 +2379,15 @@ static int DetectEngineHttpHRHTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2473,15 +2473,15 @@ static int DetectEngineHttpHRHTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2567,15 +2567,15 @@ static int DetectEngineHttpHRHTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hrl.c b/src/detect-engine-hrl.c index da1c14c577..09b3fa9822 100644 --- a/src/detect-engine-hrl.c +++ b/src/detect-engine-hrl.c @@ -161,14 +161,14 @@ static int UriTestSig01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -186,14 +186,14 @@ static int UriTestSig01(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -283,14 +283,14 @@ static int UriTestSig02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -308,14 +308,14 @@ static int UriTestSig02(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -405,14 +405,14 @@ static int UriTestSig03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -430,14 +430,14 @@ static int UriTestSig03(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -527,14 +527,14 @@ static int UriTestSig04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -552,14 +552,14 @@ static int UriTestSig04(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -649,14 +649,14 @@ static int UriTestSig05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -674,14 +674,14 @@ static int UriTestSig05(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -771,14 +771,14 @@ static int UriTestSig06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -796,14 +796,14 @@ static int UriTestSig06(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -893,14 +893,14 @@ static int UriTestSig07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -918,14 +918,14 @@ static int UriTestSig07(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1015,14 +1015,14 @@ static int UriTestSig08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1040,14 +1040,14 @@ static int UriTestSig08(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1137,14 +1137,14 @@ static int UriTestSig09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1162,14 +1162,14 @@ static int UriTestSig09(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1259,14 +1259,14 @@ static int UriTestSig10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1284,14 +1284,14 @@ static int UriTestSig10(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1382,14 +1382,14 @@ static int UriTestSig11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1407,14 +1407,14 @@ static int UriTestSig11(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1505,14 +1505,14 @@ static int UriTestSig12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1530,14 +1530,14 @@ static int UriTestSig12(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1627,14 +1627,14 @@ static int UriTestSig13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1652,14 +1652,14 @@ static int UriTestSig13(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1750,14 +1750,14 @@ static int UriTestSig14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1775,14 +1775,14 @@ static int UriTestSig14(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1873,14 +1873,14 @@ static int UriTestSig15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1898,14 +1898,14 @@ static int UriTestSig15(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1994,14 +1994,14 @@ static int UriTestSig16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2022,14 +2022,14 @@ static int UriTestSig16(void) p->payload = http_buf2; p->payload_len = http_buf2_len; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2117,14 +2117,14 @@ static int UriTestSig17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2212,14 +2212,14 @@ static int UriTestSig18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2308,14 +2308,14 @@ static int UriTestSig19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2403,14 +2403,14 @@ static int UriTestSig20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2497,14 +2497,14 @@ static int UriTestSig21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2591,14 +2591,14 @@ static int UriTestSig22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2684,14 +2684,14 @@ static int UriTestSig23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2777,14 +2777,14 @@ static int UriTestSig24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2870,14 +2870,14 @@ static int UriTestSig25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2963,14 +2963,14 @@ static int UriTestSig26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3056,14 +3056,14 @@ static int UriTestSig27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3183,14 +3183,14 @@ static int UriTestSig28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3275,14 +3275,14 @@ static int UriTestSig29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3367,14 +3367,14 @@ static int UriTestSig30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3459,14 +3459,14 @@ static int UriTestSig31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3551,14 +3551,14 @@ static int UriTestSig32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3641,14 +3641,14 @@ static int UriTestSig33(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3731,14 +3731,14 @@ static int UriTestSig34(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3821,14 +3821,14 @@ static int UriTestSig35(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3911,14 +3911,14 @@ static int UriTestSig36(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4001,14 +4001,14 @@ static int UriTestSig37(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4091,14 +4091,14 @@ static int UriTestSig38(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hrud.c b/src/detect-engine-hrud.c index 352923593e..5f83b35082 100644 --- a/src/detect-engine-hrud.c +++ b/src/detect-engine-hrud.c @@ -225,15 +225,15 @@ static int DetectEngineHttpRawUriTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -250,15 +250,15 @@ static int DetectEngineHttpRawUriTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -349,15 +349,15 @@ static int DetectEngineHttpRawUriTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -459,15 +459,15 @@ static int DetectEngineHttpRawUriTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -484,15 +484,15 @@ static int DetectEngineHttpRawUriTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -587,15 +587,15 @@ static int DetectEngineHttpRawUriTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -612,15 +612,15 @@ static int DetectEngineHttpRawUriTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -714,15 +714,15 @@ static int DetectEngineHttpRawUriTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -739,15 +739,15 @@ static int DetectEngineHttpRawUriTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -841,15 +841,15 @@ static int DetectEngineHttpRawUriTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -866,15 +866,15 @@ static int DetectEngineHttpRawUriTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -968,15 +968,15 @@ static int DetectEngineHttpRawUriTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -993,15 +993,15 @@ static int DetectEngineHttpRawUriTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1095,15 +1095,15 @@ static int DetectEngineHttpRawUriTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1120,15 +1120,15 @@ static int DetectEngineHttpRawUriTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1223,15 +1223,15 @@ static int DetectEngineHttpRawUriTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1248,15 +1248,15 @@ static int DetectEngineHttpRawUriTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1351,15 +1351,15 @@ static int DetectEngineHttpRawUriTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1376,15 +1376,15 @@ static int DetectEngineHttpRawUriTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1479,15 +1479,15 @@ static int DetectEngineHttpRawUriTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1504,15 +1504,15 @@ static int DetectEngineHttpRawUriTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1607,15 +1607,15 @@ static int DetectEngineHttpRawUriTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1632,15 +1632,15 @@ static int DetectEngineHttpRawUriTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1735,15 +1735,15 @@ static int DetectEngineHttpRawUriTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1760,15 +1760,15 @@ static int DetectEngineHttpRawUriTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1863,15 +1863,15 @@ static int DetectEngineHttpRawUriTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1888,15 +1888,15 @@ static int DetectEngineHttpRawUriTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1991,15 +1991,15 @@ static int DetectEngineHttpRawUriTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2016,15 +2016,15 @@ static int DetectEngineHttpRawUriTest15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2119,15 +2119,15 @@ static int DetectEngineHttpRawUriTest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2144,15 +2144,15 @@ static int DetectEngineHttpRawUriTest16(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2535,15 +2535,15 @@ static int DetectEngineHttpRawUriTest21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2560,15 +2560,15 @@ static int DetectEngineHttpRawUriTest21(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2663,15 +2663,15 @@ static int DetectEngineHttpRawUriTest22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2688,15 +2688,15 @@ static int DetectEngineHttpRawUriTest22(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2791,15 +2791,15 @@ static int DetectEngineHttpRawUriTest23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2816,15 +2816,15 @@ static int DetectEngineHttpRawUriTest23(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2919,15 +2919,15 @@ static int DetectEngineHttpRawUriTest24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2944,15 +2944,15 @@ static int DetectEngineHttpRawUriTest24(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3047,15 +3047,15 @@ static int DetectEngineHttpRawUriTest25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3072,15 +3072,15 @@ static int DetectEngineHttpRawUriTest25(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3175,15 +3175,15 @@ static int DetectEngineHttpRawUriTest26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3200,15 +3200,15 @@ static int DetectEngineHttpRawUriTest26(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3303,15 +3303,15 @@ static int DetectEngineHttpRawUriTest27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3328,15 +3328,15 @@ static int DetectEngineHttpRawUriTest27(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3431,15 +3431,15 @@ static int DetectEngineHttpRawUriTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3456,15 +3456,15 @@ static int DetectEngineHttpRawUriTest28(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3546,14 +3546,14 @@ static int DetectEngineHttpRawUriTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3639,14 +3639,14 @@ static int DetectEngineHttpRawUriTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-hsbd.c b/src/detect-engine-hsbd.c index 100134314e..298f594775 100644 --- a/src/detect-engine-hsbd.c +++ b/src/detect-engine-hsbd.c @@ -392,17 +392,17 @@ static int RunTest(struct TestSteps *steps, const char *sig, const char *yaml) p->flowflags |= FLOW_PKT_ESTABLISHED; p->flags |= PKT_HAS_FLOW|PKT_STREAM_EST; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, b->direction, (uint8_t *)b->input, b->input_size ? b->input_size : strlen((const char *)b->input)); if (r != 0) { printf("toserver chunk %d returned %" PRId32 ", expected 0: ", i+1, r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -508,15 +508,15 @@ static int DetectEngineHttpServerBodyTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -533,15 +533,15 @@ static int DetectEngineHttpServerBodyTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -630,25 +630,25 @@ static int DetectEngineHttpServerBodyTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -752,15 +752,15 @@ static int DetectEngineHttpServerBodyTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -777,25 +777,25 @@ static int DetectEngineHttpServerBodyTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -890,15 +890,15 @@ static int DetectEngineHttpServerBodyTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -915,15 +915,15 @@ static int DetectEngineHttpServerBodyTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1018,15 +1018,15 @@ static int DetectEngineHttpServerBodyTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1043,15 +1043,15 @@ static int DetectEngineHttpServerBodyTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1146,15 +1146,15 @@ static int DetectEngineHttpServerBodyTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1171,15 +1171,15 @@ static int DetectEngineHttpServerBodyTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1274,15 +1274,15 @@ static int DetectEngineHttpServerBodyTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1299,15 +1299,15 @@ static int DetectEngineHttpServerBodyTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1402,15 +1402,15 @@ static int DetectEngineHttpServerBodyTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1427,15 +1427,15 @@ static int DetectEngineHttpServerBodyTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1531,15 +1531,15 @@ static int DetectEngineHttpServerBodyTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1556,15 +1556,15 @@ static int DetectEngineHttpServerBodyTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1660,15 +1660,15 @@ static int DetectEngineHttpServerBodyTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1685,15 +1685,15 @@ static int DetectEngineHttpServerBodyTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1789,15 +1789,15 @@ static int DetectEngineHttpServerBodyTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1814,15 +1814,15 @@ static int DetectEngineHttpServerBodyTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1918,15 +1918,15 @@ static int DetectEngineHttpServerBodyTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1943,15 +1943,15 @@ static int DetectEngineHttpServerBodyTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2047,15 +2047,15 @@ static int DetectEngineHttpServerBodyTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2072,15 +2072,15 @@ static int DetectEngineHttpServerBodyTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2176,15 +2176,15 @@ static int DetectEngineHttpServerBodyTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2201,15 +2201,15 @@ static int DetectEngineHttpServerBodyTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2305,15 +2305,15 @@ static int DetectEngineHttpServerBodyTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2330,15 +2330,15 @@ static int DetectEngineHttpServerBodyTest15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2459,15 +2459,15 @@ libhtp:\n\ SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2484,15 +2484,15 @@ libhtp:\n\ goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2502,15 +2502,15 @@ libhtp:\n\ goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2635,15 +2635,15 @@ libhtp:\n\ SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2660,15 +2660,15 @@ libhtp:\n\ goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2678,15 +2678,15 @@ libhtp:\n\ goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3441,15 +3441,15 @@ static int DetectEngineHttpServerBodyFileDataTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3466,15 +3466,15 @@ static int DetectEngineHttpServerBodyFileDataTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3570,15 +3570,15 @@ static int DetectEngineHttpServerBodyFileDataTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3595,15 +3595,15 @@ static int DetectEngineHttpServerBodyFileDataTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3703,15 +3703,15 @@ static int DetectEngineHttpServerBodyFileDataTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3728,15 +3728,15 @@ static int DetectEngineHttpServerBodyFileDataTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-engine-hscd.c b/src/detect-engine-hscd.c index 7159835ab2..0d846ddd45 100644 --- a/src/detect-engine-hscd.c +++ b/src/detect-engine-hscd.c @@ -221,15 +221,15 @@ static int DetectEngineHttpStatCodeTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -246,15 +246,15 @@ static int DetectEngineHttpStatCodeTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -343,25 +343,25 @@ static int DetectEngineHttpStatCodeTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -465,15 +465,15 @@ static int DetectEngineHttpStatCodeTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -490,25 +490,25 @@ static int DetectEngineHttpStatCodeTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -603,15 +603,15 @@ static int DetectEngineHttpStatCodeTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -628,15 +628,15 @@ static int DetectEngineHttpStatCodeTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -731,15 +731,15 @@ static int DetectEngineHttpStatCodeTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -756,15 +756,15 @@ static int DetectEngineHttpStatCodeTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -859,15 +859,15 @@ static int DetectEngineHttpStatCodeTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -884,15 +884,15 @@ static int DetectEngineHttpStatCodeTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -987,15 +987,15 @@ static int DetectEngineHttpStatCodeTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1012,15 +1012,15 @@ static int DetectEngineHttpStatCodeTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1115,15 +1115,15 @@ static int DetectEngineHttpStatCodeTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1140,15 +1140,15 @@ static int DetectEngineHttpStatCodeTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1244,15 +1244,15 @@ static int DetectEngineHttpStatCodeTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1269,15 +1269,15 @@ static int DetectEngineHttpStatCodeTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1373,15 +1373,15 @@ static int DetectEngineHttpStatCodeTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1398,15 +1398,15 @@ static int DetectEngineHttpStatCodeTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1502,15 +1502,15 @@ static int DetectEngineHttpStatCodeTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1527,15 +1527,15 @@ static int DetectEngineHttpStatCodeTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1631,15 +1631,15 @@ static int DetectEngineHttpStatCodeTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1656,15 +1656,15 @@ static int DetectEngineHttpStatCodeTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1760,15 +1760,15 @@ static int DetectEngineHttpStatCodeTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1785,15 +1785,15 @@ static int DetectEngineHttpStatCodeTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1889,15 +1889,15 @@ static int DetectEngineHttpStatCodeTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1914,15 +1914,15 @@ static int DetectEngineHttpStatCodeTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2018,15 +2018,15 @@ static int DetectEngineHttpStatCodeTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2043,15 +2043,15 @@ static int DetectEngineHttpStatCodeTest15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-engine-hsmd.c b/src/detect-engine-hsmd.c index 3d662c54af..e978c246b1 100644 --- a/src/detect-engine-hsmd.c +++ b/src/detect-engine-hsmd.c @@ -221,15 +221,15 @@ static int DetectEngineHttpStatMsgTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -246,15 +246,15 @@ static int DetectEngineHttpStatMsgTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -343,25 +343,25 @@ static int DetectEngineHttpStatMsgTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -465,15 +465,15 @@ static int DetectEngineHttpStatMsgTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -490,25 +490,25 @@ static int DetectEngineHttpStatMsgTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -603,15 +603,15 @@ static int DetectEngineHttpStatMsgTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -628,15 +628,15 @@ static int DetectEngineHttpStatMsgTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -731,15 +731,15 @@ static int DetectEngineHttpStatMsgTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -756,15 +756,15 @@ static int DetectEngineHttpStatMsgTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -859,15 +859,15 @@ static int DetectEngineHttpStatMsgTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -884,15 +884,15 @@ static int DetectEngineHttpStatMsgTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -987,15 +987,15 @@ static int DetectEngineHttpStatMsgTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1012,15 +1012,15 @@ static int DetectEngineHttpStatMsgTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1115,15 +1115,15 @@ static int DetectEngineHttpStatMsgTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1140,15 +1140,15 @@ static int DetectEngineHttpStatMsgTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1244,15 +1244,15 @@ static int DetectEngineHttpStatMsgTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1269,15 +1269,15 @@ static int DetectEngineHttpStatMsgTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1373,15 +1373,15 @@ static int DetectEngineHttpStatMsgTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1398,15 +1398,15 @@ static int DetectEngineHttpStatMsgTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1502,15 +1502,15 @@ static int DetectEngineHttpStatMsgTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1527,15 +1527,15 @@ static int DetectEngineHttpStatMsgTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1631,15 +1631,15 @@ static int DetectEngineHttpStatMsgTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1656,15 +1656,15 @@ static int DetectEngineHttpStatMsgTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1760,15 +1760,15 @@ static int DetectEngineHttpStatMsgTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1785,15 +1785,15 @@ static int DetectEngineHttpStatMsgTest13(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1889,15 +1889,15 @@ static int DetectEngineHttpStatMsgTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1914,15 +1914,15 @@ static int DetectEngineHttpStatMsgTest14(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2018,15 +2018,15 @@ static int DetectEngineHttpStatMsgTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2043,15 +2043,15 @@ static int DetectEngineHttpStatMsgTest15(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-engine-hua.c b/src/detect-engine-hua.c index acd00a2fed..b05e843f0b 100644 --- a/src/detect-engine-hua.c +++ b/src/detect-engine-hua.c @@ -216,15 +216,15 @@ static int DetectEngineHttpUATest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -314,15 +314,15 @@ static int DetectEngineHttpUATest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -412,15 +412,15 @@ static int DetectEngineHttpUATest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -510,15 +510,15 @@ static int DetectEngineHttpUATest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -608,15 +608,15 @@ static int DetectEngineHttpUATest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -706,15 +706,15 @@ static int DetectEngineHttpUATest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -804,15 +804,15 @@ static int DetectEngineHttpUATest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -902,15 +902,15 @@ static int DetectEngineHttpUATest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1000,15 +1000,15 @@ static int DetectEngineHttpUATest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1099,15 +1099,15 @@ static int DetectEngineHttpUATest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1198,15 +1198,15 @@ static int DetectEngineHttpUATest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1297,15 +1297,15 @@ static int DetectEngineHttpUATest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1396,15 +1396,15 @@ static int DetectEngineHttpUATest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1495,15 +1495,15 @@ static int DetectEngineHttpUATest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1594,15 +1594,15 @@ static int DetectEngineHttpUATest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1693,15 +1693,15 @@ static int DetectEngineHttpUATest16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1792,15 +1792,15 @@ static int DetectEngineHttpUATest17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-engine-modbus.c b/src/detect-engine-modbus.c index d1811d4616..8d53bf3936 100644 --- a/src/detect-engine-modbus.c +++ b/src/detect-engine-modbus.c @@ -380,15 +380,15 @@ static int DetectEngineInspectModbusTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readWriteMultipleRegistersReq, sizeof(readWriteMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -470,14 +470,14 @@ static int DetectEngineInspectModbusTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, forceListenOnlyMode, sizeof(forceListenOnlyMode)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -559,15 +559,15 @@ static int DetectEngineInspectModbusTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, encapsulatedInterfaceTransport, sizeof(encapsulatedInterfaceTransport)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -649,14 +649,14 @@ static int DetectEngineInspectModbusTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, unassigned, sizeof(unassigned)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -738,15 +738,15 @@ static int DetectEngineInspectModbusTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -828,15 +828,15 @@ static int DetectEngineInspectModbusTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readInputsRegistersReq, sizeof(readInputsRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -918,14 +918,14 @@ static int DetectEngineInspectModbusTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readCoilsReq, sizeof(readCoilsReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -1055,15 +1055,15 @@ static int DetectEngineInspectModbusTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readInputsRegistersReq, sizeof(readInputsRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { @@ -1240,15 +1240,15 @@ static int DetectEngineInspectModbusTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER, readWriteMultipleRegistersReq, sizeof(readWriteMultipleRegistersReq)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ModbusState *modbus_state = f.alstate; if (modbus_state == NULL) { diff --git a/src/detect-engine-state.c b/src/detect-engine-state.c index 4fa24ea51a..1f38a5c928 100644 --- a/src/detect-engine-state.c +++ b/src/detect-engine-state.c @@ -1442,14 +1442,14 @@ static int DeStateSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1458,14 +1458,14 @@ static int DeStateSigTest01(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1474,14 +1474,14 @@ static int DeStateSigTest01(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -1490,15 +1490,15 @@ static int DeStateSigTest01(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1594,14 +1594,14 @@ static int DeStateSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1610,14 +1610,14 @@ static int DeStateSigTest02(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1626,14 +1626,14 @@ static int DeStateSigTest02(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1654,15 +1654,15 @@ static int DeStateSigTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 1))) { @@ -1671,14 +1671,14 @@ static int DeStateSigTest02(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -1687,14 +1687,14 @@ static int DeStateSigTest02(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if ((PacketAlertCheck(p, 1)) || (PacketAlertCheck(p, 2))) { @@ -1705,14 +1705,14 @@ static int DeStateSigTest02(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf7, httplen7); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (!(PacketAlertCheck(p, 2))) { @@ -1799,15 +1799,15 @@ static int DeStateSigTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1828,15 +1828,15 @@ static int DeStateSigTest03(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); FileContainer *files = AppLayerParserGetFiles(p->flow->proto, p->flow->alproto, p->flow->alstate, STREAM_TOSERVER); if (files == NULL) { printf("no stored files: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); File *file = files->head; if (file == NULL) { @@ -1926,15 +1926,15 @@ static int DeStateSigTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1955,15 +1955,15 @@ static int DeStateSigTest04(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); FileContainer *files = AppLayerParserGetFiles(p->flow->proto, p->flow->alproto, p->flow->alstate, STREAM_TOSERVER); if (files == NULL) { printf("no stored files: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); File *file = files->head; if (file == NULL) { @@ -2053,15 +2053,15 @@ static int DeStateSigTest05(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2082,15 +2082,15 @@ static int DeStateSigTest05(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); FileContainer *files = AppLayerParserGetFiles(p->flow->proto, p->flow->alproto, p->flow->alstate, STREAM_TOSERVER); if (files == NULL) { printf("no stored files: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); File *file = files->head; if (file == NULL) { @@ -2180,15 +2180,15 @@ static int DeStateSigTest06(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2209,15 +2209,15 @@ static int DeStateSigTest06(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); FileContainer *files = AppLayerParserGetFiles(p->flow->proto, p->flow->alproto, p->flow->alstate, STREAM_TOSERVER); if (files == NULL) { printf("no stored files: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); File *file = files->head; if (file == NULL) { @@ -2310,15 +2310,15 @@ static int DeStateSigTest07(void) StreamTcpInitConfig(TRUE); SCLogDebug("\n>>>> processing chunk 1 <<<<\n"); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); int r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2328,15 +2328,15 @@ static int DeStateSigTest07(void) } SCLogDebug("\n>>>> processing chunk 2 size %u <<<<\n", httplen2); - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); r = AppLayerParserParse(alp_tctx, f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_EOF, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { @@ -2356,15 +2356,15 @@ static int DeStateSigTest07(void) goto end; } - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); FileContainer *files = AppLayerParserGetFiles(p->flow->proto, p->flow->alproto, p->flow->alstate, STREAM_TOSERVER); if (files == NULL) { printf("no stored files: "); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); goto end; } - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); File *file = files->head; if (file == NULL) { diff --git a/src/detect-engine-uri.c b/src/detect-engine-uri.c index 81504bcb66..09bd2b9927 100644 --- a/src/detect-engine-uri.c +++ b/src/detect-engine-uri.c @@ -226,14 +226,14 @@ static int UriTestSig01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -251,14 +251,14 @@ static int UriTestSig01(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -348,14 +348,14 @@ static int UriTestSig02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -373,14 +373,14 @@ static int UriTestSig02(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -470,14 +470,14 @@ static int UriTestSig03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -495,14 +495,14 @@ static int UriTestSig03(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -592,14 +592,14 @@ static int UriTestSig04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -617,14 +617,14 @@ static int UriTestSig04(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -714,14 +714,14 @@ static int UriTestSig05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -739,14 +739,14 @@ static int UriTestSig05(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -836,14 +836,14 @@ static int UriTestSig06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -861,14 +861,14 @@ static int UriTestSig06(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -958,14 +958,14 @@ static int UriTestSig07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -983,14 +983,14 @@ static int UriTestSig07(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1080,14 +1080,14 @@ static int UriTestSig08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1105,14 +1105,14 @@ static int UriTestSig08(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1202,14 +1202,14 @@ static int UriTestSig09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1227,14 +1227,14 @@ static int UriTestSig09(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1324,14 +1324,14 @@ static int UriTestSig10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1349,14 +1349,14 @@ static int UriTestSig10(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1447,14 +1447,14 @@ static int UriTestSig11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1472,14 +1472,14 @@ static int UriTestSig11(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1570,14 +1570,14 @@ static int UriTestSig12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1595,14 +1595,14 @@ static int UriTestSig12(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1692,14 +1692,14 @@ static int UriTestSig13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1717,14 +1717,14 @@ static int UriTestSig13(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1815,14 +1815,14 @@ static int UriTestSig14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1840,14 +1840,14 @@ static int UriTestSig14(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1938,14 +1938,14 @@ static int UriTestSig15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1963,14 +1963,14 @@ static int UriTestSig15(void) DetectEngineStateReset(f.de_state, STREAM_TOSERVER | STREAM_TOCLIENT); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2059,14 +2059,14 @@ static int UriTestSig16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2087,14 +2087,14 @@ static int UriTestSig16(void) p->payload = http_buf2; p->payload_len = http_buf2_len; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2182,14 +2182,14 @@ static int UriTestSig17(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2277,14 +2277,14 @@ static int UriTestSig18(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2373,14 +2373,14 @@ static int UriTestSig19(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2468,14 +2468,14 @@ static int UriTestSig20(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2562,14 +2562,14 @@ static int UriTestSig21(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2656,14 +2656,14 @@ static int UriTestSig22(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2749,14 +2749,14 @@ static int UriTestSig23(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2842,14 +2842,14 @@ static int UriTestSig24(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2935,14 +2935,14 @@ static int UriTestSig25(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3028,14 +3028,14 @@ static int UriTestSig26(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3121,14 +3121,14 @@ static int UriTestSig27(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3248,14 +3248,14 @@ static int UriTestSig28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3340,14 +3340,14 @@ static int UriTestSig29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3432,14 +3432,14 @@ static int UriTestSig30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3524,14 +3524,14 @@ static int UriTestSig31(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3616,14 +3616,14 @@ static int UriTestSig32(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3706,14 +3706,14 @@ static int UriTestSig33(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3796,14 +3796,14 @@ static int UriTestSig34(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3886,14 +3886,14 @@ static int UriTestSig35(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3976,14 +3976,14 @@ static int UriTestSig36(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4066,14 +4066,14 @@ static int UriTestSig37(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -4156,14 +4156,14 @@ static int UriTestSig38(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_buf_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-ftpbounce.c b/src/detect-ftpbounce.c index f293ca970d..c4dea5cb21 100644 --- a/src/detect-ftpbounce.c +++ b/src/detect-ftpbounce.c @@ -329,12 +329,12 @@ static int DetectFtpbounceTestALMatch02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -342,7 +342,7 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -350,7 +350,7 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -358,11 +358,11 @@ static int DetectFtpbounceTestALMatch02(void) if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { @@ -470,12 +470,12 @@ static int DetectFtpbounceTestALMatch03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v,(void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_FTP, STREAM_TOSERVER, ftpbuf1, ftplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -483,7 +483,7 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -491,7 +491,7 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -499,10 +499,10 @@ static int DetectFtpbounceTestALMatch03(void) if (r != 0) { SCLogDebug("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FtpState *ftp_state = f.alstate; if (ftp_state == NULL) { diff --git a/src/detect-http-client-body.c b/src/detect-http-client-body.c index 24eb5175c9..600d74cfca 100644 --- a/src/detect-http-client-body.c +++ b/src/detect-http-client-body.c @@ -344,15 +344,15 @@ static int DetectHttpClientBodyTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -455,15 +455,15 @@ static int DetectHttpClientBodyTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -479,14 +479,14 @@ static int DetectHttpClientBodyTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -582,15 +582,15 @@ static int DetectHttpClientBodyTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -607,15 +607,15 @@ static int DetectHttpClientBodyTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -712,15 +712,15 @@ static int DetectHttpClientBodyTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -737,15 +737,15 @@ static int DetectHttpClientBodyTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -842,15 +842,15 @@ static int DetectHttpClientBodyTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -867,15 +867,15 @@ static int DetectHttpClientBodyTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -963,15 +963,15 @@ static int DetectHttpClientBodyTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1065,15 +1065,15 @@ static int DetectHttpClientBodyTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1167,15 +1167,15 @@ static int DetectHttpClientBodyTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1275,14 +1275,14 @@ static int DetectHttpClientBodyTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1292,32 +1292,32 @@ static int DetectHttpClientBodyTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1)) { printf("sig 1 alerted (2): "); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1327,15 +1327,15 @@ static int DetectHttpClientBodyTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1345,14 +1345,14 @@ static int DetectHttpClientBodyTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1362,14 +1362,14 @@ static int DetectHttpClientBodyTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1381,14 +1381,14 @@ static int DetectHttpClientBodyTest14(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf7, httplen7); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1494,14 +1494,14 @@ static int DetectHttpClientBodyTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1511,14 +1511,14 @@ static int DetectHttpClientBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1528,14 +1528,14 @@ static int DetectHttpClientBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1545,15 +1545,15 @@ static int DetectHttpClientBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1563,14 +1563,14 @@ static int DetectHttpClientBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1580,14 +1580,14 @@ static int DetectHttpClientBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1599,14 +1599,14 @@ static int DetectHttpClientBodyTest15(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf7, httplen7); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-http-cookie.c b/src/detect-http-cookie.c index d430988892..635d78fccb 100644 --- a/src/detect-http-cookie.c +++ b/src/detect-http-cookie.c @@ -370,15 +370,15 @@ static int DetectHttpCookieSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -469,15 +469,15 @@ static int DetectHttpCookieSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -562,15 +562,15 @@ static int DetectHttpCookieSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -656,15 +656,15 @@ static int DetectHttpCookieSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -750,15 +750,15 @@ static int DetectHttpCookieSigTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -845,14 +845,14 @@ static int DetectHttpCookieSigTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -937,15 +937,15 @@ static int DetectHttpCookieSigTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1048,16 +1048,16 @@ static int DetectHttpCookieSigTest08(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf_request, httpbuf_request_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1072,16 +1072,16 @@ static int DetectHttpCookieSigTest08(void) } /* response */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf_response, httpbuf_response_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1185,16 +1185,16 @@ static int DetectHttpCookieSigTest09(void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* request */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf_request, httpbuf_request_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1209,16 +1209,16 @@ static int DetectHttpCookieSigTest09(void) } /* response */ - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf_response, httpbuf_response_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-http-header.c b/src/detect-http-header.c index 39474ed9c9..8459d5ab1e 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -351,15 +351,15 @@ static int DetectHttpHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -460,15 +460,15 @@ static int DetectHttpHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -485,15 +485,15 @@ static int DetectHttpHeaderTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -587,15 +587,15 @@ static int DetectHttpHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -612,15 +612,15 @@ static int DetectHttpHeaderTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -716,15 +716,15 @@ static int DetectHttpHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -741,15 +741,15 @@ static int DetectHttpHeaderTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -844,15 +844,15 @@ static int DetectHttpHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -869,15 +869,15 @@ static int DetectHttpHeaderTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -964,15 +964,15 @@ static int DetectHttpHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1065,15 +1065,15 @@ static int DetectHttpHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1167,15 +1167,15 @@ static int DetectHttpHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1574,15 +1574,15 @@ static int DetectHttpHeaderTest28(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1661,15 +1661,15 @@ static int DetectHttpHeaderTest29(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1748,15 +1748,15 @@ static int DetectHttpHeaderTest30(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-http-hh.c b/src/detect-http-hh.c index 4de340a14a..6345241826 100644 --- a/src/detect-http-hh.c +++ b/src/detect-http-hh.c @@ -329,15 +329,15 @@ static int DetectHttpHHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -436,15 +436,15 @@ static int DetectHttpHHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -460,14 +460,14 @@ static int DetectHttpHHTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -559,15 +559,15 @@ static int DetectHttpHHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -584,15 +584,15 @@ static int DetectHttpHHTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -689,15 +689,15 @@ static int DetectHttpHHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -714,15 +714,15 @@ static int DetectHttpHHTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -819,15 +819,15 @@ static int DetectHttpHHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -844,15 +844,15 @@ static int DetectHttpHHTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ @@ -939,15 +939,15 @@ static int DetectHttpHHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1038,15 +1038,15 @@ static int DetectHttpHHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1138,15 +1138,15 @@ static int DetectHttpHHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1246,14 +1246,14 @@ static int DetectHttpHHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1263,14 +1263,14 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1280,14 +1280,14 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1297,14 +1297,14 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1314,14 +1314,14 @@ static int DetectHttpHHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1333,14 +1333,14 @@ static int DetectHttpHHTest14(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-http-hrh.c b/src/detect-http-hrh.c index cb6ee2cf44..efe1cddbdd 100644 --- a/src/detect-http-hrh.c +++ b/src/detect-http-hrh.c @@ -329,15 +329,15 @@ static int DetectHttpHRHTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -436,15 +436,15 @@ static int DetectHttpHRHTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -460,14 +460,14 @@ static int DetectHttpHRHTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -559,15 +559,15 @@ static int DetectHttpHRHTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -584,15 +584,15 @@ static int DetectHttpHRHTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -689,15 +689,15 @@ static int DetectHttpHRHTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -714,15 +714,15 @@ static int DetectHttpHRHTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -819,15 +819,15 @@ static int DetectHttpHRHTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -844,15 +844,15 @@ static int DetectHttpHRHTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -938,15 +938,15 @@ static int DetectHttpHRHTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1037,15 +1037,15 @@ static int DetectHttpHRHTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1137,15 +1137,15 @@ static int DetectHttpHRHTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1245,14 +1245,14 @@ static int DetectHttpHRHTest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1262,14 +1262,14 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1279,14 +1279,14 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1296,14 +1296,14 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1313,14 +1313,14 @@ static int DetectHttpHRHTest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1332,14 +1332,14 @@ static int DetectHttpHRHTest14(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2126,15 +2126,15 @@ static int DetectHttpHRHTest37(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2151,15 +2151,15 @@ static int DetectHttpHRHTest37(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-http-method.c b/src/detect-http-method.c index 8fcaaef57f..132b767957 100644 --- a/src/detect-http-method.c +++ b/src/detect-http-method.c @@ -496,14 +496,14 @@ static int DetectHttpMethodSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -599,14 +599,14 @@ static int DetectHttpMethodSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -693,14 +693,14 @@ static int DetectHttpMethodSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -789,14 +789,14 @@ static int DetectHttpMethodSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index ad7effc049..5d761ecb3a 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -350,15 +350,15 @@ static int DetectHttpRawHeaderTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -459,15 +459,15 @@ static int DetectHttpRawHeaderTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -484,15 +484,15 @@ static int DetectHttpRawHeaderTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -586,15 +586,15 @@ static int DetectHttpRawHeaderTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -611,15 +611,15 @@ static int DetectHttpRawHeaderTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -714,15 +714,15 @@ static int DetectHttpRawHeaderTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -739,15 +739,15 @@ static int DetectHttpRawHeaderTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -842,15 +842,15 @@ static int DetectHttpRawHeaderTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -867,15 +867,15 @@ static int DetectHttpRawHeaderTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -962,15 +962,15 @@ static int DetectHttpRawHeaderTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1063,15 +1063,15 @@ static int DetectHttpRawHeaderTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1165,15 +1165,15 @@ static int DetectHttpRawHeaderTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-http-server-body.c b/src/detect-http-server-body.c index 0f1cb2bbaa..b4af9a402d 100644 --- a/src/detect-http-server-body.c +++ b/src/detect-http-server-body.c @@ -365,22 +365,22 @@ static int DetectHttpServerBodyTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START|STREAM_EOF, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -488,21 +488,21 @@ static int DetectHttpServerBodyTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -518,14 +518,14 @@ static int DetectHttpServerBodyTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -625,15 +625,15 @@ static int DetectHttpServerBodyTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -642,15 +642,15 @@ static int DetectHttpServerBodyTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -660,15 +660,15 @@ static int DetectHttpServerBodyTest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -772,15 +772,15 @@ static int DetectHttpServerBodyTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -789,15 +789,15 @@ static int DetectHttpServerBodyTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -807,12 +807,12 @@ static int DetectHttpServerBodyTest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -820,10 +820,10 @@ static int DetectHttpServerBodyTest09(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -927,15 +927,15 @@ static int DetectHttpServerBodyTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -944,15 +944,15 @@ static int DetectHttpServerBodyTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -962,12 +962,12 @@ static int DetectHttpServerBodyTest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -975,10 +975,10 @@ static int DetectHttpServerBodyTest10(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1078,15 +1078,15 @@ static int DetectHttpServerBodyTest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1095,15 +1095,15 @@ static int DetectHttpServerBodyTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -1113,15 +1113,15 @@ static int DetectHttpServerBodyTest11(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1221,15 +1221,15 @@ static int DetectHttpServerBodyTest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1238,15 +1238,15 @@ static int DetectHttpServerBodyTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -1256,15 +1256,15 @@ static int DetectHttpServerBodyTest12(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1352,22 +1352,22 @@ static int DetectHttpServerBodyTest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START|STREAM_EOF, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1479,11 +1479,11 @@ static int DetectHttpServerBodyTest14(void) SCLogDebug("add chunk 1"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -1492,10 +1492,10 @@ static int DetectHttpServerBodyTest14(void) r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCLogDebug("inspect chunk 1"); @@ -1509,11 +1509,11 @@ static int DetectHttpServerBodyTest14(void) SCLogDebug("add chunk 3"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -1522,10 +1522,10 @@ static int DetectHttpServerBodyTest14(void) r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCLogDebug("inspect chunk 4"); @@ -1645,21 +1645,21 @@ static int DetectHttpServerBodyTest15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1673,21 +1673,21 @@ static int DetectHttpServerBodyTest15(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2465,22 +2465,22 @@ static int DetectHttpServerBodyFileDataTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START|STREAM_EOF, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2588,12 +2588,12 @@ static int DetectHttpServerBodyFileDataTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -2601,10 +2601,10 @@ static int DetectHttpServerBodyFileDataTest02(void) if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2620,14 +2620,14 @@ static int DetectHttpServerBodyFileDataTest02(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2727,15 +2727,15 @@ static int DetectHttpServerBodyFileDataTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2744,15 +2744,15 @@ static int DetectHttpServerBodyFileDataTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -2762,15 +2762,15 @@ static int DetectHttpServerBodyFileDataTest03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ @@ -2875,15 +2875,15 @@ static int DetectHttpServerBodyFileDataTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -2892,15 +2892,15 @@ static int DetectHttpServerBodyFileDataTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -2910,12 +2910,12 @@ static int DetectHttpServerBodyFileDataTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -2923,10 +2923,10 @@ static int DetectHttpServerBodyFileDataTest04(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3030,15 +3030,15 @@ static int DetectHttpServerBodyFileDataTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3047,15 +3047,15 @@ static int DetectHttpServerBodyFileDataTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -3065,12 +3065,12 @@ static int DetectHttpServerBodyFileDataTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -3078,10 +3078,10 @@ static int DetectHttpServerBodyFileDataTest05(void) if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3181,15 +3181,15 @@ static int DetectHttpServerBodyFileDataTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3198,15 +3198,15 @@ static int DetectHttpServerBodyFileDataTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -3216,15 +3216,15 @@ static int DetectHttpServerBodyFileDataTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3324,15 +3324,15 @@ static int DetectHttpServerBodyFileDataTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, http_buf1, http_len1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3341,15 +3341,15 @@ static int DetectHttpServerBodyFileDataTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -3359,15 +3359,15 @@ static int DetectHttpServerBodyFileDataTest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, http_buf3, http_len3); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -3455,22 +3455,22 @@ static int DetectHttpServerBodyFileDataTest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START|STREAM_EOF, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_START|STREAM_EOF, http_buf2, http_len2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -3580,21 +3580,21 @@ static int DetectHttpServerBodyFileDataTest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3604,21 +3604,21 @@ static int DetectHttpServerBodyFileDataTest09(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3736,21 +3736,21 @@ static int DetectHttpServerBodyFileDataTest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3760,21 +3760,21 @@ static int DetectHttpServerBodyFileDataTest10(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT|STREAM_EOF, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-http-stat-code.c b/src/detect-http-stat-code.c index e0f1cb0efe..f2878743d8 100644 --- a/src/detect-http-stat-code.c +++ b/src/detect-http-stat-code.c @@ -268,21 +268,21 @@ static int DetectHttpStatCodeSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOCLIENT, httpbuf2, httplen2); if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -376,12 +376,12 @@ static int DetectHttpStatCodeSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -389,10 +389,10 @@ static int DetectHttpStatCodeSigTest02(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -492,12 +492,12 @@ static int DetectHttpStatCodeSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -505,10 +505,10 @@ static int DetectHttpStatCodeSigTest03(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -608,12 +608,12 @@ static int DetectHttpStatCodeSigTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -621,10 +621,10 @@ static int DetectHttpStatCodeSigTest04(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-http-stat-msg.c b/src/detect-http-stat-msg.c index 5e6e8f002c..4472f6144b 100644 --- a/src/detect-http-stat-msg.c +++ b/src/detect-http-stat-msg.c @@ -266,12 +266,12 @@ static int DetectHttpStatMsgSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -279,10 +279,10 @@ static int DetectHttpStatMsgSigTest01(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -374,12 +374,12 @@ static int DetectHttpStatMsgSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -387,10 +387,10 @@ static int DetectHttpStatMsgSigTest02(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -486,12 +486,12 @@ static int DetectHttpStatMsgSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } @@ -499,10 +499,10 @@ static int DetectHttpStatMsgSigTest03(void) if (r != 0) { printf("toclient chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { diff --git a/src/detect-http-ua.c b/src/detect-http-ua.c index 2a1ac7b906..5e9d69d13c 100644 --- a/src/detect-http-ua.c +++ b/src/detect-http-ua.c @@ -330,15 +330,15 @@ static int DetectHttpUATest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -437,15 +437,15 @@ static int DetectHttpUATest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -461,14 +461,14 @@ static int DetectHttpUATest07(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -560,15 +560,15 @@ static int DetectHttpUATest08(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -585,15 +585,15 @@ static int DetectHttpUATest08(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -690,15 +690,15 @@ static int DetectHttpUATest09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -715,15 +715,15 @@ static int DetectHttpUATest09(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -820,15 +820,15 @@ static int DetectHttpUATest10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http1_buf, http1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -845,15 +845,15 @@ static int DetectHttpUATest10(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http2_buf, http2_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: \n", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -939,15 +939,15 @@ static int DetectHttpUATest11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1038,15 +1038,15 @@ static int DetectHttpUATest12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1138,15 +1138,15 @@ static int DetectHttpUATest13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf, http_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1246,14 +1246,14 @@ static int DetectHttpUATest14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1263,14 +1263,14 @@ static int DetectHttpUATest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1280,14 +1280,14 @@ static int DetectHttpUATest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1297,14 +1297,14 @@ static int DetectHttpUATest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); if (r != 0) { printf("toserver chunk 5 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1314,14 +1314,14 @@ static int DetectHttpUATest14(void) } p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); if (r != 0) { printf("toserver chunk 6 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1333,14 +1333,14 @@ static int DetectHttpUATest14(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); if (r != 0) { printf("toserver chunk 7 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-lua.c b/src/detect-lua.c index 3343a6be76..02450e61cd 100644 --- a/src/detect-lua.c +++ b/src/detect-lua.c @@ -1274,14 +1274,14 @@ static int LuaMatchTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -1297,14 +1297,14 @@ static int LuaMatchTest01(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogDebug("inspecting p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1708,14 +1708,14 @@ static int LuaMatchTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -1731,14 +1731,14 @@ static int LuaMatchTest04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1856,14 +1856,14 @@ static int LuaMatchTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -1879,14 +1879,14 @@ static int LuaMatchTest05(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -2009,14 +2009,14 @@ static int LuaMatchTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; if (http_state == NULL) { printf("no http state: "); @@ -2032,14 +2032,14 @@ static int LuaMatchTest06(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SCLogInfo("p2"); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); diff --git a/src/detect-pcre.c b/src/detect-pcre.c index e1b0f09428..58b83e769f 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -1495,10 +1495,10 @@ static int DetectPcreTestSig01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, buf, buflen); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF_NOT(PacketAlertCheck(p, 1) == 1); @@ -1690,10 +1690,10 @@ static int DetectPcreModifPTest04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -1801,10 +1801,10 @@ static int DetectPcreModifPTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p1 */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); @@ -1816,10 +1816,10 @@ static int DetectPcreModifPTest05(void) FAIL_IF(PacketAlertCheck(p1, 2)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect for p2 */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); @@ -1944,10 +1944,10 @@ static int DetectPcreTestSig09(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2022,10 +2022,10 @@ static int DetectPcreTestSig10(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2100,10 +2100,10 @@ static int DetectPcreTestSig11(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2178,10 +2178,10 @@ static int DetectPcreTestSig12(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2256,10 +2256,10 @@ static int DetectPcreTestSig13(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2334,10 +2334,10 @@ static int DetectPcreTestSig14(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2413,10 +2413,10 @@ static int DetectPcreTestSig15(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2492,10 +2492,10 @@ static int DetectPcreTestSig16(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -2563,7 +2563,7 @@ static int DetectPcreTxBodyChunksTest01(void) AppLayerHtpEnableRequestBodyCallback(); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START, httpbuf1, httplen1); FAIL_IF(r != 0); @@ -2614,7 +2614,7 @@ static int DetectPcreTxBodyChunksTest01(void) if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&f); UTHFreePacket(p); @@ -2678,60 +2678,60 @@ static int DetectPcreTxBodyChunksTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(!(PacketAlertCheck(p, 1))); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2740,10 +2740,10 @@ static int DetectPcreTxBodyChunksTest02(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf7, httplen7); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2846,60 +2846,60 @@ static int DetectPcreTxBodyChunksTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf3, httplen3); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf4, httplen4); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(!(PacketAlertCheck(p, 1))); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf5, httplen5); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); FAIL_IF(PacketAlertCheck(p, 1)); p->alerts.cnt = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf6, httplen6); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -2908,10 +2908,10 @@ static int DetectPcreTxBodyChunksTest03(void) SCLogDebug("sending data chunk 7"); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf7, httplen7); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -3002,10 +3002,10 @@ static int DetectPcreFlowvarCapture01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -3115,10 +3115,10 @@ static int DetectPcreFlowvarCapture02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; FAIL_IF(http_state == NULL); @@ -3227,10 +3227,10 @@ static int DetectPcreFlowvarCapture03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *http_state = f.alstate; FAIL_IF(http_state == NULL); diff --git a/src/detect-ssh-proto-version.c b/src/detect-ssh-proto-version.c index dca2e3588d..39b4a891b1 100644 --- a/src/detect-ssh-proto-version.c +++ b/src/detect-ssh-proto-version.c @@ -374,35 +374,35 @@ static int DetectSshVersionTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -487,7 +487,7 @@ static int DetectSshVersionTestDetect02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); @@ -497,24 +497,24 @@ static int DetectSshVersionTestDetect02(void) r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -598,35 +598,35 @@ static int DetectSshVersionTestDetect03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { diff --git a/src/detect-ssh-software-version.c b/src/detect-ssh-software-version.c index 8ab0dbed56..bc1967f771 100644 --- a/src/detect-ssh-software-version.c +++ b/src/detect-ssh-software-version.c @@ -346,35 +346,35 @@ static int DetectSshSoftwareVersionTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -459,35 +459,35 @@ static int DetectSshSoftwareVersionTestDetect02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { @@ -571,35 +571,35 @@ static int DetectSshSoftwareVersionTestDetect03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf1, sshlen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf2, sshlen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf3, sshlen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_SSH, STREAM_TOSERVER, sshbuf4, sshlen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SshState *ssh_state = f.alstate; if (ssh_state == NULL) { diff --git a/src/detect-ssl-state.c b/src/detect-ssl-state.c index 674dcdcc67..742c925142 100644 --- a/src/detect-ssl-state.c +++ b/src/detect-ssl-state.c @@ -709,11 +709,11 @@ static int DetectSslStateTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER | STREAM_START, chello_buf, chello_buf_len); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ssl_state = f.alstate; FAIL_IF(ssl_state == NULL); @@ -728,11 +728,11 @@ static int DetectSslStateTest07(void) FAIL_IF(PacketAlertCheck(p, 4)); FAIL_IF(PacketAlertCheck(p, 5)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, shello_buf, shello_buf_len); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ p->alerts.cnt = 0; @@ -748,11 +748,11 @@ static int DetectSslStateTest07(void) PASS; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_change_cipher_spec_buf, client_change_cipher_spec_buf_len); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ p->alerts.cnt = 0; @@ -763,11 +763,11 @@ static int DetectSslStateTest07(void) FAIL_IF(!PacketAlertCheck(p, 3)); FAIL_IF(PacketAlertCheck(p, 4)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_change_cipher_spec_buf, server_change_cipher_spec_buf_len); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ p->alerts.cnt = 0; @@ -778,11 +778,11 @@ static int DetectSslStateTest07(void) FAIL_IF(PacketAlertCheck(p, 3)); FAIL_IF(PacketAlertCheck(p, 4)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, toserver_app_data_buf, toserver_app_data_buf_len); FAIL_IF(r != 0); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ p->alerts.cnt = 0; diff --git a/src/detect-ssl-version.c b/src/detect-ssl-version.c index 0c377ac86f..e56df42e77 100644 --- a/src/detect-ssl-version.c +++ b/src/detect-ssl-version.c @@ -431,35 +431,35 @@ static int DetectSslVersionTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf1, ssllen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf2, ssllen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf3, ssllen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf4, ssllen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { @@ -556,35 +556,35 @@ static int DetectSslVersionTestDetect02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf1, ssllen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf2, ssllen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf3, ssllen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf4, ssllen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { @@ -690,35 +690,35 @@ static int DetectSslVersionTestDetect03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf1, ssllen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf2, ssllen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf3, ssllen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, sslbuf4, ssllen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *app_state = f.alstate; if (app_state == NULL) { diff --git a/src/detect-template-buffer.c b/src/detect-template-buffer.c index ffc89cf078..574743c862 100644 --- a/src/detect-template-buffer.c +++ b/src/detect-template-buffer.c @@ -126,10 +126,10 @@ static int DetectTemplateBufferTest(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); AppLayerParserParse(alp_tctx, &f, ALPROTO_TEMPLATE, STREAM_TOSERVER, request, sizeof(request)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* Check that we have app-layer state. */ FAIL_IF_NULL(f.alstate); diff --git a/src/detect-tls-cert-issuer.c b/src/detect-tls-cert-issuer.c index 154185c078..f6dc4ad128 100644 --- a/src/detect-tls-cert-issuer.c +++ b/src/detect-tls-cert-issuer.c @@ -390,10 +390,10 @@ static int DetectTlsIssuerTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); @@ -404,10 +404,10 @@ static int DetectTlsIssuerTest02(void) FAIL_IF(PacketAlertCheck(p1, 1)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); @@ -415,10 +415,10 @@ static int DetectTlsIssuerTest02(void) FAIL_IF(PacketAlertCheck(p2, 1)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); diff --git a/src/detect-tls-cert-subject.c b/src/detect-tls-cert-subject.c index 90e5caeea9..f3bea21e0c 100644 --- a/src/detect-tls-cert-subject.c +++ b/src/detect-tls-cert-subject.c @@ -389,10 +389,10 @@ static int DetectTlsSubjectTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, client_hello, sizeof(client_hello)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); @@ -403,10 +403,10 @@ static int DetectTlsSubjectTest02(void) FAIL_IF(PacketAlertCheck(p1, 1)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, server_hello, sizeof(server_hello)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); @@ -414,10 +414,10 @@ static int DetectTlsSubjectTest02(void) FAIL_IF(PacketAlertCheck(p2, 1)); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOCLIENT, certificate, sizeof(certificate)); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FAIL_IF(r != 0); diff --git a/src/detect-tls-sni.c b/src/detect-tls-sni.c index 46c43e53e6..141d9127c4 100644 --- a/src/detect-tls-sni.c +++ b/src/detect-tls-sni.c @@ -162,14 +162,14 @@ static int DetectTlsSniTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ssl_state = f.alstate; if (ssl_state == NULL) { @@ -283,14 +283,14 @@ static int DetectTlsSniTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, buf, sizeof(buf)); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); ssl_state = f.alstate; if (ssl_state == NULL) { diff --git a/src/detect-tls-version.c b/src/detect-tls-version.c index 6e185ef40e..dd1f40c058 100644 --- a/src/detect-tls-version.c +++ b/src/detect-tls-version.c @@ -344,35 +344,35 @@ static int DetectTlsVersionTestDetect01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -472,35 +472,35 @@ static int DetectTlsVersionTestDetect02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { @@ -610,35 +610,35 @@ static int DetectTlsVersionTestDetect03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf1, tlslen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf2, tlslen2); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf3, tlslen3); if (r != 0) { printf("toserver chunk 3 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } r = AppLayerParserParse(alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER, tlsbuf4, tlslen4); if (r != 0) { printf("toserver chunk 4 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SSLState *ssl_state = f.alstate; if (ssl_state == NULL) { diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index 1ee13c6c03..42e83f19bd 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -218,7 +218,7 @@ static int HTTPUriTest01(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { @@ -257,7 +257,7 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; } @@ -286,7 +286,7 @@ static int HTTPUriTest02(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { @@ -327,7 +327,7 @@ end: StreamTcpFreeConfig(TRUE); if (htp_state != NULL) HTPStateFree(htp_state); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; } @@ -356,7 +356,7 @@ static int HTTPUriTest03(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { @@ -397,7 +397,7 @@ end: StreamTcpFreeConfig(TRUE); if (htp_state != NULL) HTPStateFree(htp_state); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; } @@ -427,7 +427,7 @@ static int HTTPUriTest04(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_START| STREAM_EOF, httpbuf1, httplen1); if (r != 0) { @@ -468,7 +468,7 @@ end: StreamTcpFreeConfig(TRUE); if (htp_state != NULL) HTPStateFree(htp_state); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; } @@ -585,14 +585,14 @@ static int DetectUriSigTest02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -700,14 +700,14 @@ static int DetectUriSigTest03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -724,14 +724,14 @@ static int DetectUriSigTest03(void) } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf2, httplen2); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -1052,14 +1052,14 @@ static int DetectUriSigTest05(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1192,14 +1192,14 @@ static int DetectUriSigTest06(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); @@ -1314,14 +1314,14 @@ static int DetectUriSigTest07(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&th_v, de_ctx, det_ctx, p); diff --git a/src/detect-urilen.c b/src/detect-urilen.c index fbb454b136..2dbf56a126 100644 --- a/src/detect-urilen.c +++ b/src/detect-urilen.c @@ -610,14 +610,14 @@ static int DetectUrilenSigTest01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, httpbuf1, httplen1); if (r != 0) { SCLogDebug("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); HtpState *htp_state = f.alstate; if (htp_state == NULL) { diff --git a/src/detect.c b/src/detect.c index aeb8123064..f527d051f9 100644 --- a/src/detect.c +++ b/src/detect.c @@ -4820,15 +4820,15 @@ static int SigTest06 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -4909,15 +4909,15 @@ static int SigTest07 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -4998,15 +4998,15 @@ static int SigTest08 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -5089,15 +5089,15 @@ static int SigTest09 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -5172,15 +5172,15 @@ static int SigTest10 (void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx,(void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, buf, buflen); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); result = 0; - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SigMatchSignatures(&th_v, de_ctx, det_ctx, p); if (PacketAlertCheck(p, 1) && PacketAlertCheck(p, 2)) @@ -9341,14 +9341,14 @@ static int SigTestDropFlow01(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -9443,14 +9443,14 @@ static int SigTestDropFlow02(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -9573,14 +9573,14 @@ static int SigTestDropFlow03(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -9618,14 +9618,14 @@ static int SigTestDropFlow03(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); @@ -9744,14 +9744,14 @@ static int SigTestDropFlow04(void) SigGroupBuild(de_ctx); DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf1, http_buf1_len); if (r != 0) { printf("toserver chunk 1 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); http_state = f.alstate; if (http_state == NULL) { @@ -9799,14 +9799,14 @@ static int SigTestDropFlow04(void) goto end; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); r = AppLayerParserParse(alp_tctx, &f, ALPROTO_HTTP, STREAM_TOSERVER, http_buf2, http_buf2_len); if (r != 0) { printf("toserver chunk 2 returned %" PRId32 ", expected 0: ", r); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); goto end; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); /* do detect */ SigMatchSignatures(&tv, de_ctx, det_ctx, p2); diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 6fc622fb07..30b725a18d 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -5086,14 +5086,14 @@ static int StreamTcpTestMissedPacket (TcpReassemblyThreadCtx *ra_ctx, s = &ssn->client; } - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, ssn, s, p, &pq) == -1) { - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); return -1; } - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); return 0; } @@ -6169,7 +6169,7 @@ static int StreamTcpReassembleTest38 (void) TcpStream *s = NULL; s = &ssn.server; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, &ssn, s, p, &pq) == -1) { printf("failed in segments reassembly, while processing toserver packet (1): "); goto end; @@ -6203,7 +6203,7 @@ static int StreamTcpReassembleTest38 (void) end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); return ret; } @@ -6238,7 +6238,7 @@ static int StreamTcpReassembleTest39 (void) p->flow = &f; p->tcph = &tcph; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); int ret = 0; StreamTcpInitConfig(TRUE); @@ -6808,7 +6808,7 @@ end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); return ret; } @@ -6880,7 +6880,7 @@ static int StreamTcpReassembleTest40 (void) TcpStream *s = NULL; s = &ssn.client; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, &ssn, s, p, &pq) == -1) { printf("failed in segments reassembly, while processing toserver packet (1): "); goto end; @@ -7010,7 +7010,7 @@ end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -7085,7 +7085,7 @@ static int StreamTcpReassembleTest43 (void) TcpStream *s = NULL; s = &ssn.server; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, &ssn, s, p, &pq) == -1) { printf("failed in segments reassembly, while processing toserver packet (1): "); goto end; @@ -7181,7 +7181,7 @@ end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -7289,7 +7289,7 @@ static int StreamTcpReassembleTest45 (void) TcpStream *s = NULL; s = &ssn.server; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, &ssn, s, p, &pq) == -1) { printf("failed in segments reassembly, while processing toclient packet: "); goto end; @@ -7341,7 +7341,7 @@ end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -7408,7 +7408,7 @@ static int StreamTcpReassembleTest46 (void) TcpStream *s = NULL; s = &ssn.server; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); if (StreamTcpReassembleHandleSegment(&tv, ra_ctx, &ssn, s, p, &pq) == -1) { printf("failed in segments reassembly, while processing toclient packet\n"); goto end; @@ -7465,7 +7465,7 @@ end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -7522,7 +7522,7 @@ static int StreamTcpReassembleTest47 (void) TcpStream *s = NULL; uint8_t cnt = 0; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); for (cnt=0; cnt < httplen1; cnt++) { tcph.th_seq = htonl(ssn.client.isn + 1 + cnt); tcph.th_ack = htonl(572799782UL); @@ -7565,7 +7565,7 @@ end: StreamTcpReassembleFreeThreadCtx(ra_ctx); StreamTcpFreeConfig(TRUE); SCFree(p); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -7597,7 +7597,7 @@ static int StreamTcpReassembleInlineTest01(void) p->tcph->th_seq = htonl(12); p->flow = &f; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -7629,7 +7629,7 @@ static int StreamTcpReassembleInlineTest01(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -7667,7 +7667,7 @@ static int StreamTcpReassembleInlineTest02(void) p->tcph->th_seq = htonl(12); p->flow = &f; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -7720,7 +7720,7 @@ static int StreamTcpReassembleInlineTest02(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -7762,7 +7762,7 @@ static int StreamTcpReassembleInlineTest03(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -7817,7 +7817,7 @@ static int StreamTcpReassembleInlineTest03(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -7859,7 +7859,7 @@ static int StreamTcpReassembleInlineTest04(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -7914,7 +7914,7 @@ static int StreamTcpReassembleInlineTest04(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -7950,7 +7950,7 @@ static int StreamTcpReassembleInlineTest05(void) p->tcph->th_seq = htonl(12); p->flow = &f; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -7989,7 +7989,7 @@ static int StreamTcpReassembleInlineTest05(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -8026,7 +8026,7 @@ static int StreamTcpReassembleInlineTest06(void) p->tcph->th_seq = htonl(12); p->flow = &f; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -8088,7 +8088,7 @@ static int StreamTcpReassembleInlineTest06(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -8129,7 +8129,7 @@ static int StreamTcpReassembleInlineTest07(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -8191,7 +8191,7 @@ static int StreamTcpReassembleInlineTest07(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -8235,7 +8235,7 @@ static int StreamTcpReassembleInlineTest08(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -8305,7 +8305,7 @@ static int StreamTcpReassembleInlineTest08(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -8350,7 +8350,7 @@ static int StreamTcpReassembleInlineTest09(void) p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -8425,7 +8425,7 @@ static int StreamTcpReassembleInlineTest09(void) ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); @@ -8473,7 +8473,7 @@ static int StreamTcpReassembleInlineTest10(void) p->flow = f; p->flowflags |= FLOW_PKT_TOSERVER; - SCMutexLock(&f->m); + FLOWLOCK_WRLOCK(f); if (StreamTcpUTAddSegmentWithPayload(&tv, ra_ctx, &ssn.server, 2, stream_payload1, 2) == -1) { printf("failed to add segment 1: "); goto end; @@ -8518,7 +8518,7 @@ end: UTHFreePacket(p); StreamTcpUTClearSession(&ssn); StreamTcpUTDeinit(ra_ctx); - SCMutexUnlock(&f->m); + FLOWLOCK_UNLOCK(f); UTHFreeFlow(f); return ret; } @@ -8550,7 +8550,7 @@ static int StreamTcpReassembleInsertTest01(void) p->tcph->th_seq = htonl(12); p->flow = &f; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpUTAddSegmentWithByte(&tv, ra_ctx, &ssn.client, 2, 'A', 5) == -1) { printf("failed to add segment 1: "); goto end; @@ -8594,7 +8594,7 @@ static int StreamTcpReassembleInsertTest01(void) } ret = 1; end: - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); UTHFreePacket(p); StreamTcpUTClearSession(&ssn); diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 470d4208f1..d56bd5048c 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -5853,7 +5853,7 @@ static int StreamTcpTest02 (void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) { goto end; } @@ -5910,7 +5910,7 @@ static int StreamTcpTest02 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -5952,7 +5952,7 @@ static int StreamTcpTest03 (void) p->tcph = &tcph; int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -5988,7 +5988,7 @@ static int StreamTcpTest03 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6031,7 +6031,7 @@ static int StreamTcpTest04 (void) int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6059,7 +6059,7 @@ static int StreamTcpTest04 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6110,7 +6110,7 @@ static int StreamTcpTest05 (void) p->payload = payload; p->payload_len = 3; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6166,7 +6166,7 @@ static int StreamTcpTest05 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6207,7 +6207,7 @@ static int StreamTcpTest06 (void) tcph.th_flags = TH_FIN; p->tcph = &tcph; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); /* StreamTcpPacket returns -1 on unsolicited FIN */ if (StreamTcpPacket(&tv, p, &stt, &pq) != -1) { printf("StreamTcpPacket failed: "); @@ -6234,7 +6234,7 @@ static int StreamTcpTest06 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6288,7 +6288,7 @@ static int StreamTcpTest07 (void) p->payload = payload; p->payload_len = 1; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); FAIL_IF(StreamTcpPacket(&tv, p, &stt, &pq) == -1); p->tcph->th_seq = htonl(11); @@ -6304,7 +6304,7 @@ static int StreamTcpTest07 (void) StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); PASS; @@ -6358,7 +6358,7 @@ static int StreamTcpTest08 (void) p->payload = payload; p->payload_len = 1; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); FAIL_IF(StreamTcpPacket(&tv, p, &stt, &pq) == -1); p->tcph->th_seq = htonl(11); @@ -6375,7 +6375,7 @@ static int StreamTcpTest08 (void) StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); PASS; @@ -6428,7 +6428,7 @@ static int StreamTcpTest09 (void) p->payload = payload; p->payload_len = 1; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6456,7 +6456,7 @@ static int StreamTcpTest09 (void) StreamTcpSessionClear(p->flow->protoctx); end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6498,7 +6498,7 @@ static int StreamTcpTest10 (void) p->tcph = &tcph; int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6560,7 +6560,7 @@ static int StreamTcpTest10 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6602,7 +6602,7 @@ static int StreamTcpTest11 (void) p->tcph = &tcph; int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6665,7 +6665,7 @@ static int StreamTcpTest11 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6707,7 +6707,7 @@ static int StreamTcpTest12 (void) p->tcph = &tcph; int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6762,7 +6762,7 @@ static int StreamTcpTest12 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -6805,7 +6805,7 @@ static int StreamTcpTest13 (void) p->tcph = &tcph; int ret = 0; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -6872,7 +6872,7 @@ static int StreamTcpTest13 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7038,7 +7038,7 @@ static int StreamTcpTest14 (void) p->payload = payload; p->payload_len = 3; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7139,7 +7139,7 @@ end: StreamTcpFreeConfig(TRUE); ConfDeInit(); ConfRestoreContextBackup(); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7180,7 +7180,7 @@ static int StreamTcp4WHSTest01 (void) tcph.th_flags = TH_SYN; p->tcph = &tcph; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7222,7 +7222,7 @@ static int StreamTcp4WHSTest01 (void) end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7264,7 +7264,7 @@ static int StreamTcp4WHSTest02 (void) tcph.th_flags = TH_SYN; p->tcph = &tcph; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7295,7 +7295,7 @@ static int StreamTcp4WHSTest02 (void) end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7337,7 +7337,7 @@ static int StreamTcp4WHSTest03 (void) tcph.th_flags = TH_SYN; p->tcph = &tcph; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7379,7 +7379,7 @@ static int StreamTcp4WHSTest03 (void) end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7452,7 +7452,7 @@ static int StreamTcpTest15 (void) p->payload = payload; p->payload_len = 3; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7553,7 +7553,7 @@ end: StreamTcpFreeConfig(TRUE); ConfDeInit(); ConfRestoreContextBackup(); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7626,7 +7626,7 @@ static int StreamTcpTest16 (void) p->payload = payload; p->payload_len = 3; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7727,7 +7727,7 @@ end: StreamTcpFreeConfig(TRUE); ConfDeInit(); ConfRestoreContextBackup(); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -7801,7 +7801,7 @@ static int StreamTcpTest17 (void) p->payload = payload; p->payload_len = 3; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -7902,7 +7902,7 @@ end: StreamTcpFreeConfig(TRUE); ConfDeInit(); ConfRestoreContextBackup(); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -8386,7 +8386,7 @@ static int StreamTcpTest25(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -8442,7 +8442,7 @@ static int StreamTcpTest25(void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -8484,7 +8484,7 @@ static int StreamTcpTest26(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -8540,7 +8540,7 @@ static int StreamTcpTest26(void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -8582,7 +8582,7 @@ static int StreamTcpTest27(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -8638,7 +8638,7 @@ static int StreamTcpTest27(void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -9588,7 +9588,7 @@ static int StreamTcpTest37(void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) { printf("failed in processing packet\n"); goto end; @@ -9669,7 +9669,7 @@ static int StreamTcpTest37(void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -9713,7 +9713,7 @@ static int StreamTcpTest38 (void) stt.ra_ctx = ra_ctx; StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) { printf("failed in processing packet in StreamTcpPacket\n"); goto end; @@ -9829,7 +9829,7 @@ static int StreamTcpTest38 (void) end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); if (stt.ra_ctx != NULL) @@ -9876,7 +9876,7 @@ static int StreamTcpTest39 (void) StreamTcpInitConfig(TRUE); - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) { printf("failed in processing packet in StreamTcpPacket\n"); goto end; @@ -9970,7 +9970,7 @@ static int StreamTcpTest39 (void) end: StreamTcpSessionClear(p->flow->protoctx); StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); if (stt.ra_ctx != NULL) @@ -10136,7 +10136,7 @@ static int StreamTcpTest42 (void) tcph.th_seq = htonl(100); p->flowflags = FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -10190,7 +10190,7 @@ static int StreamTcpTest42 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -10230,7 +10230,7 @@ static int StreamTcpTest43 (void) tcph.th_seq = htonl(100); p->flowflags = FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -10284,7 +10284,7 @@ static int StreamTcpTest43 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -10324,7 +10324,7 @@ static int StreamTcpTest44 (void) tcph.th_seq = htonl(100); p->flowflags = FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -10373,7 +10373,7 @@ static int StreamTcpTest44 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); FLOW_DESTROY(&f); return ret; @@ -10414,7 +10414,7 @@ static int StreamTcpTest45 (void) tcph.th_seq = htonl(100); p->flowflags = FLOW_PKT_TOSERVER; - SCMutexLock(&f.m); + FLOWLOCK_WRLOCK(&f); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; @@ -10486,7 +10486,7 @@ static int StreamTcpTest45 (void) ret = 1; end: StreamTcpFreeConfig(TRUE); - SCMutexUnlock(&f.m); + FLOWLOCK_UNLOCK(&f); SCFree(p); return ret; }