Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor optimizations/v1 #12398

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/detect-engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,10 @@ static int DetectEngineInspectRulePayloadMatches(
SCLogDebug("SIG_FLAG_REQUIRE_STREAM_ONLY, so no match");
return DETECT_ENGINE_INSPECT_SIG_NO_MATCH;
}
if (s->flags & SIG_FLAG_REQUIRE_STREAM_ONLY) {
SCLogDebug("SIG_FLAG_REQUIRE_STREAM_ONLY, so no match");
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return DETECT_ENGINE_INSPECT_SIG_NO_MATCH for consistency?
as

src/detect-engine-state.h:#define DETECT_ENGINE_INSPECT_SIG_NO_MATCH 0

}
Comment on lines +1958 to +1961
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference b/w this and the branch right above this?

if (DetectEngineInspectPacketPayload(de_ctx, det_ctx, s, p->flow, p) != 1) {
return DETECT_ENGINE_INSPECT_SIG_NO_MATCH;
}
Expand Down
7 changes: 7 additions & 0 deletions src/detect-flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,13 @@ int DetectFlowSetup (DetectEngineCtx *de_ctx, Signature *s, const char *flowstr)
DetectFlowFree(de_ctx, fd);
}

if (parse_flags & DETECT_FLOW_FLAG_ONLYSTREAM) {
s->flags |= (SIG_FLAG_REQUIRE_STREAM | SIG_FLAG_REQUIRE_STREAM_ONLY);
}
if (parse_flags & DETECT_FLOW_FLAG_NOSTREAM) {
s->flags |= SIG_FLAG_REQUIRE_PACKET;
}

if (parse_flags & DETECT_FLOW_FLAG_ONLYSTREAM) {
s->flags |= (SIG_FLAG_REQUIRE_STREAM | SIG_FLAG_REQUIRE_STREAM_ONLY);
}
Expand Down