|
|
|
|
@ -211,6 +211,9 @@ static int DetectDNP3FuncSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
|
uint8_t function_code;
|
|
|
|
|
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_DNP3) != 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!DetectDNP3FuncParseFunctionCode(str, &function_code)) {
|
|
|
|
|
SCLogError(SC_ERR_INVALID_SIGNATURE,
|
|
|
|
|
"Invalid argument \"%s\" supplied to dnp3_func keyword.", str);
|
|
|
|
|
@ -229,8 +232,6 @@ static int DetectDNP3FuncSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
}
|
|
|
|
|
sm->type = DETECT_AL_DNP3FUNC;
|
|
|
|
|
sm->ctx = (void *)dnp3;
|
|
|
|
|
s->alproto = ALPROTO_DNP3;
|
|
|
|
|
s->flags |= SIG_FLAG_STATE_MATCH;
|
|
|
|
|
|
|
|
|
|
SigMatchAppendSMToList(s, sm, g_dnp3_match_buffer_id);
|
|
|
|
|
|
|
|
|
|
@ -298,6 +299,9 @@ static int DetectDNP3IndSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
|
uint16_t flags;
|
|
|
|
|
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_DNP3) != 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!DetectDNP3IndParse(str, &flags)) {
|
|
|
|
|
SCLogError(SC_ERR_INVALID_SIGNATURE,
|
|
|
|
|
"Invalid argument \"%s\" supplied to dnp3.ind keyword.", str);
|
|
|
|
|
@ -316,9 +320,6 @@ static int DetectDNP3IndSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
}
|
|
|
|
|
sm->type = DETECT_AL_DNP3IND;
|
|
|
|
|
sm->ctx = (void *)detect;
|
|
|
|
|
s->alproto = ALPROTO_DNP3;
|
|
|
|
|
s->flags |= SIG_FLAG_STATE_MATCH;
|
|
|
|
|
|
|
|
|
|
SigMatchAppendSMToList(s, sm, g_dnp3_match_buffer_id);
|
|
|
|
|
|
|
|
|
|
SCReturnInt(0);
|
|
|
|
|
@ -373,6 +374,9 @@ static int DetectDNP3ObjSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
DetectDNP3 *detect = NULL;
|
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
|
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_DNP3) != 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!DetectDNP3ObjParse(str, &group, &variation)) {
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
@ -390,8 +394,6 @@ static int DetectDNP3ObjSetup(DetectEngineCtx *de_ctx, Signature *s, const char
|
|
|
|
|
}
|
|
|
|
|
sm->type = DETECT_AL_DNP3OBJ;
|
|
|
|
|
sm->ctx = (void *)detect;
|
|
|
|
|
s->alproto = ALPROTO_DNP3;
|
|
|
|
|
s->flags |= SIG_FLAG_STATE_MATCH;
|
|
|
|
|
SigMatchAppendSMToList(s, sm, g_dnp3_match_buffer_id);
|
|
|
|
|
|
|
|
|
|
SCReturnInt(1);
|
|
|
|
|
@ -528,8 +530,10 @@ static void DetectDNP3ObjRegister(void)
|
|
|
|
|
static int DetectDNP3DataSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
|
|
|
|
|
{
|
|
|
|
|
SCEnter();
|
|
|
|
|
s->init_data->list = g_dnp3_data_buffer_id;
|
|
|
|
|
s->alproto = ALPROTO_DNP3;
|
|
|
|
|
if (DetectSignatureSetAppProto(s, ALPROTO_DNP3) != 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
DetectBufferSetActiveList(s, g_dnp3_data_buffer_id);
|
|
|
|
|
SCReturnInt(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|