Commit Graph

4651 Commits (32271bdb66b5d6bee49b9c96c26c144a0532e533)
 

Author SHA1 Message Date
Victor Julien 66c6c06916 http: clear header pointer on realloc failure
Fixes:

detect-engine-hhd.c:188:5: warning: Use of memory after it is freed
    return headers_buffer;
11 years ago
Victor Julien 7ea13f0f53 dns: fix passing NULL to memcpy
app-layer-dns-common.c:401:5: warning: Null pointer passed as \
                              an argument to a 'nonnull' parameter
    memcpy(ptr, fqdn, fqdn_len);
11 years ago
Victor Julien 6709fdd8cf log-http: fix compiler warning
log-httplog.c:180: warning: 'cvalue' may be used uninitialized in \
this function
11 years ago
Victor Julien 31a94cd4cb defrag: pass u64 to ParseU64
Fixes: defrag-config.c:97: warning: passing argument 2 \
       of 'ParseSizeStringU64' from incompatible pointer type
11 years ago
Ken Steele 12ab6f3ab4 Fix uninitialized variable warning.
These two lines reported warnings with -Werror -O3 on Tile.
11 years ago
Ken Steele 882d98733f Fix pfring so that zero-copy mode can work.
Detect when default_packet_size is zero, which enables zero-copy mode for
pfring and in that case, do what AF Packet does and set pkt_ext pointer to
the data and set PKT_ZERO_COPY flag.
11 years ago
Ken Steele f9705377ae Remove pkt variable from Packet structure.
The uint8_t *pkt in the Packet structure always points to the memory
immediately following the Packet structure. It is better to simply
calculate that value every time than store the 8 byte pointer.
11 years ago
Ken Steele 3870def601 Split AC-Tile MPM context into Search and Initialization structures.
Some of the fields in the SCACTileCtx struct are only used to create the MPM,
but are not needed to search the MPM. Create a new structure to contain just
the data needed by AC Search. After creating the MPM, copy the data into the
new structure and then free the memory only needed during initialization.

This reduces the size of the AC-Tile MPM context from 1360 bytes down to 296
bytes.
11 years ago
Victor Julien b61552482c mpipe code cleanup: indent fixes 11 years ago
Ken Steele 300b739b1f Add more suricata.yaml configuration options for mPIPE.
Add two new mPIPE load-balancing configuration options in suricata.yaml.
1) "sticky" which keep sending flows to one CPU, but if that queue is full,
don't drop the packet, move the flow to the least loaded queue.
2) Round-robin, which always picks the least full input queue for each
packet.

Allow configuring the number of packets in the input queue (iqueue) in
suricata.yaml.

For the mPipe.buckets configuration, which must be a power of 2, round
up to the next power of two, rather than report an error.

Added mpipe.min-buckets, which defaults to 256, so if the requested number
of buckets can't be allocated, Suricata will keep dividing by 2 until either
it succeeds in allocating buckets, or reaches the minimum number of buckets
and fails.
11 years ago
Ken Steele f0c785cc1d Fix configuring Prelude with -Werror
Running with:

CFLAGS="-Werror" ./configure

would fail when configuring libprelude because of an unused-result
warning. Ignore that one warning.
11 years ago
Ken Steele 5a1bc025e5 Mark pflow as a constant pointer.
Address review comment from Victor that the pflow pointer is constant, so
it can be marked as such.
11 years ago
Ken Steele bee24d8909 Use pflow variable in place of p->flow to prevent reloading.
In SigMatchSignatures, the value p->flow doens't change, but GCC can't
figure that out, so it reloads p->flow many times during the function.
When p->flow is loaded into the variable pflow once at the start of the
function, the compile then doesn't need to reload it.
11 years ago
Eric Leblond a75911e02f pfring: workaround potential librt deps
It seems some version of pfring needs to be link with librt.
11 years ago
Eric Leblond 58eb6428d1 suricata: ignore SIGHUP signal
This patch ignores the SIGHUP signal instead of having the default
behavior.
11 years ago
Ken Steele 3d81e50ab3 Check for compiler for -march=native support
Check all compilers to see if they support the -march=native flags, rather
than assuming gcc 4.2 or later does. Tile GCC doesn't currently support it,
so not checking break Tile compiles.
11 years ago
Victor Julien 4fdd1a7a71 Fix compilation on systems that use the fallback SC_ATOMIC_ API. 11 years ago
Victor Julien 01c440bf28 Add DrMemory suppression for Bug #980. Suppress useless (likely) buggy leak message too 11 years ago
Victor Julien 1509c9a2e6 Remove DrMemory suppressions for Bug #979, it is fixed. 11 years ago
Eric Leblond 5a7ad5b382 qa: prscript now output pastable line for PR. 11 years ago
Eric Leblond a597237aed coccinelle: fix malloc test
We can have more than an identifier to be assigned the result of
a malloc function.
11 years ago
Eric Leblond 6378db89f6 coccinelle: add option to continue on errors
When a script has been updated or introduced, it is interesting to
detect all errors at once. With this patch it is now possible to
do so by using:
   NOT_TERMINAL=1 CONCURRENCY_LEVEL=12  qa/coccinelle/run_check.sh
11 years ago
Eric Leblond 28c5c68192 error checking: add missing alloc error treatment
The return of some malloc like functions was not treated in some
places of the code.
11 years ago
Victor Julien f6e37dcc90 Bug 1061: fix multiple vars per sig in ordering
In sigordering rules that had multiple vars doing the same operation,
like setting multiple flowbits, would not be considered correctly.

Bug 1061.
11 years ago
Victor Julien b770fd2981 http header: improve realloc failure checking. Bug #1062. 11 years ago
Victor Julien 90cf8d4c6e port parsing: improve memory handling 11 years ago
Victor Julien b79b2fff25 cppcheck: add special BUG_ON so cppcheck understands we exit 11 years ago
Victor Julien d5db0cc033 port: don't lead memory on port parsing failure
[src/detect-engine-port.c:1354]: (error) Memory leak: gh
11 years ago
Victor Julien 435f99409f Fix small memleak in runmode setup
[src/runmodes.c:338]: (error) Memory leak: custom_mode
11 years ago
Victor Julien 86aad660a2 threading setup: fix small mem leak on failure
[src/tm-threads.c:1058]: (error) Memory leak: slot
11 years ago
Victor Julien b4631794a8 Fix realloc error handling in threshold.config file parsing. Bug #1062. 11 years ago
Victor Julien 35298a0146 Use %u for unsigned int in (console) output 11 years ago
Victor Julien a9d754c23d Use %u for unsigned ints in checksum warning 11 years ago
Victor Julien 76d3cb557b htp: minor cleanup to silence cppcheck warning
[src/app-layer-htp.c:1967] -> [src/app-layer-htp.c:1978]: (warning) \
    Possible null pointer dereference: tx - otherwise it is redundant \
    to check it against null.
11 years ago
Victor Julien 5ba898b738 cppcheck: don't use likely/unlikely when -DCPPCHECK is passed to the checker 11 years ago
Victor Julien b2c4a50e39 Fix small memory leak in classtype parsing 11 years ago
Victor Julien fe46c26e4e cppcheck: improve reporting cppcheck when passing -DCPPCHECK to the checker. 11 years ago
Victor Julien afb48cfcb5 log-http: fix error check leading to null-deref on malloc failure during setup 11 years ago
Victor Julien 4165bf8951 log-http: enforce hostname print limit 11 years ago
Victor Julien 1476db44d9 Convert Flow macros to inline functions
Convert FlowReference and FlowDeReference to inline functions for
better readability and to aid static code analyzers.
11 years ago
Victor Julien b4e6bbe4bc flowvar: initialize new memory to prevent issues on error handling 11 years ago
Victor Julien 0beb7ed781 pcap: fix stats dump logic
pcap has a callback function that is called for each packet. Once a
second, it's meant to 'dump stats'. However, the timing logic was
broken, so it would actually dump stats for each packet.

By moving the stats second timer into the thread vars, next calls of
the callback will be able to use the stored time.
11 years ago
Victor Julien 9e85b8d35e flow timeout: remove now unused code 11 years ago
Victor Julien 85b1a8ff26 flow: fix typo in function name
FlowForceReassemblyNeedReassmbly -> FlowForceReassemblyNeedReassembly
11 years ago
Victor Julien 3b3dce8328 flow timeout cleanup and fix
Flow timeout code worked by luck when checking if a flow still needed
reassembly for app layer inspection or logging. It would check for a
part of raw reassembly (smsg list) to determine if detection was
needed. In this case it would also process app layer cleanup,
including logging.

Introduced AppLayerTransactionGetActive which returns the lowest tx_id
in a direction that still needs some work.

FlowForceReassemblyNeedReassmbly now uses it to determine if the
applayer still needs work.

Converted FlowForceReassemblyForHash to use the checking function
FlowForceReassemblyNeedReassmbly as well, so that checking if a flow
needs work is now unified.
11 years ago
Victor Julien b32abea06b flow/stream: use named values in flow timeout code 11 years ago
Victor Julien 8522da8ea5 stream: add option to disable raw reassembly
Raw reassembly is used only by the detection engine. For users only
caring about logging it's a significant overhead, both in cpu and
memory usage.

The option is called 'raw' and lives under the stream.reassembly
options.

stream:
  memcap: 32mb
  checksum-validation: yes      # reject wrong csums
  inline: auto                  # auto will use inline mode in IPS mode, yes or no set it statically
  reassembly:
    memcap: 64mb
    depth: 1mb                  # reassemble 1mb into a stream
    toserver-chunk-size: 2560
    toclient-chunk-size: 2560
    randomize-chunk-size: yes
    #randomize-chunk-range: 10
    raw: false # <- new option
11 years ago
Eric Leblond 47b5fc0934 erf-dag: fix typo in header guard
Spotted out by clang:
 source-erf-dag.h|25 col 9| warning: '__SOURCE_ERR_DAG_H__'
 is used as a header guard here, followed by #define of a different macro
 [-Wheader-guard]
11 years ago
Eric Leblond 105182f582 yaml: remove no more present files
emerging-virus.rules is not present anymore in ET ruleset downloaded
by 'make install-rules'. This patch removes it from the list to avoid
an error message.
11 years ago
Eric Leblond f9f1a666f0 dns: rules files was not installed
Installed dns-events.rules files in rules directory with install-rules.
11 years ago