Skip to content

Installation tempesta supported regex

AlexandrGoncharov edited this page Jul 25, 2024 · 4 revisions

At first it is necessary to install dependencies for Hyperscan.

Colm (Colm Programming Language)

git clone https://github.com/adrian-thurston/colm.git

./autogen.sh
./configure
make
make install

add LD_LIBRARY_PATH="/usr/local/lib" to /etc/environment

Regal

git clone https://github.com/adrian-thurston/ragel.git

./autogen.sh
./configure --with-colm=/usr/local
make
make install

PCRE

download PCRE from sourceforge

wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz

tar -xf archive.tar.gz

./configure  --enable-pcre16 --enable-pcre32
make
make install

Hyperscan

git clone https://github.com/tempesta-tech/linux-regex-module.git
git checkout ag_changes_for_easy_installation

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ./
make
make install

Description of additional cmake options for Hyperscan

Tempesta FW version with regex

git clone https://github.com/tempesta-tech/tempesta.git
cd tempesta
git checkout ag_Multi-pattern-regular-expressions

Using in http_chain

  • ~: "<string_of_regex>" => regex, case sensitive regular expression
  • ~*: "<string_of_regex>" => regex, case insensitive regular expression

Using for locations

  • location ~ "<string_of_regex>"
  • location ~* "<string_of_regex>"

For regular expression syntax, read the Perl regular expressions man page. https://perldoc.perl.org/perlre#Capture-groups.

Not all capability implemented in Hyperscan, a list of supported and unsupported expressions is here http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support

Description of the implementation.

G-Core linux regex module added to Tempesta FW as an additional module. Avx-512 extensions are disabled in makefile of regex. (I don't have these instructions in my CPU, but Hyperscan chooses them by default and kernel crashes happened.)

Starting process.

When reading config file in tempesta_fw module, any regular expression is written to a separate text file which also contains the number of regex. This number is associated with this regular expression inside tempesta_fw module.

When tempesta_fw module is already started, external application hscollider compiles all created text files with regular expression and save results to DB format. After this, DB files are placed in a special directory for xdp_rex (/sys/kernel/config/rex/). This process may take about a couple of seconds.

Stopping process.

Before stopping xdp_rex module all databases must be deleted from /sys/kernel/config/rex/ directory

Clone this wiki locally