Commit Graph

50 Commits (d1e9db7bb8d74ecbc494d548e2a598cc64445373)

Author SHA1 Message Date
TripleA150 d1e9db7bb8 ndpi: add ndpi.license configuration option
nDPI 6.0 requires the application to declare under which license the
library is used and, for for-profit use without an agreement with
ntop, does not load its dual-licensed dissectors (DHCP, DNS, QUIC and
TLS as of 6.0), so rules on those protocols never fire.

Expose this as "ndpi.license" with the values not-for-profit (the
default), for-profit and for-profit-dual. An invalid value is fatal.
Older nDPI releases accept and ignore the option with a warning.

Ticket: 8077
4 weeks ago
TripleA150 bb3b033506 ndpi: pass the packet direction to nDPI
Suricata knows the direction of every packet, so tell nDPI instead of
letting it guess. Whether the flow beginning was seen is left unknown
as the flow API exposes no reliable flag for it.

Ticket: 8077
4 weeks ago
TripleA150 79d4034376 ndpi: share LRU caches across worker threads
nDPI correlates flows through LRU caches (DNS to TLS, STUN to RTP, TLS
certificates, ...) that are private to each worker's detection module.
As Suricata spreads a host's flows over all workers, these correlations
mostly missed.

Create a global context at plugin init, attach the worker modules to it
and make every cache global. Failures are logged and non-fatal. nDPI
creates a shared cache on first finalization without locking, which is
fine as thread init callbacks run sequentially from TmThreadCreate().

Ticket: 8077
4 weeks ago
TripleA150 8089777894 ndpi: no detection module needed to parse risks
ndpi_code2risk() does not need a detection module, yet one was
created, finalized and destroyed for every ndpi-risk keyword.

Ticket: 8077
4 weeks ago
TripleA150 da7c5b409f ndpi: build against nDPI 4.12, 5.0 and 6.0
nDPI 5.0 removed the protocol bitmask, ndpi_extra_dissection_possible()
and the third argument of ndpi_detection_giveup(), and introduced a
classification state; nDPI 6.0 added a license argument to
ndpi_init_detection_module(). The plugin only built against nDPI 4.x.

Wrap these differences in a small header of static inline helpers
selected on NDPI_MAJOR so that ndpi.c stays version agnostic. On 5.0
and later a flow is final once classified with no extra dissection
pending, as in ndpiReader, or in monitoring state, where the
classification can no longer change. The packet cap now also applies
to classified flows still under extra dissection.

Ticket: 8077
4 weeks ago
Jason Ish 06235a3232 ndpi: use flow access functions
To prevent direct access to the flow structure and be subject to changes
in its size.

Ticket: #8632
2 months ago
Jason Ish 038d4a21e3 ndpi: flow storage can fail, cleanup if it does 2 months ago
Jason Ish f739a8a73c ndpi: don't access flow storage directly
Remove the check for Flow.storage being NULL. With flex arrays, as long as the
flow is allocated, .storage will never be NULL. We do make sure the flow
is not NULL, and the storage functions are safe to the storage being
NULL.

Prevents NDPI from accessing this flow field to be less sensitive to ABI
changes with respect to data structure sizes.

Ticket: #8632
2 months ago
Philippe Antoine 6bb271cee9 conf: uses SCConfGetNonNull
Ticke: 8651

Uses it in place when we dereferenced the value straight away
after checking SCConfGet result but not its value
5 months ago
Victor Julien 32afba47dd packet: store livedev by id 5 months ago
Jason Ish a11aaadd86 plugins: add --plugin command line option to load plugins
Add --plugin <PATH> to load an additional plugin from the command
line. This is more convenient than "--set plugins.X" especially when
you may already have a plugins loaded and you want to load an
additional one.

Ticket: 8463
7 months ago
Jason Ish 336b50ae9e storage: prefix core API with SC 7 months ago
Jason Ish 67bd09ba2c thread/storage: prefix API with SC
In preparation for Rust bindings.
7 months ago
Jason Ish 137f59f542 flow/storage: prefix API with SC
In preparation for adding Rust bindings.
7 months ago
Jason Ish cd9993c568 storage: remove the size registration parameter
With the Alloc callback gone, the size is no longer needed.
7 months ago
Jason Ish f337cd573b storage: remove alloc callback as its unused
Remove the "Alloc" callback from the storage API, it was only being
used in tests without any real usage.
7 months ago
Jeff Lucovsky 448915fb55 capture/napatech: 0-pad thread names
Apply zero-padding to Napatech worker threads so alphanumeric sorting
displays workers in proper order.

Set padding for thread names according to stream count:

1-9 streams: no padding, e.g, nt1, nt9
10-99 streams: use padding, e.g, nt01, nt99
100-999 streams: use padding, e.g, nt001, nt099, nt999

This will insure that thread names, when sorted alphanumerically,
maintain thread worker id order.

Issue: 8337
7 months ago
Antoine Abou Faysal 29834e3917 plugins/ndpi: guard against NULL f->storage in all callbacks 8 months ago
Victor Julien 28ba93e60c ndpi: minor optimization
Check protocol before doing more expensive work.
8 months ago
Victor Julien 278da4bc6a npdi: fix null pointer deref in detect keywords
Check for the existence of a flow before calling FlowGetStorageById() on it.

Ticket: #8308.
8 months ago
Jason Ish 77d96851f5 pfring: use static functions; add void arg to SCPluginRegister
Minor cleanups.
9 months ago
Jason Ish a60e93c2cd pfring: fix typo in StringParseUint16
StringParseUnt16 -> StringParseUint16

Ticket: #8271
9 months ago
Jason Ish 828d105cea pfring: copy cflags over from src/
This should cause the following warning to error out:

runmode-pfring.c: In function 'OldParsePfringConfig':
runmode-pfring.c:118:17: error: implicit declaration of function 'StringParseUnt16'; did you mean 'StringParseInt16'? [-Wimplicit-function-declaration]
  118 |             if (StringParseUnt16(&pfconf->threads, 10, 0, threadsstr) < 0) {
      |                 ^~~~~~~~~~~~~~~~
      |                 StringParseInt16

Ticket: #8271
9 months ago
Lukas Sismis 400328c3c3 pcap-file: prep codebase for pcap_cnt move refactor
For an easier review process, this is a two-step change process,
in which pcap_cnt is first accessed by functions-to-be, implemented
as simple macros.

In the follow-up commit, the actual refactor is implemented with the new
function. The old macros are deleted.

Ticket: 7835
9 months ago
Philippe Antoine dd6baccabd src: doc: remove more double-space typos
Found with git grep -E '[a-z]  [a-z]'
10 months ago
Victor Julien 7c0776abeb counters: remove ThreadVars from counter registration
Just pass the StatsThreadContext pointer directly.
11 months ago
Victor Julien 77ddbbb9c8 counters: regular counter get local API update 11 months ago
Victor Julien 78da4cfcae counters: regular counter Incr API update 11 months ago
Victor Julien 045142a1f1 counters: regular counter Set API update 11 months ago
Victor Julien c27d0b4192 counters: remove ThreadVars from sync API 11 months ago
Victor Julien 444166ec84 counters: move regular counter id to dedicated type 11 months ago
Victor Julien f6b67a8d50 napatech: update thread count callback to match API change 1 year ago
Victor Julien 7807b47ca0 pfring: update thread count callback to match API change
Use uint16_t internally and in parsing as well.
1 year ago
Philippe Antoine a2b5225612 rust: bindgen SCSigMatchAppendSMToList
Ticket: 7667
1 year ago
Philippe Antoine 13449344e8 rust: bindgen SCDetectHelperKeywordRegister
Ticket: 7667
1 year ago
Jason Ish 9d5158594f util-device: break into public and private definitions
util-device.h exposes some details that are particularly problematic
for C++, even when wrapped in 'extern "C"'. To address this, break the
header into public and private parts. The public part exposes
LiveDevice as an opaque data structure, while the private header has
the actual definition.

The idea is that only Suricata C source files should include the
private header, it should not be re-included in any other header
file. And this is the header library users should use, however we
don't enforce it with tecnical means, a library user could still
include the private header, but the clue there is in the name.
2 years ago
Philippe Antoine 96afdce283 detect: rename SCSigTableElmt to SCSigTableAppLiteElmt 2 years ago
Jason Ish 155706f96b jsonbuilder: prefix C API with SC 2 years ago
Jason Ish 813eb27b95 rust/conf: use generated bindings to SCConf API 2 years ago
Jason Ish 22b77b0c56 conf: prefix conf API with SC 2 years ago
Jason Ish 81915548de ndpi: ignore packets that have a different proto than the flow
This can happen when the flow is UDP, but an ICMP unreachable is
returned, which gets assigned to the same flow.

Reference: https://github.com/ntop/nDPI/issues/2762
2 years ago
Jason Ish 10ed6280ff ndpi: fix memory in keyword setup
- remove duplicate calls to ndpi_init_detection_module
- cleanup ndpi_init_detection_module when no longer needed
2 years ago
Jason Ish d3835bbb11 detect: split new keyword id from registration
Split DetectHelperKeywordRegister into 2 functions, one for acquiring
a new keyword ID, and another to perform the registration.

This makes it easier to do the traditional C keyword initialization
with a dynamic ID.
2 years ago
Alfredo Cardigliano dfd9ef5784 ndpi: initial implementation of nDPI plugin
Ticket: #7231
2 years ago
Philippe Antoine c164cfcf6b plugins: check version for all plugins 2 years ago
Jeff Lucovsky 7d5c170dd2 gen/bool: Clarify bool checks
Remove comparisons with true or false with C bools.
2 years ago
Victor Julien 1591ad4408 packetpool: allow larger max-pending-packets
Original limit was due to a specific data structure.

(lifted from 96a0ffadde)
2 years ago
Jeff Lucovsky d5feb8accc napatech: add as plugin
Issue: 7165
2 years ago
Victor Julien 96a0ffadde packetpool: allow larger max-pending-packets
Original limit was due to a specific data structure.
2 years ago
Jason Ish 79df4b4c89 pf-ring: add as plugin
Ticket: #7162
2 years ago