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

prefilter engines v99g #2310

Merged
merged 134 commits into from Sep 29, 2016
Merged

prefilter engines v99g #2310

merged 134 commits into from Sep 29, 2016

Conversation

inliniac
Copy link
Contributor

Large overhaul of internals of the detection engine. Cleans up registration and calling of prefilter engines (e.g. MPM) and 'inspect engines' (per rule). New keywords need to touch much fewer files.

Introduces more generic prefilter engines than MPM. Prefiltering can support rules looking ttl, icode, seq, window and many more. This should make non-pattern based rules much more attractive. By default this prefiltering is not yet enabled. Use 'prefilter' in rules (like fast_pattern after the keyword that it should apply to) or enable globally: "detect.prefilter.default=auto".

Adds 2 new keywords: http_request_line and http_response_line. Both are 'stickybuffers' like file_data. Both are MPM enabled.

Known issue:

  • modbus inspection leads to duplicate alerts. cc: @daviddiallo

Prscript:

Add SigMatchGetLastSM which simply returns the very last SM added
to the signature.

Minor cleanups.
It's unused by all of the implementations.
In preparation of the introduction of more general purpose prefilter
engines, rename PatternMatcherQueue to PrefilterRuleStore. The new
engines will fill this structure a similar way to the current mpm
prefilters.
Rename to non_pf: non prefilter.
New name is SignatureNonPrefilterStore to reflect that it's not just
about MPM anymore.
Introduce abstraction layer for prefilter engines.
Inspect partial request line as well.
Move engine and registration into the keyword file.

Register as 'ALPROTO_UNKNOWN' instead of per alproto. The
registration will only apply it to those rules that have
events set.
The order of keyword registration currently affects inspect engine
registration order and ultimately the order of inspect engines per
rule. Which in turn affects state keeping.

This patch makes sure the ordering is the same as with older
releases.
Instead of the linked list of engines setup an array
with the engines. This should provide better locality.

Also shrink the engine structure so that we can fit
2 on a cacheline.

Remove the FreeFunc from the runtime engines. Engines
now have a 'gid' (global id) that can be used to look
up the registered Free function.
Currently the regular 'Header' inspection code will run each time
after the HTTP progress moved beyond 'headers'. This will include
the trailers if there are any.

Leave the code in place as this model will change in the not too
distant future.
@inliniac inliniac merged commit 5bd906a into master Sep 29, 2016
@inliniac
Copy link
Contributor Author

This one replaced #2289

@inliniac inliniac deleted the dev-prefilter-engines-v99g branch October 4, 2016 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants