Commit Graph

44 Commits (a2bc0080932e2971590b83011df109373f7aca66)

Author SHA1 Message Date
Victor Julien 5b84c01cd3 gcc7: fix format-truncation warnings in runmodes
Example:

util-runmodes.c: In function ‘RunModeSetIPSAutoFp’:
util-runmodes.c:496:40: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
                                        ^~~~~~~~~~
util-runmodes.c:496:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size16
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solved by reducing 'thread' to a uint16_t and limiting the max
thread count to 1024.
8 years ago
Victor Julien ab1200fbd7 compiler: more strict compiler warnings
Set flags by default:

    -Wmissing-prototypes
    -Wmissing-declarations
    -Wstrict-prototypes
    -Wwrite-strings
    -Wcast-align
    -Wbad-function-cast
    -Wformat-security
    -Wno-format-nonliteral
    -Wmissing-format-attribute
    -funsigned-char

Fix minor compiler warnings for these new flags on gcc and clang.
8 years ago
Jason Ish 00b6e628d1 logging: hook into flow worker thread 9 years ago
Jason Ish fc35a78ba1 logging: use a single entry point for all loggers
Introduces a new thread module, TMM_LOGGER, which is the
root most logger.

Only handles loggers in the packet path, stats and flow
logging are not included.

The loggers are made up of a hierarchy of loggers. At the top we
have the root logger which is the main entry point to
logging. Under the root there exists parent loggers that are the
entry point for specific types of loggers such as packet logger,
transaction loggers, etc. Each parent logger may have 0 or more
loggers that actual handle the job of producing output to something
like a file.
9 years ago
Victor Julien 5f9de1e734 affinity: rename detect -> worker set internall 9 years ago
Victor Julien 52d500c670 flowworker: initial support
Initial version of the 'FlowWorker' thread module. This module
combines Flow handling, TCP handling, App layer handling and
Detection in a single module. It does all flow related processing
under a single flow lock.
9 years ago
Victor Julien 2f0e0f17db flow: move flow handling into worker threads
Instead of handling the packet update during flow lookup, handle
it in the stream/detect threads. This lowers the load of the
capture thread(s) in autofp mode.

The decoders now set a flag in the packet if the packet needs a
flow lookup. Then the workers will take care of this. The decoders
also already calculate the raw flow hash value. This is so that
this value can be used in flow balancing in autofp.

Because the flow lookup/creation is now done in the worker threads,
the flow balancing can no longer use the flow. It's not yet
available. Autofp load balancing uses raw hash values instead.

In the same line, move UDP AppLayer out of the DecodeUDP module,
and also into the stream/detect threads.

Handle TCP session reuse inside the flow engine itself. If a looked up
flow matches the packet, but is a TCP stream starter, check if the
ssn needs to be reused. If that is the case handle it within the
lookup function. Simplies the locking and removes potential race
conditions.
9 years ago
Zachary Rasmor 68cfa009a0 Update thread creation and threads to use global thread names.
Thread name is now stored as a static string buffer,
string duplication and alloc/de-alloc is no longer required.
9 years ago
Zachary Rasmor f8a40dd906 Update pcap-file runmode to adhere to new thread standard. 9 years ago
Victor Julien 09242fb4a8 afl: optionally exit right after afl single runmode
Exit right away if afl.exit_after_pcap is set to true. Safes time
as fuzzing the shutdown code may not be as interesting.
9 years ago
Victor Julien e824a8be76 afl: special 'single' runmode
To avoid threading, this 'single' mode doesn't run in it's own thread
but instead runs in the main thread.
9 years ago
Eric Leblond a53aef9c57 tm-threads: unify thread names handling
TmThreadCreate copy string provided as name for threads to
avoid any issue is a non allocated string is used.

This patch also introduce TmThreadSetGroupName function. This
function is used to be sure we have an allocation when
assigning the thread group name. This way we can free allocated
memory at exit.

Both code changes have required some fixes in different parts of
the code to be in sync with the new API.

Good point about these changes is that it fixes an inconsistency
were some names were not allocated and some were.
10 years ago
Victor Julien 6b2fb3fd5d Fix minor format string issues 10 years ago
Victor Julien 38b349af1e runmodes: remove DetectEngineCtx passing from API
No longer pass a pointer to the current detection engine to the
runmode API calls.

Note: breaks delayed detect. Will be fixed in a future commit.
11 years ago
Eric Leblond ee7422de0a pcap-file: add missing atomic init
It is mandatory to init all atomic to avoid problem on system
without atomic support.
11 years ago
Eric Leblond ed147d3b91 runmode-pcap-file: suppress useless include 11 years ago
Victor Julien c88cbb39fe tcp reuse: enable stream handling based on runmode
Add a way for runmodes to state that flow and stream run asynchorously.

In the stream engine, enable the TCP reuse handling only if that flag
is set.
11 years ago
Victor Julien 7025aabe75 Runmodes: remove 'auto' runmodes
Remove 'auto' runmodes from all capture methods. It wasn't reliable
enough, as it didn't enforce inspection order of packets.
11 years ago
Victor Julien 0e08f4b6fc update runmodes to handle detect-less
In runmodes setup, consider a NULL de_ctx to mean detect is disabled.
12 years ago
Victor Julien 6d34834623 Runmode fixes and cleanups
Bug #939: thread name buffers are sized inconsistently
These buffers are now all fixed at 16 bytes.

Bug #914: Having a high number of pickup queues (216+) makes suricata crash
Fixed so that we can now have 256 pickup queues, which is the current built-in
maximum. Improved the error reporting.

Bug #928: Max number of threads
Error reporting improved. Issue was the same as #914.
12 years ago
Anoop Saldanha b787da5643 Remove all cuda related code in the engine except for the cuda api wrappers 12 years ago
Eric Leblond 93f801b3a9 pcap-file: update affinity setting code
The affinity setting code was using the old API. This patch updates
to the new API and also adds a call to RunModeInitiaze() which was
missing in Single running mode.
13 years ago
Eric Leblond e176be6fcc Use unlikely for error treatment.
When handling error case on SCMallog, SCCalloc or SCStrdup
we are in an unlikely case. This patch adds the unlikely()
expression to indicate this to gcc.

This patch has been obtained via coccinelle. The transformation
is the following:

@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@

x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
13 years ago
Eric Leblond d292004880 Add some missing checks of SCStrdup return. 13 years ago
Anoop Saldanha b2455b6afa cuda pb tm should be in a thread of its own + pkt_acq should be as free as possible 14 years ago
Victor Julien 8d1fe9f2fa Make 'autofp' the default runmode. Increase default max-pending-packets to 1024. Move some advanced and uncommonly changed settings down in the stock suricata.yaml. Closes #433. 14 years ago
Anoop Saldanha 4e417b72b5 support flow q handler schedulers active_flows and active_packets. Support new yaml option autofp_scheduler. Support for printing q handler stats as well 14 years ago
Nikolay Denev 7fce226bb8 Fix some warning message still using underscored config vars. 14 years ago
Nikolay Denev 139768dd58 Do not use underscored config vars internally. 14 years ago
Eric Leblond 391d813c82 Remove unified1 output module. 14 years ago
Anoop Saldanha a7acf9ea8f Remove all code introduced earlier concerned with ms sync points 14 years ago
Anoop Saldanha a844eecb0e - Updated all runmodes to use synchronization points, right before each thread(slot function) tries to de-init the thread. - Main thread now first disables receive thread(s) before it kills receive and rest of the threads. 14 years ago
Victor Julien b753ecce50 Implement a pkt acq loop infra with support for pcap-file. 14 years ago
Anoop Saldanha 4f7df1029d Unify the use of slots to a single struct for threading API. Remove separate slot append functions for 1slot and varslot 14 years ago
Victor Julien 43b2e63c1e Fix minor compiler comments in CUDA code. 14 years ago
Gerardo Iglesias Galvan 363285d485 No need to check array pointer 14 years ago
Gerardo Iglesias Galvan a2b7b77434 Make sure we always check the result of TmThreadCreatePacketHandler 14 years ago
Victor Julien 7f88158fb3 Remove a debug statement from single pcap file runmode. 14 years ago
Victor Julien cd75201dc7 Fix pfring commandline handling. 15 years ago
Anoop Saldanha e4d890e186 modify runmode api to accept conf runmode paramter as a char string, instead of an interger id 15 years ago
Anoop Saldanha 229f7281ea list runmodes. Allow specification of runmode id from cof file. Also allow for command line override 15 years ago
Anoop Saldanha 05686e70a5 fix coding indentation + neaten runmode code 15 years ago
Anoop Saldanha d7c707e656 modify runmodes to take all arguments from the conf API 15 years ago
Anoop Saldanha e7ac1d7c4c move pcap file runmode into its own file runmode-pcap-file.[ch] 15 years ago