-
Notifications
You must be signed in to change notification settings - Fork 109
Implementation multi pattern regular expressions #2161
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
base: master
Are you sure you want to change the base?
Conversation
|
For deployment see file install.txt. Description will be expanded. |
|
This PR works on Kernel 6.8.9 Description of using hscollider - http://intel.github.io/hyperscan/dev-reference/tools.html Description of regular expression syntax - https://perldoc.perl.org/perlre Now regex implemented in tempasta config as fallows: for example: |
5c02ff5 to
8c64bfa
Compare
4f4608e to
d932ab5
Compare
|
I squashed it into one commit so it can be reviewed. |
5f2b864 to
09f70b3
Compare
Made regex configuration same way as in Nginx.
`rex_scan_tfwstr()` is intended to be called in softIRQ context, therefore don't call `kernel_fpu_begin()` because it being called before handling softIRQ.
Beside the part which allows to apply regular expressions to raw headers this patch changes string matching for raw headers. Matching consist of two parts: matching a header name and matching a header value. Name always matches by simple string comparison, when this part is successfull Tempesta matches value by string comparasion or using regular expressions. Name matching relies on header validity that guaranteed by parser, it always assume that name of a header doesn't have OWS for HTTP1 and always lower case for HTTP2. OWS are allowed only for value and only for HTTP1. For HTTP2 we use memcmp_fast() to compare chunks of header name, because a lot of small chunks not expected for HTTP2, we place headers into big contigious chunks during hpack decoding. However, for HTTP1 we use __str_cmp() that is simplified version of strncasecmp(), but doesn't do tolower() for pattern, only for headwer part. Pattern for string comparison now always lower case and space trimmed during configuration stage on startup of Tempesta. Also I did my best to get rid of branches inside the loops where it is possible, making function inline with conditional argument known at compile time. Alternatives are indirect calls and macroses: the former might be slow (they are in my benchmarks) the second make the code hard to read.
Enabling avx512 causing compilation time wanings relateed to string fortification. Compiler can't check the size of the data, because the length of the data calculates at runtime. Do unsafe copy to suppress the warnings.
09f70b3 to
7f2013e
Compare
7f2013e to
88c3570
Compare
No description provided.