Commit Graph

18 Commits (8a59ad60960fba187b78e88949bae37a664dbf94)

Author SHA1 Message Date
Victor Julien 4e8d38348f flow: no bypass manager for Windows 6 years ago
Victor Julien 287b87b81b bypass: switch to gettimeofday 6 years ago
Eric Leblond 4ba02830b6 flow-bypass: registration of non periodic check
This patch adds the capability to register a set of functions
without providing a periodic check function. This permit to
run a task only at init.
6 years ago
Eric Leblond de52e78e65 bypass: flow bypass is not ebpf only 6 years ago
Eric Leblond 0bfbb4a889 bypass: fix accounting
The flow bypass stats is computed at every pass so the accounting
needs to be done at each pass. This patch fixes the accounting
in the flow_bypassed counters.
6 years ago
Eric Leblond f8aa9ee986 bypass: fix wait time at exit
The loop on bypassed flow maps can take a few seconds on heavily
loaded system causing Suricata to not honor a stop before a few
seconds.

This patch adds the code needed to detect the need to exit from
the check loop.
6 years ago
Eric Leblond 1992093c88 flow-bypass: rename variables 6 years ago
Eric Leblond b736344975 flow-bypass: clock_gettime error handling
Only reason clock_gettime could fail is a permission so let's
error and leave the flow bypass manager if it is the case.

Also let's suppress the error message if ever the error appear in
the middle of a run (which is unlikely).
6 years ago
Eric Leblond b8e184ceb5 flow-bypass: fix timeout of maps bypassed flows
The time is taken from the parameter and is checked against real
flow entries so we need a standard time.
6 years ago
Eric Leblond 880c42f11c af-packet: bypass with init function 6 years ago
Eric Leblond 315c29a8e6 ebpf: change the logic to avoid ktime usage
Kernel time is not available (and/or costly) on NIC such as
Netronome so we update the logic to detect dead flows based on a
lack of update of packets counters. This way, the XDP filter will
be usable by network card.

This patch also updates the ebpf code to support per CPU and
regular mapping. Netronome is not supporting it and the structure
is using atomic for counter so the cost of simultaneous update
is really low.

This patch also updates the xdp_filter to be able to select if the
flow table is per CPU on shared. Second option will be used for
hardward offload. To deactivate the per cpu hash, you need to set
USE_PERCPU_HASH to 0.

This patch also adds an new option to af-packet named no-percpu-hash
If this option is set to yes then the Flow bypassed manager thread
will use one CPU instead of the number of cores. By doing that
we are able to handle the case where USE_PERCPU_HASH is unset (so
hardware offload for Netronome).

This patch also remove aligment indications in the eBPF filter. This
was not really needed and it seems it is causing problem with
some recent version of LLVM toolchain.
6 years ago
Eric Leblond 58b804f7d2 flow-bypass: set thread name to FB 7 years ago
Eric Leblond 7bec54158f flow-bypass: introduce update function
Main objective of the function is to be able to bypass a flow on
other interfaces. This is necessary in AF_PACKET case as the flow
table are per interface.
8 years ago
Eric Leblond cde438f670 af-packet: add missing copyright header
And also fixes the copyright date in some files.
8 years ago
Eric Leblond e2d31e1c57 flow-bypass: fix sleep strategy 8 years ago
Eric Leblond 08eec0833e flow-bypass: add abstraction layer
The flow bypass thread can now be used by any capture method that
register it timeout check function.
8 years ago
Eric Leblond 31c947b4d8 af-packet: use per CPU hash in bypass
eBPF has a data type which is a per CPU array. By adding one element
to the array it is in fact added to all per CPU arrays in the kernel.
This allows to have a lockless structure in the kernel even when doing
counter update.

In userspace, we need to update the flow bypass code to fetch all
elements of the per CPU arrays.
8 years ago
Eric Leblond 06173267c6 af-packet: kernel bypass implementation
This patch implements bypass capability for af-packet.

The filter only bypass TCP and UDP in IPv4 and IPv6. It don't
don't bypass IPv6 with extended headers.

This patch also introduces a bypassed flow manager that takes
care of timeouting the bypassed flows. It uses a 60 sec
timeout on flow. As they are supposed to be active we can
try that. If they are not active then we don't care to get them
back in Suricata.
8 years ago