From: Victor Julien Date: Tue, 21 Jan 2014 12:42:10 +0000 (+0100) Subject: Pass ThreadVars ptr to various thread init funcs X-Git-Tag: suricata-2.0rc1~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f307acacec2cb4f2c015a2d79c82a0faebcb4ff;p=thirdparty%2Fsuricata.git Pass ThreadVars ptr to various thread init funcs To be able to register counters from AppLayerGetCtxThread, the ThreadVars pointer needs to be available in it and thus in it's callers: - AppLayerGetCtxThread - DecodeThreadVarsAlloc - StreamTcpReassembleInitThreadCtx --- diff --git a/src/app-layer.c b/src/app-layer.c index 6f2b85cd9a..b9343b4ead 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -485,7 +485,7 @@ int AppLayerDeSetup(void) SCReturnInt(0); } -AppLayerThreadCtx *AppLayerGetCtxThread(void) +AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv) { SCEnter(); diff --git a/src/app-layer.h b/src/app-layer.h index eae16bfa74..a025739e91 100644 --- a/src/app-layer.h +++ b/src/app-layer.h @@ -97,7 +97,7 @@ int AppLayerDeSetup(void); * \retval Pointer to the newly create thread context, on success; * NULL, on failure. */ -AppLayerThreadCtx *AppLayerGetCtxThread(void); +AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv); /** * \brief Destroys the context created by AppLayeGetCtxThread(). diff --git a/src/decode.c b/src/decode.c index e20f69870f..dc16b86d48 100644 --- a/src/decode.c +++ b/src/decode.c @@ -449,16 +449,15 @@ void AddressDebugPrint(Address *a) } /** \brief Alloc and setup DecodeThreadVars */ -DecodeThreadVars *DecodeThreadVarsAlloc() +DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv) { - DecodeThreadVars *dtv = NULL; if ( (dtv = SCMalloc(sizeof(DecodeThreadVars))) == NULL) return NULL; memset(dtv, 0, sizeof(DecodeThreadVars)); - dtv->app_tctx = AppLayerGetCtxThread(); + dtv->app_tctx = AppLayerGetCtxThread(tv); /** set config defaults */ int vlanbool = 0; diff --git a/src/decode.h b/src/decode.h index 204cf4c726..790dac4ae3 100644 --- a/src/decode.h +++ b/src/decode.h @@ -800,7 +800,7 @@ int PacketSetData(Packet *p, uint8_t *pktdata, int pktlen); int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen); const char *PktSrcToString(enum PktSrcEnum pkt_src); -DecodeThreadVars *DecodeThreadVarsAlloc(); +DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *); /* decoder functions */ int DecodeEthernet(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); diff --git a/src/detect-app-layer-event.c b/src/detect-app-layer-event.c index 20d925df7b..5b0b70e59b 100644 --- a/src/detect-app-layer-event.c +++ b/src/detect-app-layer-event.c @@ -563,7 +563,7 @@ int DetectAppLayerEventTest03(void) p->dst.family = AF_INET; p->proto = IPPROTO_TCP; - ra_ctx = StreamTcpReassembleInitThreadCtx(); + ra_ctx = StreamTcpReassembleInitThreadCtx(&tv); if (ra_ctx == NULL) goto end; StreamTcpInitConfig(TRUE); @@ -667,7 +667,7 @@ int DetectAppLayerEventTest04(void) p->dst.family = AF_INET; p->proto = IPPROTO_TCP; - ra_ctx = StreamTcpReassembleInitThreadCtx(); + ra_ctx = StreamTcpReassembleInitThreadCtx(&tv); if (ra_ctx == NULL) goto end; StreamTcpInitConfig(TRUE); @@ -787,7 +787,7 @@ int DetectAppLayerEventTest05(void) p->dst.family = AF_INET; p->proto = IPPROTO_TCP; - ra_ctx = StreamTcpReassembleInitThreadCtx(); + ra_ctx = StreamTcpReassembleInitThreadCtx(&tv); if (ra_ctx == NULL) goto end; StreamTcpInitConfig(TRUE); diff --git a/src/detect-fragbits.c b/src/detect-fragbits.c index 681ade8b74..ec3c041e41 100644 --- a/src/detect-fragbits.c +++ b/src/detect-fragbits.c @@ -423,7 +423,7 @@ static int FragBitsTestParse03 (void) { memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ipv4h, 0, sizeof(IPV4Hdr)); - dtv.app_tctx = AppLayerGetCtxThread(); + dtv.app_tctx = AppLayerGetCtxThread(&tv); p->ip4h = &ipv4h; @@ -519,7 +519,7 @@ static int FragBitsTestParse04 (void) { memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ipv4h, 0, sizeof(IPV4Hdr)); - dtv.app_tctx = AppLayerGetCtxThread(); + dtv.app_tctx = AppLayerGetCtxThread(&tv); p->ip4h = &ipv4h; diff --git a/src/detect-replace.c b/src/detect-replace.c index 7bfdbec51b..0300d3426e 100644 --- a/src/detect-replace.c +++ b/src/detect-replace.c @@ -237,7 +237,7 @@ int DetectReplaceLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pktsize, ch PacketCopyData(p, raw_eth_pkt, pktsize); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&th_v, 0, sizeof(th_v)); - dtv.app_tctx = AppLayerGetCtxThread(); + dtv.app_tctx = AppLayerGetCtxThread(&th_v); FlowInitConfig(FLOW_QUIET); DecodeEthernet(&th_v, &dtv, p, GET_PKT_DATA(p), pktsize, NULL); diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 456b8be30c..06bf3f6e87 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -1698,7 +1698,7 @@ TmEcode DecodeAFPThreadInit(ThreadVars *tv, void *initdata, void **data) SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-erf-dag.c b/src/source-erf-dag.c index fa020ff89c..b806414214 100644 --- a/src/source-erf-dag.c +++ b/src/source-erf-dag.c @@ -627,7 +627,7 @@ TmEcode DecodeErfDagThreadInit(ThreadVars *tv, void *initdata, void **data) SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if(dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-erf-file.c b/src/source-erf-file.c index 066ffe9298..d3924508a3 100644 --- a/src/source-erf-file.c +++ b/src/source-erf-file.c @@ -252,7 +252,7 @@ DecodeErfFileThreadInit(ThreadVars *tv, void *initdata, void **data) { SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 3ec37787e3..ec31a3f523 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -477,7 +477,7 @@ TmEcode DecodeIPFW(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe TmEcode DecodeIPFWThreadInit(ThreadVars *tv, void *initdata, void **data) { DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-napatech.c b/src/source-napatech.c index 5630863960..9f3cd6a493 100644 --- a/src/source-napatech.c +++ b/src/source-napatech.c @@ -383,7 +383,7 @@ TmEcode NapatechDecodeThreadInit(ThreadVars *tv, void *initdata, void **data) SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if(dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-nfq.c b/src/source-nfq.c index 4e3b73f442..548f0ed5d0 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -1231,7 +1231,7 @@ TmEcode DecodeNFQ(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet TmEcode DecodeNFQThreadInit(ThreadVars *tv, void *initdata, void **data) { DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index 8c7a4637be..f23127f97c 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -424,7 +424,7 @@ TmEcode DecodePcapFileThreadInit(ThreadVars *tv, void *initdata, void **data) { SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-pcap.c b/src/source-pcap.c index 09b7b39408..a4267711fc 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -750,7 +750,7 @@ TmEcode DecodePcapThreadInit(ThreadVars *tv, void *initdata, void **data) SCEnter(); DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/source-pfring.c b/src/source-pfring.c index 09ef215ecd..d14fe2f1e1 100644 --- a/src/source-pfring.c +++ b/src/source-pfring.c @@ -604,7 +604,7 @@ TmEcode DecodePfringThreadInit(ThreadVars *tv, void *initdata, void **data) { DecodeThreadVars *dtv = NULL; - dtv = DecodeThreadVarsAlloc(); + dtv = DecodeThreadVarsAlloc(tv); if (dtv == NULL) SCReturnInt(TM_ECODE_FAILED); diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 3b5e92b5ac..3ae9dd7cf8 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -355,7 +355,7 @@ void StreamTcpReassembleFree(char quiet) #endif } -TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(void) +TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv) { SCEnter(); TcpReassemblyThreadCtx *ra_ctx = SCMalloc(sizeof(TcpReassemblyThreadCtx)); @@ -364,7 +364,7 @@ TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(void) memset(ra_ctx, 0x00, sizeof(TcpReassemblyThreadCtx)); - ra_ctx->app_tctx = AppLayerGetCtxThread(); + ra_ctx->app_tctx = AppLayerGetCtxThread(tv); SCReturnPtr(ra_ctx, "TcpReassemblyThreadCtx"); } @@ -3679,7 +3679,7 @@ static int StreamTcpReassembleStreamTest(TcpStream *stream) { Flow f; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); /* prevent L7 from kicking in */ StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096); @@ -4008,7 +4008,7 @@ static int StreamTcpTestStartsBeforeListSegment(TcpStream *stream) { Flow f; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); /* prevent L7 from kicking in */ StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096); @@ -4124,7 +4124,7 @@ static int StreamTcpTestStartsAtSameListSegment(TcpStream *stream) { Flow f; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -4239,7 +4239,7 @@ static int StreamTcpTestStartsAfterListSegment(TcpStream *stream) { Flow f; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -5035,7 +5035,7 @@ static int StreamTcpReassembleTest25 (void) { uint8_t flowflags; uint8_t check_contents[7] = {0x41, 0x41, 0x41, 0x42, 0x42, 0x43, 0x43}; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); memset(&ssn, 0, sizeof (TcpSession)); flowflags = FLOW_PKT_TOSERVER; @@ -5098,7 +5098,7 @@ static int StreamTcpReassembleTest26 (void) { ack = 20; StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); StreamTcpCreateTestPacket(payload, 0x41, 3, 4); /*AAA*/ seq = 10; @@ -5155,7 +5155,7 @@ static int StreamTcpReassembleTest27 (void) { ack = 20; StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); StreamTcpCreateTestPacket(payload, 0x41, 3, 4); /*AAA*/ seq = 10; @@ -5209,7 +5209,7 @@ static int StreamTcpReassembleTest28 (void) { uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42}; TcpSession ssn; memset(&ssn, 0, sizeof (TcpSession)); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); StreamTcpInitConfig(TRUE); StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096); @@ -5287,7 +5287,7 @@ static int StreamTcpReassembleTest29 (void) { uint8_t th_flags; uint8_t flowflags; uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42}; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpSession ssn; memset(&ssn, 0, sizeof (TcpSession)); @@ -5367,7 +5367,7 @@ static int StreamTcpReassembleTest30 (void) { TcpSession ssn; memset(&ssn, 0, sizeof (TcpSession)); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); flowflags = FLOW_PKT_TOSERVER; th_flag = TH_ACK|TH_PUSH; @@ -5459,7 +5459,7 @@ static int StreamTcpReassembleTest31 (void) { uint8_t th_flag; uint8_t flowflags; uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42}; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpSession ssn; memset(&ssn, 0, sizeof (TcpSession)); @@ -5529,7 +5529,7 @@ static int StreamTcpReassembleTest32(void) { return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; uint8_t ret = 0; uint8_t check_contents[35] = {0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, @@ -5618,7 +5618,7 @@ static int StreamTcpReassembleTest33(void) { return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; memset(&stream, 0, sizeof (TcpStream)); stream.os_policy = OS_POLICY_BSD; @@ -5698,7 +5698,7 @@ static int StreamTcpReassembleTest34(void) { return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; memset(&stream, 0, sizeof (TcpStream)); stream.os_policy = OS_POLICY_BSD; @@ -5779,7 +5779,7 @@ static int StreamTcpReassembleTest35(void) { return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; memset(&stream, 0, sizeof (TcpStream)); stream.os_policy = OS_POLICY_BSD; @@ -5847,7 +5847,7 @@ static int StreamTcpReassembleTest36(void) { return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; memset(&stream, 0, sizeof (TcpStream)); stream.os_policy = OS_POLICY_BSD; @@ -5911,7 +5911,7 @@ static int StreamTcpReassembleTest37(void) { TcpSession ssn; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); TcpStream stream; uint8_t packet[1460] = ""; PacketQueue pq; @@ -6025,7 +6025,7 @@ static int StreamTcpReassembleTest38 (void) { memset(&tv, 0, sizeof (ThreadVars)); StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t httpbuf2[] = "POST / HTTP/1.0\r\nUser-Agent: Victor/1.0\r\n\r\n"; uint32_t httplen2 = sizeof(httpbuf2) - 1; /* minus the \0 */ @@ -6738,7 +6738,7 @@ static int StreamTcpReassembleTest40 (void) { StreamTcpInitConfig(TRUE); StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 130); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t httpbuf1[] = "P"; uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */ @@ -6935,7 +6935,7 @@ static int StreamTcpReassembleTest43 (void) { memset(&tv, 0, sizeof (ThreadVars)); StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t httpbuf1[] = "/ HTTP/1.0\r\nUser-Agent: Victor/1.0"; @@ -7154,7 +7154,7 @@ static int StreamTcpReassembleTest45 (void) { uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */ StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); STREAMTCP_SET_RA_BASE_SEQ(&ssn.server, 9); ssn.server.isn = 9; @@ -7271,7 +7271,7 @@ static int StreamTcpReassembleTest46 (void) { uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */ StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); STREAMTCP_SET_RA_BASE_SEQ(&ssn.server, 9); ssn.server.isn = 9; @@ -7394,7 +7394,7 @@ static int StreamTcpReassembleTest47 (void) { StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOCLIENT, 0); StreamTcpInitConfig(TRUE); - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t httpbuf1[] = "GET /EVILSUFF HTTP/1.1\r\n\r\n"; uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */ diff --git a/src/stream-tcp-reassemble.h b/src/stream-tcp-reassemble.h index 5b89b1a72d..edfb643190 100644 --- a/src/stream-tcp-reassemble.h +++ b/src/stream-tcp-reassemble.h @@ -74,7 +74,7 @@ int StreamTcpReassembleHandleSegment(ThreadVars *, TcpReassemblyThreadCtx *, Tcp int StreamTcpReassembleInit(char); void StreamTcpReassembleFree(char); void StreamTcpReassembleRegisterTests(void); -TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(void); +TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv); void StreamTcpReassembleFreeThreadCtx(TcpReassemblyThreadCtx *); int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, TcpSession *ssn, TcpStream *stream, diff --git a/src/stream-tcp-util.c b/src/stream-tcp-util.c index c77173322d..93fdf9b017 100644 --- a/src/stream-tcp-util.c +++ b/src/stream-tcp-util.c @@ -42,7 +42,7 @@ void StreamTcpUTInit(TcpReassemblyThreadCtx **ra_ctx) { StreamTcpInitConfig(TRUE); - *ra_ctx = StreamTcpReassembleInitThreadCtx(); + *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); } void StreamTcpUTDeinit(TcpReassemblyThreadCtx *ra_ctx) { diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 4199af0df0..1155d2449e 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -4534,7 +4534,7 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data) "NULL"); /* init reassembly ctx */ - stt->ra_ctx = StreamTcpReassembleInitThreadCtx(); + stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv); if (stt->ra_ctx == NULL) SCReturnInt(TM_ECODE_FAILED); @@ -7817,7 +7817,7 @@ static int StreamTcpTest23(void) TcpSession ssn; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t packet[1460] = ""; ThreadVars tv; int result = 1; @@ -7909,7 +7909,7 @@ static int StreamTcpTest24(void) return 0; Flow f; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); uint8_t packet[1460] = ""; ThreadVars tv; int result = 1; @@ -8001,7 +8001,7 @@ static int StreamTcpTest25(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -8100,7 +8100,7 @@ static int StreamTcpTest26(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -8195,7 +8195,7 @@ static int StreamTcpTest27(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -8336,7 +8336,7 @@ static int StreamTcpTest29(void) TCPHdr tcph; TcpSession ssn; IPV4Hdr ipv4h; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); struct in_addr addr; struct in_addr addr1; TCPCache tcpc; @@ -8474,7 +8474,7 @@ static int StreamTcpTest30(void) TCPHdr tcph; TcpSession ssn; IPV4Hdr ipv4h; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); struct in_addr addr; struct in_addr addr1; TCPCache tcpc; @@ -8615,7 +8615,7 @@ static int StreamTcpTest31(void) TCPHdr tcph; TcpSession ssn; IPV4Hdr ipv4h; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); struct in_addr addr; struct in_addr addr1; TCPCache tcpc; @@ -8770,7 +8770,7 @@ static int StreamTcpTest32(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -9089,7 +9089,7 @@ static int StreamTcpTest36(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); @@ -9181,7 +9181,7 @@ static int StreamTcpTest37(void) { StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; - TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(); + TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL); int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue));