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

Draft: Introduce support for DPDK secondary mode for workers runmode #7433

Closed
wants to merge 12 commits into from

Conversation

lukashino
Copy link
Contributor

Link to redmine ticket about Suricata secondary process support.
Link to redmine ticket about prefilter application.

This is a follow-up of #7283 which incorporates two Redmine tickets together, one for Suricata secondary mode support and the other for adding an app that would run as a primary process. The PR extends the work of #7283 by continuing in reaching the prefilter concept. As of now, the prefilter configures the provided NICs according to the YAML configuration and then passes packets to Suricata through DPDK rings. It also uses a message system between Suricata and Prefilter for asynchronous bypass method. Suricata can also load Prefilter configuration by reading Prefilter's shared configuration stored in a memory zone. The prefilter is intended to be architecturally flexible (not depending on any hardcoded module) but as of now, for some use-cases, the prefilter uses Suricata library.
Use flags --enable-dpdk --enable-dpdk-apps to enable Prefilter in the configuration process.
The plan is to have a shared DPDK configuration codebase for prefilter and Suricata. As of result, prior to the compilation of the prefilter app, Suricata needs to be first compiled and installed (together with headers and library). Makefile target dpdk-apps-prereq should solve the issue. After the Suricata library is installed, it needs to be added to the list of shared libraries (ldconfig) or at least edit LD_LIBRARY_PATH variable. Makefile target dpdk-apps compiles the prefitler app. The final prefilter binary can be found in dpdk/prefilter/build folder.

Changelog from #7283:

  • new asynchronous bypass support through message mechanism
  • Suricata reading Prefilter configuration from a shared configuration memory zone
  • bug fixes

lukashino added 12 commits May 25, 2022 13:48
Up to now, DPDK workers run as pthreads.
In DPDK terms, this has meant that they've been running
as non-registered non-EAL threads. This limits funcionality of
certain DPDK libraries (e.g. not using per-lcore cache for
rte_mempool or rte_ring limitations).
It is possible to register pthreads so they become registered
non-EAL threads. This mitigates the aforementioned limitations.
https://doc.dpdk.org/guides/prog_guide/env_abstraction_layer.html#non-eal-pthread-support

However, running Suricata as a secondary process would defy this
approach. According to the DPDK documentation, registered non-EAL
pthread behaves like a non-registered non-EAL pthread.
Support for running Suricata as a secondary process is a planned
extension of work.
https://doc.dpdk.org/api/rte__lcore_8h.html#a71e6840cf1fe8950cce8fd88d0859bce
Flag `--libs-only-L` of pkg-config should output a path where
libdpdk is stored. This usually happens when DPDK is installed
manually (from source) into a custom location. On the other hand,
there is no output when installing DPDK with a package manager.
For that reason, the linker flag `-Wl,-R,` remain incomplete.

The flag `-Wl,-R,` then binds incorrectly with the following output of
pkg-config. The output of `pkg-config --libs libdpdk` contains linker
flag `--as-need` to remove unnecessary libraries during the linking.
It is silently skipped and the binary is linked with all of the DPDK
libraries.
Implement secondary mode operation in Suricata.
Receive packets over DPDK rings. To each worker assign a separate ring.
Provide configuration options specific for the secondary mode
along with possibility to specify arbitrary ring name.
Add relevant documentation.
Flag introduces a lock to the Flow objects that makes the Flow object
unavailable to packet threads but still available to management threads.
When a new packet of the flow is received, the packet threads should,
instead of using the existing one, create a new flow record. The lock
is expected to be used for possibly soon-to-be-evicted flows where
touching the existing flow would not be correct.
… as a secondary process

Prefitler app receives the traffic and enqueues it to the rings to Suricata.
Suricata can do bypass (add/update/delete) operations on flows through
a bypass channel that is between Prefilter and Suricata.
One Prefilter core can distribute to multiple Suricata workers.
Prefilter can be enabled in the configuration process with flags
`--enable-dpdk --enable-dpdk-apps`.
@codecov
Copy link

codecov bot commented May 27, 2022

Codecov Report

Merging #7433 (98df185) into master (0b51022) will decrease coverage by 0.01%.
The diff coverage is 22.53%.

@@            Coverage Diff             @@
##           master    #7433      +/-   ##
==========================================
- Coverage   75.91%   75.89%   -0.02%     
==========================================
  Files         656      656              
  Lines      189943   190004      +61     
==========================================
+ Hits       144189   144208      +19     
- Misses      45754    45796      +42     
Flag Coverage Δ
fuzzcorpus 60.56% <1.53%> (+<0.01%) ⬆️
suricata-verify 51.86% <25.80%> (-0.03%) ⬇️
unittests 61.05% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@catenacyber
Copy link
Contributor

@lukashino do you need feedback on this ?
Or can you rebase it ?

@lukashino
Copy link
Contributor Author

This is supposed to be a preview PR. I would like to get feedback on this, however, I believe in a short span I will push a new version with more things so we might just wait for that one. Thanks.
Alternatively, we can close this one for now.

@catenacyber
Copy link
Contributor

Ok, then waiting for the next :-)

@victorjulien
Copy link
Member

Can you push a rebased version of this?

@lukashino
Copy link
Contributor Author

Rebased and updated version continues in #7818

@lukashino lukashino closed this Sep 2, 2022
victorjulien added a commit to victorjulien/suricata that referenced this pull request Dec 4, 2024
Default decoder event alert was very sparse, not even logging packet
type and pcap_cnt. Expand support for this record type. It will be more
useful with the ethernet headers and packet field, but these are still
disabled by default.

Ticket: OISF#7433.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Dec 4, 2024
Default decoder event alert was very sparse, not even logging packet
type and pcap_cnt. Expand support for this record type. It will be more
useful with the ethernet headers and packet field, but these are still
disabled by default.

Ticket: OISF#7433.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Dec 5, 2024
Default decoder event alert was very sparse, not even logging packet
type and pcap_cnt. Expand support for this record type. It will be more
useful with the ethernet headers and packet field, but these are still
disabled by default.

Ticket: OISF#7433.
victorjulien added a commit to victorjulien/suricata that referenced this pull request Dec 6, 2024
Default decoder event alert was very sparse, not even logging packet
type and pcap_cnt. Expand support for this record type. It will be more
useful with the ethernet headers and packet field, but these are still
disabled by default.

Ticket: OISF#7433.
(cherry picked from commit 2fe2cf8)
victorjulien added a commit to victorjulien/suricata that referenced this pull request Dec 7, 2024
Default decoder event alert was very sparse, not even logging packet
type and pcap_cnt. Expand support for this record type. It will be more
useful with the ethernet headers and packet field, but these are still
disabled by default.

Ticket: OISF#7433.
(cherry picked from commit 2fe2cf8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Needs rebase to master
Development

Successfully merging this pull request may close these issues.

3 participants