|
|
|
|
@ -268,11 +268,12 @@ static uint8_t invalidLengthPDUWriteMultipleRegistersReq[] = {
|
|
|
|
|
/* Function code */ 0x10};
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Read Coils request/response. */
|
|
|
|
|
static int ModbusParserTest01(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest01(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -303,21 +304,21 @@ static int ModbusParserTest01(void) {
|
|
|
|
|
STREAM_TOCLIENT, readCoilsRsp,
|
|
|
|
|
sizeof(readCoilsRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Write Multiple registers request/response. */
|
|
|
|
|
static int ModbusParserTest02(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest02(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -356,18 +357,17 @@ static int ModbusParserTest02(void) {
|
|
|
|
|
STREAM_TOCLIENT, writeMultipleRegistersRsp,
|
|
|
|
|
sizeof(writeMultipleRegistersRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Read/Write Multiple registers request/response with mismatch value. */
|
|
|
|
|
static int ModbusParserTest03(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest03(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -375,6 +375,7 @@ static int ModbusParserTest03(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -442,33 +443,30 @@ static int ModbusParserTest03(void) {
|
|
|
|
|
STREAM_TOCLIENT, readWriteMultipleRegistersRsp,
|
|
|
|
|
sizeof(readWriteMultipleRegistersRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Force Listen Only Mode request. */
|
|
|
|
|
static int ModbusParserTest04(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest04(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -491,7 +489,6 @@ static int ModbusParserTest04(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 8);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetSubfunction(&request) == 4);
|
|
|
|
|
|
|
|
|
|
@ -502,8 +499,8 @@ static int ModbusParserTest04(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus invalid Protocol version in request. */
|
|
|
|
|
static int ModbusParserTest05(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest05(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -511,6 +508,7 @@ static int ModbusParserTest05(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -556,25 +554,22 @@ static int ModbusParserTest05(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus unsolicited response. */
|
|
|
|
|
static int ModbusParserTest06(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest06(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -582,6 +577,7 @@ static int ModbusParserTest06(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -627,25 +623,22 @@ static int ModbusParserTest06(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus invalid Length request. */
|
|
|
|
|
static int ModbusParserTest07(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest07(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -653,6 +646,7 @@ static int ModbusParserTest07(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -699,25 +693,22 @@ static int ModbusParserTest07(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Read Coils request and error response with Exception code invalid. */
|
|
|
|
|
static int ModbusParserTest08(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest08(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -725,6 +716,7 @@ static int ModbusParserTest08(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -770,7 +762,6 @@ static int ModbusParserTest08(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 1);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetReadRequestAddress(&request) == 0x7890);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetReadRequestQuantity(&request) == 19);
|
|
|
|
|
@ -779,24 +770,20 @@ static int ModbusParserTest08(void) {
|
|
|
|
|
STREAM_TOCLIENT, readCoilsErrorRsp,
|
|
|
|
|
sizeof(readCoilsErrorRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -834,7 +821,6 @@ static int ModbusParserTest09(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 1);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetReadRequestAddress(&request) == 0x7890);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetReadRequestQuantity(&request) == 19);
|
|
|
|
|
@ -850,7 +836,6 @@ static int ModbusParserTest09(void) {
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS,
|
|
|
|
|
STREAM_TOCLIENT, input, input_len);
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
@ -864,10 +849,10 @@ static int ModbusParserTest10(void) {
|
|
|
|
|
uint32_t input_len = sizeof(readCoilsReq) + sizeof(writeMultipleRegistersReq);
|
|
|
|
|
uint8_t *input, *ptr;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
input = (uint8_t *) SCMalloc (input_len * sizeof(uint8_t));
|
|
|
|
|
@ -892,12 +877,10 @@ static int ModbusParserTest10(void) {
|
|
|
|
|
|
|
|
|
|
ModbusState *modbus_state = f.alstate;
|
|
|
|
|
FAIL_IF_NULL(modbus_state);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 2);
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 1);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 16);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetWriteMultreqAddress(&request) == 0x01);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetWriteMultreqQuantity(&request) == 2);
|
|
|
|
|
@ -922,38 +905,36 @@ static int ModbusParserTest10(void) {
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT, input, input_len);
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
SCFree(input);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus exceed Length request. */
|
|
|
|
|
static int ModbusParserTest11(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest11(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
Signature *s = NULL;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
size_t input_len = 65536;
|
|
|
|
|
uint8_t *input = SCCalloc(1, input_len);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(input == NULL);
|
|
|
|
|
|
|
|
|
|
memcpy(input, exceededLengthWriteMultipleRegistersReq,
|
|
|
|
|
sizeof(exceededLengthWriteMultipleRegistersReq));
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF(alp_tctx == NULL);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
memset(&f, 0, sizeof(Flow));
|
|
|
|
|
memset(&ssn, 0, sizeof(TcpSession));
|
|
|
|
|
|
|
|
|
|
p = UTHBuildPacket(NULL, 0, IPPROTO_TCP);
|
|
|
|
|
Packet *p = UTHBuildPacket(NULL, 0, IPPROTO_TCP);
|
|
|
|
|
|
|
|
|
|
FLOW_INITIALIZE(&f);
|
|
|
|
|
f.alproto = ALPROTO_MODBUS;
|
|
|
|
|
@ -972,11 +953,11 @@ static int ModbusParserTest11(void) {
|
|
|
|
|
FAIL_IF_NULL(de_ctx);
|
|
|
|
|
|
|
|
|
|
de_ctx->flags |= DE_QUIET;
|
|
|
|
|
s = DetectEngineAppendSig(de_ctx, "alert modbus any any -> any any "
|
|
|
|
|
"(msg:\"Modbus invalid Length\"; "
|
|
|
|
|
"app-layer-event: "
|
|
|
|
|
"modbus.invalid_length; "
|
|
|
|
|
"sid:1;)");
|
|
|
|
|
Signature *s = DetectEngineAppendSig(de_ctx, "alert modbus any any -> any any "
|
|
|
|
|
"(msg:\"Modbus invalid Length\"; "
|
|
|
|
|
"app-layer-event: "
|
|
|
|
|
"modbus.invalid_length; "
|
|
|
|
|
"sid:1;)");
|
|
|
|
|
FAIL_IF_NULL(s);
|
|
|
|
|
|
|
|
|
|
SigGroupBuild(de_ctx);
|
|
|
|
|
@ -991,32 +972,30 @@ static int ModbusParserTest11(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
SCFree(input);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus invalid PDU Length. */
|
|
|
|
|
static int ModbusParserTest12(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest12(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
Signature *s = NULL;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -1042,11 +1021,11 @@ static int ModbusParserTest12(void) {
|
|
|
|
|
FAIL_IF_NULL(de_ctx);
|
|
|
|
|
|
|
|
|
|
de_ctx->flags |= DE_QUIET;
|
|
|
|
|
s = DetectEngineAppendSig(de_ctx, "alert modbus any any -> any any "
|
|
|
|
|
"(msg:\"Modbus invalid Length\"; "
|
|
|
|
|
"app-layer-event: "
|
|
|
|
|
"modbus.invalid_length; "
|
|
|
|
|
"sid:1;)");
|
|
|
|
|
Signature *s = DetectEngineAppendSig(de_ctx, "alert modbus any any -> any any "
|
|
|
|
|
"(msg:\"Modbus invalid Length\"; "
|
|
|
|
|
"app-layer-event: "
|
|
|
|
|
"modbus.invalid_length; "
|
|
|
|
|
"sid:1;)");
|
|
|
|
|
FAIL_IF_NULL(s);
|
|
|
|
|
|
|
|
|
|
SigGroupBuild(de_ctx);
|
|
|
|
|
@ -1063,28 +1042,26 @@ static int ModbusParserTest12(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Mask Write register request/response. */
|
|
|
|
|
static int ModbusParserTest13(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest13(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -1107,7 +1084,6 @@ static int ModbusParserTest13(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 22);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetAndMask(&request) == 0x00F2);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetOrMask(&request) == 0x0025);
|
|
|
|
|
@ -1116,7 +1092,6 @@ static int ModbusParserTest13(void) {
|
|
|
|
|
STREAM_TOCLIENT, maskWriteRegisterRsp,
|
|
|
|
|
sizeof(maskWriteRegisterRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
@ -1126,11 +1101,12 @@ static int ModbusParserTest13(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus Write single register request/response. */
|
|
|
|
|
static int ModbusParserTest14(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest14(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -1153,7 +1129,6 @@ static int ModbusParserTest14(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 6);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetWriteAddress(&request) == 0x0001);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetWriteData(&request) == 0x0003);
|
|
|
|
|
@ -1162,18 +1137,17 @@ static int ModbusParserTest14(void) {
|
|
|
|
|
STREAM_TOCLIENT, writeSingleRegisterRsp,
|
|
|
|
|
sizeof(writeSingleRegisterRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send invalid Modbus Mask Write register request. */
|
|
|
|
|
static int ModbusParserTest15(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest15(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -1181,6 +1155,7 @@ static int ModbusParserTest15(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -1226,41 +1201,35 @@ static int ModbusParserTest15(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 22);
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS,
|
|
|
|
|
STREAM_TOCLIENT, maskWriteRegisterRsp,
|
|
|
|
|
sizeof(maskWriteRegisterRsp));
|
|
|
|
|
FAIL_IF_NOT(r == 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
ModbusMessage response = SCModbusStateGetTxResponse(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(response._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&response) == 22);
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send invalid Modbus Mask Write register request. */
|
|
|
|
|
static int ModbusParserTest16(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest16(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -1268,6 +1237,7 @@ static int ModbusParserTest16(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -1314,7 +1284,6 @@ static int ModbusParserTest16(void) {
|
|
|
|
|
|
|
|
|
|
ModbusMessage request = SCModbusStateGetTxRequest(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(request._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&request) == 6);
|
|
|
|
|
size_t data_len;
|
|
|
|
|
const uint8_t *data = SCModbusMessageGetBytevecData(&request, &data_len);
|
|
|
|
|
@ -1324,7 +1293,6 @@ static int ModbusParserTest16(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS,
|
|
|
|
|
@ -1335,28 +1303,27 @@ static int ModbusParserTest16(void) {
|
|
|
|
|
FAIL_IF_NOT(SCModbusStateGetTxCount(modbus_state) == 1);
|
|
|
|
|
ModbusMessage response = SCModbusStateGetTxResponse(modbus_state, 0);
|
|
|
|
|
FAIL_IF_NULL(response._0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetFunction(&response) == 6);
|
|
|
|
|
FAIL_IF_NOT(SCModbusMessageGetWriteAddress(&response) == 0x0001);
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
PASS;}
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Checks if stream_depth is correct */
|
|
|
|
|
static int ModbusParserTest17(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest17(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -1372,32 +1339,30 @@ static int ModbusParserTest17(void) {
|
|
|
|
|
int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER,
|
|
|
|
|
readCoilsReq, sizeof(readCoilsReq));
|
|
|
|
|
FAIL_IF(r != 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(f.alstate == NULL);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT,
|
|
|
|
|
readCoilsRsp, sizeof(readCoilsRsp));
|
|
|
|
|
FAIL_IF(r != 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*/ \test Checks if stream depth is correct over 2 TCP packets */
|
|
|
|
|
static int ModbusParserTest18(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest18(void)
|
|
|
|
|
{
|
|
|
|
|
Flow f;
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
|
|
|
|
|
uint32_t input_len = sizeof(readCoilsReq), part2_len = 3;
|
|
|
|
|
uint8_t *input = readCoilsReq;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&f, 0, sizeof(f));
|
|
|
|
|
@ -1413,15 +1378,12 @@ static int ModbusParserTest18(void) {
|
|
|
|
|
int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER,
|
|
|
|
|
input, input_len - part2_len);
|
|
|
|
|
FAIL_IF(r != 1);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOSERVER,
|
|
|
|
|
input, input_len);
|
|
|
|
|
FAIL_IF(r != 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(f.alstate == NULL);
|
|
|
|
|
|
|
|
|
|
input_len = sizeof(readCoilsRsp);
|
|
|
|
|
@ -1431,24 +1393,22 @@ static int ModbusParserTest18(void) {
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT,
|
|
|
|
|
input, input_len - part2_len);
|
|
|
|
|
FAIL_IF(r != 1);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_MODBUS, STREAM_TOCLIENT,
|
|
|
|
|
input, input_len);
|
|
|
|
|
FAIL_IF(r != 0);
|
|
|
|
|
|
|
|
|
|
FAIL_IF(((TcpSession *)(f.protoctx))->reassembly_depth != MODBUS_CONFIG_DEFAULT_STREAM_DEPTH);
|
|
|
|
|
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \test Send Modbus invalid function. */
|
|
|
|
|
static int ModbusParserTest19(void) {
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
static int ModbusParserTest19(void)
|
|
|
|
|
{
|
|
|
|
|
DetectEngineThreadCtx *det_ctx = NULL;
|
|
|
|
|
Flow f;
|
|
|
|
|
Packet *p = NULL;
|
|
|
|
|
@ -1456,6 +1416,7 @@ static int ModbusParserTest19(void) {
|
|
|
|
|
TcpSession ssn;
|
|
|
|
|
ThreadVars tv;
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
|
|
|
|
|
FAIL_IF_NULL(alp_tctx);
|
|
|
|
|
|
|
|
|
|
memset(&tv, 0, sizeof(ThreadVars));
|
|
|
|
|
@ -1502,19 +1463,16 @@ static int ModbusParserTest19(void) {
|
|
|
|
|
|
|
|
|
|
/* do detect */
|
|
|
|
|
SigMatchSignatures(&tv, de_ctx, det_ctx, p);
|
|
|
|
|
|
|
|
|
|
FAIL_IF_NOT(PacketAlertCheck(p, 1));
|
|
|
|
|
|
|
|
|
|
SigGroupCleanup(de_ctx);
|
|
|
|
|
SigCleanSignatures(de_ctx);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
DetectEngineThreadCtxDeinit(&tv, (void *)det_ctx);
|
|
|
|
|
DetectEngineCtxFree(de_ctx);
|
|
|
|
|
|
|
|
|
|
AppLayerParserThreadCtxFree(alp_tctx);
|
|
|
|
|
StreamTcpFreeConfig(true);
|
|
|
|
|
FLOW_DESTROY(&f);
|
|
|
|
|
UTHFreePackets(&p, 1);
|
|
|
|
|
StatsThreadCleanup(&tv);
|
|
|
|
|
PASS;
|
|
|
|
|
}
|
|
|
|
|
#endif /* UNITTESTS */
|
|
|
|
|
|