The idea of an OK signature parsing error is an error that is
allowed to occur, but still lets test mode pass, unlike
silent errors which will still fail testing.
This is introduced to allow for app-layer event keywords to be
removed, but not have old rules fail out on this case. For example
the Rust DNS parser removes from DNS app-layer events that are
not used anymore.
To signal that an error is OK, -3 is returned. This also implies
silent.
if (rule_engine_analysis_set) {
EngineAnalysisRulesFailure(line, sig_file, lineno - multiline);
}
- bad++;
+ if (!de_ctx->sigerror_ok) {
+ bad++;
+ }
}
multiline = 0;
}
sig->gid = 1;
int ret = SigParse(de_ctx, sig, sigstr, dir, &parser);
- if (ret == -2) {
+ if (ret == -3) {
+ de_ctx->sigerror_silent = true;
+ de_ctx->sigerror_ok = true;
+ goto error;
+ }
+ else if (ret == -2) {
de_ctx->sigerror_silent = true;
goto error;
} else if (ret < 0) {
}
ret = DetectAppLayerEventPrepare(sig);
- if (ret == -2) {
+ if (ret == -3) {
+ de_ctx->sigerror_silent = true;
+ de_ctx->sigerror_ok = true;
+ goto error;
+ }
+ else if (ret == -2) {
de_ctx->sigerror_silent = true;
goto error;
} else if (ret < 0) {
char *rule_file;
int rule_line;
bool sigerror_silent;
+ bool sigerror_ok;
const char *sigerror;
/** list of keywords that need thread local ctxs */