diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index 687f4127e9..1723621b3a 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -2511,6 +2511,7 @@ static int DCERPCParserTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -2748,6 +2749,7 @@ static int DCERPCParserTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -2951,6 +2953,7 @@ static int DCERPCParserTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4403,6 +4406,7 @@ static int DCERPCParserTest05(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4578,6 +4582,7 @@ static int DCERPCParserTest06(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4664,6 +4669,7 @@ static int DCERPCParserTest07(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4757,6 +4763,7 @@ static int DCERPCParserTest08(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4818,6 +4825,7 @@ static int DCERPCParserTest09(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4893,6 +4901,7 @@ static int DCERPCParserTest10(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -4994,6 +5003,7 @@ static int DCERPCParserTest11(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -5093,6 +5103,7 @@ static int DCERPCParserTest12(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -5171,6 +5182,7 @@ static int DCERPCParserTest13(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -5262,6 +5274,7 @@ static int DCERPCParserTest14(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -5324,6 +5337,7 @@ static int DCERPCParserTest15(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -5786,6 +5800,7 @@ static int DCERPCParserTest16(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -6032,6 +6047,7 @@ static int DCERPCParserTest17(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -6178,6 +6194,7 @@ static int DCERPCParserTest18(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); @@ -6444,6 +6461,7 @@ static int DCERPCParserTest19(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_DCERPC; StreamTcpInitConfig(TRUE); diff --git a/src/app-layer-dnp3.c b/src/app-layer-dnp3.c index 72e48e5f22..a78a047ee1 100644 --- a/src/app-layer-dnp3.c +++ b/src/app-layer-dnp3.c @@ -2123,6 +2123,7 @@ static int DNP3ParserTestRequestResponse(void) flow.protoctx = (void *)&ssn; flow.proto = IPPROTO_TCP; + flow.alproto = ALPROTO_DNP3; StreamTcpInitConfig(TRUE); @@ -2154,7 +2155,6 @@ static int DNP3ParserTestRequestResponse(void) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&flow); - DNP3StateFree(state); PASS; } @@ -2191,6 +2191,7 @@ static int DNP3ParserTestUnsolicitedResponseConfirm(void) flow.protoctx = (void *)&ssn; flow.proto = IPPROTO_TCP; + flow.alproto = ALPROTO_DNP3; StreamTcpInitConfig(TRUE); @@ -2224,7 +2225,6 @@ static int DNP3ParserTestUnsolicitedResponseConfirm(void) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&flow); - DNP3StateFree(state); PASS; } @@ -2258,6 +2258,7 @@ static int DNP3ParserTestFlooded(void) flow.protoctx = (void *)&ssn; flow.proto = IPPROTO_TCP; + flow.alproto = ALPROTO_DNP3; StreamTcpInitConfig(TRUE); @@ -2304,7 +2305,6 @@ static int DNP3ParserTestFlooded(void) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&flow); - DNP3StateFree(state); PASS; } @@ -2365,6 +2365,7 @@ static int DNP3ParserTestPartialFrame(void) memset(&ssn, 0, sizeof(ssn)); flow.protoctx = (void *)&ssn; flow.proto = IPPROTO_TCP; + flow.alproto = ALPROTO_DNP3; StreamTcpInitConfig(TRUE); /* Pass in the first partial frame. */ @@ -2437,7 +2438,6 @@ static int DNP3ParserTestPartialFrame(void) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&flow); - DNP3StateFree(state); PASS; } @@ -2478,6 +2478,7 @@ static int DNP3ParserTestMultiFrame(void) memset(&ssn, 0, sizeof(ssn)); flow.protoctx = (void *)&ssn; flow.proto = IPPROTO_TCP; + flow.alproto = ALPROTO_DNP3; StreamTcpInitConfig(TRUE); SCMutexLock(&flow.m); @@ -2493,7 +2494,6 @@ static int DNP3ParserTestMultiFrame(void) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); FLOW_DESTROY(&flow); - DNP3StateFree(state); PASS; } diff --git a/src/app-layer-enip.c b/src/app-layer-enip.c index 27d1a5c7ec..37062e16fd 100644 --- a/src/app-layer-enip.c +++ b/src/app-layer-enip.c @@ -571,6 +571,7 @@ static int ALDecodeENIPTest(void) f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_ENIP; StreamTcpInitConfig(TRUE); diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 71255ff5d4..f1ddc6eb27 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -484,6 +484,7 @@ static int FTPParserTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_FTP; StreamTcpInitConfig(TRUE); @@ -539,6 +540,7 @@ static int FTPParserTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_FTP; StreamTcpInitConfig(TRUE); @@ -612,6 +614,7 @@ static int FTPParserTest06(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_FTP; StreamTcpInitConfig(TRUE); @@ -667,6 +670,7 @@ static int FTPParserTest07(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_FTP; StreamTcpInitConfig(TRUE); @@ -732,6 +736,7 @@ static int FTPParserTest10(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_FTP; StreamTcpInitConfig(TRUE); diff --git a/src/app-layer-htp-file.c b/src/app-layer-htp-file.c index 26ac3e529f..94dc163cad 100644 --- a/src/app-layer-htp-file.c +++ b/src/app-layer-htp-file.c @@ -310,6 +310,7 @@ static int HTPFileParserTest01(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -361,8 +362,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -405,6 +404,7 @@ static int HTPFileParserTest02(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -485,8 +485,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -534,6 +532,7 @@ static int HTPFileParserTest03(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -647,8 +646,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -696,6 +693,7 @@ static int HTPFileParserTest04(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -800,8 +798,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -840,6 +836,7 @@ static int HTPFileParserTest05(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -914,8 +911,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -955,6 +950,7 @@ static int HTPFileParserTest06(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1029,8 +1025,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -1059,6 +1053,7 @@ static int HTPFileParserTest07(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1122,8 +1117,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -1156,6 +1149,7 @@ static int HTPFileParserTest08(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1210,8 +1204,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -1255,6 +1247,7 @@ static int HTPFileParserTest09(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1333,8 +1326,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -1376,6 +1367,7 @@ static int HTPFileParserTest10(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1449,8 +1441,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -1520,6 +1510,7 @@ static int HTPFileParserTest11(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -1611,8 +1602,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } diff --git a/src/app-layer-htp-xff.c b/src/app-layer-htp-xff.c index 8ba6637e9a..aaf7196a2c 100644 --- a/src/app-layer-htp-xff.c +++ b/src/app-layer-htp-xff.c @@ -126,7 +126,7 @@ int HttpXFFGetIPFromTx(const Packet *p, uint64_t tx_id, HttpXFFCfg *xff_cfg, return 0; } - total_txs = AppLayerParserGetTxCnt(p->flow->proto, ALPROTO_HTTP, htp_state); + total_txs = AppLayerParserGetTxCnt(p->flow, htp_state); if (tx_id >= total_txs) return 0; @@ -186,7 +186,7 @@ int HttpXFFGetIP(const Packet *p, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbufl goto end; } - total_txs = AppLayerParserGetTxCnt(p->flow->proto, ALPROTO_HTTP, htp_state); + total_txs = AppLayerParserGetTxCnt(p->flow, htp_state); for (; tx_id < total_txs; tx_id++) { if (HttpXFFGetIPFromTx(p, tx_id, xff_cfg, dstbuf, dstbuflen) == 1) return 1; diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 6f8e89a6d7..1acccae560 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -2906,6 +2906,7 @@ static int HTPParserTest01(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -2957,8 +2958,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -2984,6 +2983,7 @@ static int HTPParserTest01a(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3034,8 +3034,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3058,6 +3056,7 @@ static int HTPParserTest02(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3091,8 +3090,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -3117,6 +3114,7 @@ static int HTPParserTest03(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3161,8 +3159,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3187,6 +3183,7 @@ static int HTPParserTest04(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3222,8 +3219,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3258,6 +3253,7 @@ static int HTPParserTest05(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3342,8 +3338,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -3407,6 +3401,7 @@ static int HTPParserTest06(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3461,8 +3456,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -3487,6 +3480,7 @@ static int HTPParserTest07(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3551,8 +3545,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3595,6 +3587,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3635,9 +3628,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); - HTPFreeConfig(); ConfDeInit(); ConfRestoreContextBackup(); @@ -3683,6 +3673,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3721,9 +3712,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); - HTPFreeConfig(); ConfDeInit(); ConfRestoreContextBackup(); @@ -3752,6 +3740,7 @@ static int HTPParserTest10(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3819,8 +3808,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3845,6 +3832,7 @@ static int HTPParserTest11(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3905,8 +3893,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -3931,6 +3917,7 @@ static int HTPParserTest12(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -3994,8 +3981,6 @@ static int HTPParserTest12(void) if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -4020,6 +4005,7 @@ static int HTPParserTest13(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -4089,8 +4075,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -4421,6 +4405,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; htp_cfg_t *htp = cfglist.cfg; @@ -4497,8 +4482,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -4619,6 +4602,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -4739,8 +4723,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -4789,6 +4771,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -4909,8 +4892,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -4957,6 +4938,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5051,8 +5033,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5095,6 +5075,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5162,8 +5143,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5206,6 +5185,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5273,8 +5253,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5317,6 +5295,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5384,8 +5363,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5429,6 +5406,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5496,8 +5474,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5538,6 +5514,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5605,8 +5582,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5648,6 +5623,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5715,8 +5691,6 @@ end: HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -5811,6 +5785,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -5859,8 +5834,6 @@ end: ConfRestoreContextBackup(); HtpConfigRestoreBackup(); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -5924,6 +5897,7 @@ libhtp:\n\ if (f == NULL) goto end; f->protoctx = &ssn; + f->alproto = ALPROTO_HTTP; f->proto = IPPROTO_TCP; StreamTcpInitConfig(TRUE); @@ -5994,8 +5968,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); if (httpbuf != NULL) SCFree(httpbuf); @@ -6068,6 +6040,7 @@ libhtp:\n\ goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -6119,8 +6092,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); if (httpbuf != NULL) SCFree(httpbuf); @@ -6158,6 +6129,7 @@ static int HTPParserTest16(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -6212,8 +6184,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); UTHFreeFlow(f); return result; } @@ -6244,6 +6214,7 @@ static int HTPParserTest17(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -6335,8 +6306,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -6369,6 +6338,7 @@ static int HTPParserTest18(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -6468,8 +6438,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } @@ -6498,6 +6466,7 @@ static int HTPParserTest19(void) goto end; f->protoctx = &ssn; f->proto = IPPROTO_TCP; + f->alproto = ALPROTO_HTTP; StreamTcpInitConfig(TRUE); @@ -6566,8 +6535,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (http_state != NULL) - HTPStateFree(http_state); UTHFreeFlow(f); return result; } diff --git a/src/app-layer-modbus.c b/src/app-layer-modbus.c index a4754dfdc9..fb7b26b92e 100644 --- a/src/app-layer-modbus.c +++ b/src/app-layer-modbus.c @@ -1762,6 +1762,7 @@ static int ModbusParserTest01(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -1829,6 +1830,7 @@ static int ModbusParserTest02(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -1909,6 +1911,7 @@ static int ModbusParserTest03(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2022,6 +2025,7 @@ static int ModbusParserTest04(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -2081,6 +2085,7 @@ static int ModbusParserTest05(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2168,6 +2173,7 @@ static int ModbusParserTest06(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2255,6 +2261,7 @@ static int ModbusParserTest07(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2343,6 +2350,7 @@ static int ModbusParserTest08(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2450,6 +2458,7 @@ static int ModbusParserTest09(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -2546,6 +2555,7 @@ static int ModbusParserTest10(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -2636,6 +2646,7 @@ static int ModbusParserTest11(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2724,6 +2735,7 @@ static int ModbusParserTest12(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -2804,6 +2816,7 @@ static int ModbusParserTest13(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -2872,6 +2885,7 @@ static int ModbusParserTest14(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -2948,6 +2962,7 @@ static int ModbusParserTest15(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -3058,6 +3073,7 @@ static int ModbusParserTest16(void) { f.alproto = ALPROTO_MODBUS; f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; f.flags |= FLOW_IPV4; p->flow = &f; @@ -3162,6 +3178,7 @@ static int ModbusParserTest17(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); @@ -3206,6 +3223,7 @@ static int ModbusParserTest18(void) { FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_MODBUS; StreamTcpInitConfig(TRUE); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 021e8039cf..0d6408dc7b 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -640,24 +640,23 @@ uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint SCReturnCT(pstate->inspect_id[direction & STREAM_TOSERVER ? 0 : 1], "uint64_t"); } -void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate, - const uint8_t ipproto, const AppProto alproto, +void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate, void *alstate, const uint8_t flags) { SCEnter(); int direction = (flags & STREAM_TOSERVER) ? 0 : 1; - uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate); + const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, flags); - int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(alproto, flags); + const int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(f->alproto, flags); void *tx; int state_progress; for (; idx < total_txs; idx++) { - tx = AppLayerParserGetTx(ipproto, alproto, alstate, idx); + tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, idx); if (tx == NULL) continue; - state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, flags); + state_progress = AppLayerParserGetStateProgress(f->proto, f->alproto, tx, flags); if (state_progress >= state_done_progress) continue; else @@ -749,7 +748,7 @@ uint64_t AppLayerTransactionGetActiveLogOnly(Flow *f, uint8_t flags) } /* logger is disabled, return highest 'complete' tx id */ - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate); + uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate); uint64_t idx = AppLayerParserGetTransactionInspectId(f->alparser, flags); int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(f->alproto, flags); void *tx; @@ -836,11 +835,11 @@ int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, SCReturnInt(r); } -uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate) +uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate) { SCEnter(); uint64_t r = 0; - r = alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto]. + r = alp_ctx.ctxs[f->protomap][f->alproto]. StateGetTxCnt(alstate); SCReturnCT(r, "uint64_t"); } @@ -1014,7 +1013,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow } if (AppLayerParserProtocolIsTxAware(f->proto, alproto)) { - p_tx_cnt = AppLayerParserGetTxCnt(f->proto, alproto, f->alstate); + p_tx_cnt = AppLayerParserGetTxCnt(f, f->alstate); } /* invoke the recursive parser, but only on data. We may get empty msgs on EOF */ @@ -1066,7 +1065,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow if (AppLayerParserProtocolIsTxAware(f->proto, alproto)) { if (likely(tv)) { - uint64_t cur_tx_cnt = AppLayerParserGetTxCnt(f->proto, alproto, f->alstate); + uint64_t cur_tx_cnt = AppLayerParserGetTxCnt(f, f->alstate); if (cur_tx_cnt > p_tx_cnt) { AppLayerIncTxCounter(tv, f, cur_tx_cnt - p_tx_cnt); } @@ -1128,7 +1127,7 @@ int AppLayerParserHasDecoderEvents(const Flow *f, } else { /* check each tx */ tx_id = AppLayerParserGetTransactionInspectId(pstate, flags); - max_id = AppLayerParserGetTxCnt(f->proto, f->alproto, alstate); + max_id = AppLayerParserGetTxCnt(f, alstate); for ( ; tx_id < max_id; tx_id++) { decoder_events = AppLayerParserGetEventsByTx(f->proto, f->alproto, alstate, tx_id); if (decoder_events && decoder_events->cnt) diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 83e6672d00..8318ef34e6 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -166,14 +166,16 @@ void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto a uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate); void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id); + void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate, void *tx, uint32_t logger); int AppLayerParserGetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate, void *tx, uint32_t logger); + uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction); -void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate, - const uint8_t ipproto, const AppProto alproto, void *alstate, - const uint8_t flags); +void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate, + void *alstate, const uint8_t flags); + AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate); void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents); AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *alstate, @@ -182,7 +184,7 @@ FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t direction); int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *alstate, uint8_t direction); -uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate); +uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate); void *AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id); int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction); int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name, diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index fee5ec2f17..3fcd5764c7 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -1657,6 +1657,7 @@ static int SMBParserTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -1737,6 +1738,7 @@ static int SMBParserTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2036,6 +2038,7 @@ static int SMBParserTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2158,6 +2161,7 @@ static int SMBParserTest04(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2421,6 +2425,7 @@ static int SMBParserTest07(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2498,6 +2503,7 @@ static int SMBParserTest08(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2616,6 +2622,7 @@ static int SMBParserTest09(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); @@ -2742,6 +2749,7 @@ static int SMBParserTest10(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMB; StreamTcpInitConfig(TRUE); diff --git a/src/app-layer-smtp.c b/src/app-layer-smtp.c index d55d862084..13a2327725 100644 --- a/src/app-layer-smtp.c +++ b/src/app-layer-smtp.c @@ -1792,6 +1792,7 @@ static int SMTPParserTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -2148,6 +2149,7 @@ static int SMTPParserTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -2783,6 +2785,7 @@ static int SMTPParserTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -2931,6 +2934,7 @@ static int SMTPParserTest04(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3079,6 +3083,7 @@ static int SMTPParserTest05(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3376,6 +3381,7 @@ static int SMTPParserTest06(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3615,6 +3621,7 @@ static int SMTPParserTest07(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3729,6 +3736,7 @@ static int SMTPParserTest08(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3843,6 +3851,7 @@ static int SMTPParserTest09(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -3957,6 +3966,7 @@ static int SMTPParserTest10(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -4065,6 +4075,7 @@ static int SMTPParserTest11(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); @@ -4159,6 +4170,7 @@ static int SMTPParserTest12(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_ESTABLISHED; @@ -4301,6 +4313,7 @@ static int SMTPParserTest13(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; p->flow = &f; p->flowflags |= FLOW_PKT_TOSERVER; p->flowflags |= FLOW_PKT_ESTABLISHED; @@ -4586,6 +4599,7 @@ static int SMTPParserTest14(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_SMTP; StreamTcpInitConfig(TRUE); SMTPTestInitConfig(); diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index a2c05cbc23..dc0b8e1fc8 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -1891,6 +1891,7 @@ static int SSLParserTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -1930,6 +1931,7 @@ static int SSLParserTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -1977,6 +1979,7 @@ static int SSLParserTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2032,6 +2035,7 @@ static int SSLParserTest04(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2090,6 +2094,7 @@ static int SSLParserTest05(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2201,6 +2206,7 @@ static int SSLParserTest06(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2351,6 +2357,7 @@ static int SSLParserMultimsgTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2415,6 +2422,7 @@ static int SSLParserMultimsgTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2464,6 +2472,7 @@ static int SSLParserTest07(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2504,6 +2513,7 @@ static int SSLParserTest08(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2630,6 +2640,7 @@ static int SSLParserTest09(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2692,6 +2703,7 @@ static int SSLParserTest10(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2753,6 +2765,7 @@ static int SSLParserTest11(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2819,6 +2832,7 @@ static int SSLParserTest12(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2896,6 +2910,7 @@ static int SSLParserTest13(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -2962,6 +2977,7 @@ static int SSLParserTest14(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3007,6 +3023,7 @@ static int SSLParserTest15(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3043,6 +3060,7 @@ static int SSLParserTest16(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3079,6 +3097,7 @@ static int SSLParserTest17(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3121,6 +3140,7 @@ static int SSLParserTest18(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3167,6 +3187,7 @@ static int SSLParserTest19(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3207,6 +3228,7 @@ static int SSLParserTest20(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3244,6 +3266,7 @@ static int SSLParserTest21(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3293,6 +3316,7 @@ static int SSLParserTest22(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3578,6 +3602,7 @@ static int SSLParserTest23(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -3723,6 +3748,7 @@ static int SSLParserTest24(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -4080,6 +4106,7 @@ static int SSLParserTest25(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); @@ -4234,6 +4261,7 @@ static int SSLParserTest26(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_TLS; StreamTcpInitConfig(TRUE); diff --git a/src/detect-engine-prefilter.c b/src/detect-engine-prefilter.c index d8c9fa3129..5478902cf4 100644 --- a/src/detect-engine-prefilter.c +++ b/src/detect-engine-prefilter.c @@ -101,7 +101,7 @@ static inline void PrefilterTx(DetectEngineThreadCtx *det_ctx, void *alstate = p->flow->alstate; uint64_t idx = AppLayerParserGetTransactionInspectId(p->flow->alparser, flags); - const uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate); + const uint64_t total_txs = AppLayerParserGetTxCnt(p->flow, alstate); /* HACK test HTTP state here instead of in each engine */ if (alproto == ALPROTO_HTTP) { diff --git a/src/detect-engine-state.c b/src/detect-engine-state.c index b8a98fccad..84e0afa8a7 100644 --- a/src/detect-engine-state.c +++ b/src/detect-engine-state.c @@ -256,7 +256,7 @@ static int HasStoredSigs(const Flow *f, const uint8_t flags) /* if state == 1 we also fall through */ uint64_t inspect_tx_id = AppLayerParserGetTransactionInspectId(f->alparser, flags); - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate); + uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); for ( ; inspect_tx_id < total_txs; inspect_tx_id++) { void *inspect_tx = AppLayerParserGetTx(f->proto, alproto, alstate, inspect_tx_id); @@ -394,7 +394,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, check_before_add = 1; } - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate); + uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); SCLogDebug("total_txs %"PRIu64, total_txs); SCLogDebug("starting: start tx %u, packet %u", (uint)tx_id, (uint)p->pcap_cnt); @@ -753,7 +753,7 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, } inspect_tx_id = AppLayerParserGetTransactionInspectId(f->alparser, flags); - total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate); + total_txs = AppLayerParserGetTxCnt(f, alstate); for ( ; inspect_tx_id < total_txs; inspect_tx_id++) { int inspect_tx_inprogress = 0; @@ -838,8 +838,8 @@ end: void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags) { if (f->alparser && f->alstate) { - AppLayerParserSetTransactionInspectId(f->alparser, f->proto, - f->alproto, f->alstate, flags); + AppLayerParserSetTransactionInspectId(f, f->alparser, + f->alstate, flags); } return; } @@ -861,7 +861,7 @@ void DetectEngineStateResetTxs(Flow *f) uint64_t inspect_tx_id = MIN(inspect_ts, inspect_tc); - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, alstate); + uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); for ( ; inspect_tx_id < total_txs; inspect_tx_id++) { void *inspect_tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, inspect_tx_id); diff --git a/src/detect-http-client-body.c b/src/detect-http-client-body.c index 13ffe54707..cdbc204d30 100644 --- a/src/detect-http-client-body.c +++ b/src/detect-http-client-body.c @@ -1441,7 +1441,7 @@ static int DetectHttpClientBodyTest14(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } @@ -1667,7 +1667,7 @@ static int DetectHttpClientBodyTest15(void) } /* hardcoded check of the transactions and it's client body chunks */ - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } diff --git a/src/detect-http-hh.c b/src/detect-http-hh.c index 382263aaa3..6ce5e2efc1 100644 --- a/src/detect-http-hh.c +++ b/src/detect-http-hh.c @@ -1447,7 +1447,7 @@ static int DetectHttpHHTest14(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } diff --git a/src/detect-http-hrh.c b/src/detect-http-hrh.c index ebefcb2369..0afd1d6ed9 100644 --- a/src/detect-http-hrh.c +++ b/src/detect-http-hrh.c @@ -1393,7 +1393,7 @@ static int DetectHttpHRHTest14(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } diff --git a/src/detect-http-server-body.c b/src/detect-http-server-body.c index a1901ef0fc..18ebe2eb3f 100644 --- a/src/detect-http-server-body.c +++ b/src/detect-http-server-body.c @@ -1598,7 +1598,7 @@ static int DetectHttpServerBodyTest14(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } @@ -1763,7 +1763,7 @@ static int DetectHttpServerBodyTest15(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } @@ -3714,7 +3714,7 @@ static int DetectHttpServerBodyFileDataTest09(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } @@ -3875,7 +3875,7 @@ static int DetectHttpServerBodyFileDataTest10(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } diff --git a/src/detect-http-ua.c b/src/detect-http-ua.c index c9019387b5..f2ca11ceb7 100644 --- a/src/detect-http-ua.c +++ b/src/detect-http-ua.c @@ -1394,7 +1394,7 @@ static int DetectHttpUATest14(void) goto end; } - if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) { + if (AppLayerParserGetTxCnt(&f, htp_state) != 2) { printf("The http app layer doesn't have 2 transactions, but it should: "); goto end; } diff --git a/src/detect-lua.c b/src/detect-lua.c index b5603c5d5b..1e3c4c6c7c 100644 --- a/src/detect-lua.c +++ b/src/detect-lua.c @@ -373,7 +373,7 @@ static int DetectLuaMatch (ThreadVars *tv, DetectEngineThreadCtx *det_ctx, htp_tx_t *tx = NULL; uint64_t idx = AppLayerParserGetTransactionInspectId(p->flow->alparser, STREAM_TOSERVER); - uint64_t total_txs= AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state); + uint64_t total_txs= AppLayerParserGetTxCnt(p->flow, htp_state); for ( ; idx < total_txs; idx++) { tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, idx); if (tx == NULL) diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 68b4eedbe5..aebc06a9d0 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -2701,7 +2701,7 @@ static int DetectPcreTxBodyChunksTest01(void) FAIL_IF(htp_state == NULL); /* hardcoded check of the transactions and it's client body chunks */ - FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2); + FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2); htp_tx_t *t1 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 0); htp_tx_t *t2 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 1); @@ -2870,7 +2870,7 @@ static int DetectPcreTxBodyChunksTest02(void) FAIL_IF(htp_state == NULL); /* hardcoded check of the transactions and it's client body chunks */ - FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2); + FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2); htp_tx_t *t1 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 0); htp_tx_t *t2 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 1); @@ -3044,7 +3044,7 @@ static int DetectPcreTxBodyChunksTest03(void) HtpState *htp_state = f.alstate; FAIL_IF(htp_state == NULL); - FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2); + FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2); if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index 0aa10c7941..4886bacccb 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -213,6 +213,7 @@ static int HTTPUriTest01(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_HTTP; f.flags |= FLOW_IPV4; StreamTcpInitConfig(TRUE); @@ -283,6 +284,7 @@ static int HTTPUriTest02(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_HTTP; f.flags |= FLOW_IPV4; StreamTcpInitConfig(TRUE); @@ -328,8 +330,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; @@ -355,6 +355,7 @@ static int HTTPUriTest03(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_HTTP; f.flags |= FLOW_IPV4; StreamTcpInitConfig(TRUE); @@ -400,8 +401,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; @@ -428,6 +427,7 @@ static int HTTPUriTest04(void) FLOW_INITIALIZE(&f); f.protoctx = (void *)&ssn; f.proto = IPPROTO_TCP; + f.alproto = ALPROTO_HTTP; f.flags |= FLOW_IPV4; StreamTcpInitConfig(TRUE); @@ -473,8 +473,6 @@ end: if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx); StreamTcpFreeConfig(TRUE); - if (htp_state != NULL) - HTPStateFree(htp_state); FLOWLOCK_UNLOCK(&f); FLOW_DESTROY(&f); return result; diff --git a/src/flow-timeout.c b/src/flow-timeout.c index f2c5718c03..adab394caf 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -320,7 +320,7 @@ int FlowForceReassemblyNeedReassembly(Flow *f, int *server, int *client) if (f->alproto != ALPROTO_UNKNOWN && f->alstate != NULL && AppLayerParserProtocolSupportsTxs(f->proto, f->alproto)) { - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate); + uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate); if (AppLayerParserGetTransactionActive(f, f->alparser, STREAM_TOCLIENT) < total_txs) { diff --git a/src/output-streaming.c b/src/output-streaming.c index bab641098a..7061301830 100644 --- a/src/output-streaming.c +++ b/src/output-streaming.c @@ -161,7 +161,7 @@ static int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags) // for each tx uint64_t tx_id = 0; - uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate); + const uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate); SCLogDebug("s->conn %p", s->conn); for (tx_id = 0; tx_id < total_txs; tx_id++) { // TODO optimization store log tx htp_tx_t *tx = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, tx_id); diff --git a/src/output-tx.c b/src/output-tx.c index 575bf5aa06..326d881b04 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -161,7 +161,7 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) goto end; } - uint64_t total_txs = AppLayerParserGetTxCnt(p->proto, alproto, alstate); + const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser); uint64_t max_id = tx_id; int logged = 0;