diff --git a/src/detect-fast-pattern.c b/src/detect-fast-pattern.c index a16c3fb9b1..c7d0ed2958 100644 --- a/src/detect-fast-pattern.c +++ b/src/detect-fast-pattern.c @@ -74,9 +74,13 @@ static int DetectFastPatternSetup(DetectEngineCtx *de_ctx, Signature *s, char *n } if (s->pmatch_tail == NULL) { - SCLogError(SC_ERR_INVALID_SIGNATURE, "fast_pattern found inside the " - "rule, without any preceding keywords"); - return -1; + SCLogWarning(SC_WARN_COMPATIBILITY, " a fast_pattern found inside the " + "rule, is not preceding a keyword that support (currently)" + " this optimization. At least, the engine support " + "fast_pattern for content (not for uricontent yet). " + "The signature is being loaded anyway ==> %s", + s->sig_str); + return 0; } SigMatch *pm = DetectContentGetLastPattern(s->pmatch_tail); diff --git a/src/detect-parse.c b/src/detect-parse.c index 2b2e66c5a4..201d75f7ce 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -912,6 +912,7 @@ int SigParse(DetectEngineCtx *de_ctx, Signature *s, char *sigstr, uint8_t addrs_ SCEnter(); char **basics; + s->sig_str = sigstr; int ret = SigParseBasics(s, sigstr, &basics, addrs_direction); if (ret < 0) { @@ -944,6 +945,8 @@ int SigParse(DetectEngineCtx *de_ctx, Signature *s, char *sigstr, uint8_t addrs_ SCFree(basics); } + s->sig_str = NULL; + SCReturnInt(ret); } diff --git a/src/detect.h b/src/detect.h index 22ebb91b9f..9259e984af 100644 --- a/src/detect.h +++ b/src/detect.h @@ -312,6 +312,10 @@ typedef struct Signature_ { /** Reference */ Reference *references; + /* Be careful, this pointer is only valid while parsing the sig, + * to warn the user about any possible problem */ + char *sig_str; + #ifdef PROFILING uint16_t profiling_id; #endif diff --git a/src/util-error.c b/src/util-error.c index 4c3d5f5ddd..d439249014 100644 --- a/src/util-error.c +++ b/src/util-error.c @@ -187,6 +187,7 @@ const char * SCErrorToString(SCError err) CASE_CODE (SC_ERR_ERF_DAG_STREAM_SET_FAILED); CASE_CODE (SC_ERR_ERF_DAG_STREAM_READ_FAILED); CASE_CODE (SC_WARN_ERF_DAG_REC_LEN_CHANGED); + CASE_CODE (SC_WARN_COMPATIBILITY); CASE_CODE (SC_ERR_DCERPC); default: diff --git a/src/util-error.h b/src/util-error.h index 1ca952808b..4d6a88b152 100644 --- a/src/util-error.h +++ b/src/util-error.h @@ -188,6 +188,7 @@ typedef enum { SC_ERR_LIBCAP_NG_REQUIRED, SC_ERR_LIBNET11_INCOMPATIBLE_WITH_LIBCAP_NG, SC_WARN_FLOW_EMERGENCY, + SC_WARN_COMPATIBILITY, SC_ERR_SVC, SC_ERR_ERF_DAG_OPEN_FAILED, SC_ERR_ERF_DAG_STREAM_OPEN_FAILED,