Commit Graph

4565 Commits (1cce207c0502c4122282db366c54ed95bbd342b2)
 

Author SHA1 Message Date
Eric Leblond 8b5be26f49 pcap-file: add checksum-checks configuration variable
This patch adds support for checksum-checks in the pcap-file running
mode. This is the same functionnality as the one already existing for
live interface.

It can be setup in the YAML:
  pcap-file:
    checksum-checks: auto

A message is displayed for small pcap to warn that invalid checksum
rate is big on the pcap file and that checksum-check could
be set to no.
11 years ago
Eric Leblond b2c58b8d14 Set packet invalid flag during decoding.
This patch set a new value in pkt->flag to signal that a packet is
invalid during decoding. The patch has been obtained via a coccinelle
transformation.
11 years ago
Eric Leblond 3088b6ac34 Add invalid pkt counter.
This patch adds and increments a invalid packet counter. It
does this by introducing PacketDecodeFinalize function

This function is incrementing the invalid counter and is also
signalling the packet to CUDA.
11 years ago
Victor Julien 92568c3857 Fix parsing of 'custom' detect grouping values
Also, add error checking

Bug 892
11 years ago
Victor Julien ffe4a302a1 vars: optimize layout to reduce size requirements of flowbits and other vars 11 years ago
Victor Julien 3e604b8703 pcre: parsing cleanup
Remove all flags indicating the buffer type. They were only used
at parse time.

Because of this the DetectPcreData_ structure could shrink to 32
bytes.
11 years ago
Victor Julien ab22385083 stream: minor clean up of TcpSession structure 11 years ago
Victor Julien 866b3a1c5d content: reorder DetectContentData member, shrinking the struct from 64 to 48 bytes. 11 years ago
Victor Julien 277fb61c1d defrag: clean up
Rename PacketDefragPktFinishSetup to PacketDefragPktSetupParent to
better refect it's function.
11 years ago
Eric Leblond 3fdf52239d defrag: don't modify packet if defrag fails
If defrag fails dur to an invalid decoding, we are not modifying
the origin packet anymore.
11 years ago
Eric Leblond c611b258a5 decode: PacketTunnelPktSetup replaces PacketPseudoPktSetup
This patch replaces PacketPseudoPktSetup by a better named
PacketTunnelPktSetup function which is also in charge of doing
the decoding of the tunneled packet.
This allow to clean the code. But it also fixes an issue.
Previously, if the DecodeTunnel function was failling (cause of
an invalid packet mainly), the result was that the original packet
to be considered as a tunnel packet (and not inspected by payload
detection).
11 years ago
Eric Leblond d4b7ecfbe3 decode: update API to return error
In some cases, the decoding is not possible and some really invalid
packet can be created. This is in particular the case of tunnel. In
that case, it is more interesting to forget about the tunneled
packet and only consider the original packet.

DecodeTunnel function is maked as warn_unused_result because it is
meaningful for the decoder to know if the underlying data were not
correct. And in this case, only focus detection on the content.
11 years ago
Victor Julien 0b0e9340dc rule setup: cleanup
Remove rule preparation logic that ran, but it's results were not
used.
11 years ago
Victor Julien 2be6829986 Convert dsize keyword parsing to use pcre_copy_substring 11 years ago
Victor Julien dcc75acdec Convert pcre keyword parsing to use pcre_copy_substring 11 years ago
Victor Julien 1f69da80bf rule parser: convert to use pcre_copy_string 11 years ago
Victor Julien d397ed94c5 detect: use macro for max rule size 11 years ago
Victor Julien 9d35855a95 Convert flowbits keyword parsing to use pcre_copy_substring 11 years ago
Victor Julien beab8d401c Convert flow keyword parsing to use pcre_copy_substring 11 years ago
Victor Julien 223fedb8fe Convert ParseSizeString to use pcre_copy_substring 11 years ago
Victor Julien 3f4ce6dadd rule parser: don't use uninitialized value 11 years ago
Giuseppe Longo f03278d132 feature #417: add support for configuration per host timeout value 11 years ago
Victor Julien 54610cb4a4 rule parsing cleanups
Clean up usage of array of pointers to the various parts of a rule.
11 years ago
Victor Julien 67989e7e4e rule parsing: reduce mallocs and clean up
Reduce mallocs during rule parsing. Also, no longer recursively
call the option parse function.
11 years ago
Victor Julien 2ce8895f0a address and port: reduce memory allocs 11 years ago
Jason Ish 06f4fe8e0c Remove the single line if statements. 11 years ago
Jason Ish 8625c9eba8 Support for configuration include files. 11 years ago
Victor Julien e7f6107e79 signature address parsing improvements and tests
Fix sigatures not supporting [10.0.0.0/24, !10.1.1.1] notation when
used directly in a rule instead of through a variable.

Add tests for Bugs #815 and #920.
11 years ago
Victor Julien 614133b4ca valgrind: add suppression file 11 years ago
Victor Julien 3521c37d4a http: use body limit in inspection
When inspecting HTTP bodies there are several limits involved.
In this patch the reaching of the body limit will trigger body
inspection.

Without this, the body would only be inspected when inspection
limits "request-body-minimal-inspect-size" or
"response-body-minimal-inspect-size" were reached. If the body
limit was smaller than this value, the body would only be
inspected at the end of the tx or stream.
11 years ago
Victor Julien 493d531ae8 Fix using uninitialized memory (Bug #994) 11 years ago
Eric Leblond 9bbcc8671e util-ioctl: ioctl error should be a warning 11 years ago
Eric Leblond 286258df86 pcap: add warning about GRO and LRO usage
Use the new GetIfaceOffloading function to display a warning message
if pcap capture is used on Linux with GRO or LRO activated. This is
helpful for kernel after 2.6.31 were pcap will use mmaped capture.
TPACKET_V2 is used and this limit the size of the packet resulting
in truncated packets when merged packets are received.
11 years ago
Eric Leblond 2855ee5aef af-packet: add warning message if LRO or GRO are set
This patch query the network interface to detect if LRO or GRO are
used in mmap TPACKET_V2 mode.
11 years ago
Eric Leblond fcc8759561 util-ioctl: add GRO/LRO detection capabilities
This patch adds a new function GetIfaceOffloading which return 0
if LRO and GRO are not set on a interface and 1 if not the case.
11 years ago
Eric Leblond 008ed41cb4 util-ioctl: minor code cleaning.
Fix author e-mail and simplify an indentation.
11 years ago
Eric Leblond 853732210e pfring: improve error reporting at device opening
This patch improves the error message displayed if pfring_open fails.
11 years ago
Victor Julien 5330b1cae1 detect: don't consider smsgs for no inspect flag
When the PKT_NOPAYLOAD_INSPECTION flag is set, don't apply it to smsgs.
This way we can still inspect the outstanding smsgs.

The PKT_NOPAYLOAD_INSPECTION is set for encrypted traffic, and is combined
with disabling stream reassembly. So we only inspect the smsgs up to the
point of the disable detection point.
11 years ago
Victor Julien ab7677638e stream: improve raw reassembly
When checking the reassembly limit for raw reassembly, consider the
STREAMTCP_STREAM_FLAG_NOREASSEMBLY a trigger immediately. We won't
process any more segments in the reassembly engine anyway.
11 years ago
Victor Julien e392c0a4ce Fix autofp flow queue handler optimization 11 years ago
Victor Julien 480fddd189 build-info: add a nicer way of printing atomics support 11 years ago
Victor Julien ce120d4927 flow: aligned flow balance structures (used by autofp) to CLS to reduce false sharing 11 years ago
Victor Julien fb4967912c http: add meta-field-limit option
The meta-field-option allows for setting the hard limit of request
and response fields in HTTP. In requests this applies to the request
line and headers, not the body. In responses, this applies to the
response line and headers, not the body.

Libhtp uses a default limit of 18k. If this is reached an event is
raised.

Ticket 986.
11 years ago
Victor Julien 2ec57c36b4 SSE 4.2 memcmp: don't read beyond var boundary
In the SSE 4.2 SCMemcmpLowercase implementation, there would be a
_mm_load_si128 of a 2 byte array. However, _mm_load_si128 loads
16 bytes, causing it to read beyond the var. I don't think this lead
to crashes, as it was a static var, but clangs ASAN complained about
it.
11 years ago
Ken Steele d3c6913e28 Reduce the size of Packet structure
Share memory space for IPV4Vars and (IPV6Vars, IPV6ExtHdrs), since a
packet can only be either IPv4 or IPv6, but not both.

Share memory for TCPVars, UDPVars, ICMPV4Vars and ICMPV6Vars, since a
packet can only be only of these.

Then move other structure members around to remove holes reported by pahole.

This reduces the size of the Packet structure from 2944 bytes (46 cachelines)
down to 1976 (31 cachelines), a 33% reduction.
11 years ago
Victor Julien a8b971c710 http: strip 'proxy' part of http_uri
Strip the 'proxy' parts from the normalized uri as inspected by http_uri,
urilen, pcre /U and others.

  In a request line like:
    GET http://suricata-ids.org/blah/ HTTP/1.1
  the normalized URI will now be:
    /blah/

This doesn't affect http_raw_uri. So matching the hostname, etc is still
possible through this keyword.

Additionally, a new per HTTP 'personality' option was added to change
this behavior: "uri-include-all":

  uri-include-all: <true|false>
    Include all parts of the URI. By default the
    'scheme', username/password, hostname and port
    are excluded. Setting this option to true adds
    all of them to the normalized uri as inspected
    by http_uri, urilen, pcre with /U and the other
    keywords that inspect the normalized uri.
    Note that this does not affect http_raw_uri.

So adding uri-include-all:true to all personalities in the yaml will
restore the old default behavior.

Ticket 1008.
11 years ago
Ken Steele de6cbb01c8 Allocate mPIPE packet ingress queue in each worker thread.
Move the allocation of the mPipe ingress queue from a loop over
the number of workers in the main init function to being done inside
each worker thread. This allows allocating the memory locally on the
worker's CPU without needing to figure out ahead of time where that thread
will be running. This fixes one case of static mapping of workers to CPUs.

Use __thread to hold the queue rather than a global tables of queues.
11 years ago
Ken Steele 601c7c8e3c Cleanup Tile build for -Werror
Just the changes needed for the Tile architecture to compile cleanly with
-Werror.
11 years ago
Ken Steele f16b339fc4 Rename checksums to level3_comp_csum and level4_comp_csum.
This will also sharing even more memory in the Packet_ structure.
11 years ago
Eric Leblond 3dceca70ee suricata: move some code into PostConfLoadedSetup
All functions before daemonization are initialisation functions and thus the
call can be moved in PostConfLoadedSetup.
11 years ago