]> git.ipfire.org Git - thirdparty/suricata.git/commit
bpf: refactor the BPF code and postpone querying of the engine mode
authorLukas Sismis <lsismis@oisf.net>
Fri, 31 Mar 2023 12:31:59 +0000 (14:31 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 1 May 2023 14:40:29 +0000 (16:40 +0200)
commit5a6d5702a48288c70d9a0787cd6fd685964079b4
treec2c604f42230473796250520fe96e1f1d43fe763
parent22485b368e375d90df0e4129684a1ea54d9b67ff
bpf: refactor the BPF code and postpone querying of the engine mode

BPF codebase queried engine mode earlier than it was determined from
the configuration file/command line. As a result it used the default (IDS)
mode where it could've been configured later on to the IPS mode.
This could lead into an undefined behavior as some Suricata modules behave
according to the engine mode.

PF-Ring, Netmap and AF-Packet all shared almost identical code for
determining the engine mode. It was put into one common function.
Omitted the usage of SCStrdup function in PF-Ring module as it is
uppercased during thread initialization phase.

Ticket: #5957
src/runmode-af-packet.c
src/runmode-netmap.c
src/runmode-pfring.c
src/source-pfring.h
src/suricata.c
src/util-bpf.c
src/util-bpf.h