Commit Graph

5336 Commits (a781fc5c2ea047c7ea3774edbf890001987b82cc)
 

Author SHA1 Message Date
Ken Steele a781fc5c2e Make suricata_ctl_flags be volatile
The global variable suricata_ctl_flags needs to volatile, otherwise the
compiler might not cause the variable to be read every time because it
doesn't know other threads might write the variable.

This was causing Suricata to not exit under some conditions.
10 years ago
Victor Julien 503cc3de69 stream/async: improve handling of syn/ack pickup
If we picked up the ssn with a syn/ack, we don't need to make more
assumptions about sack and wscale after that.
10 years ago
Victor Julien 1656148490 stream/async: fix session setup issues
For these 2 cases:

1. Missing SYN:
-> syn <= missing
<- syn/ack
-> ack
-> data

2. Missing SYN and 3whs ACK:
-> syn <= missing
<- syn/ack
-> ack <= missing
-> data

Fix session pickup. The next_win settings weren't correctly set, so that
packets were rejected.

Bug 1190.
10 years ago
Victor Julien b2e80a0f66 stream: improve tracking with pkt loss in async
If 3whs SYN/ACK and ACK are missing we can still pick up the session if
in async-oneside mode.

-> syn
<- syn/ack <= missing
-> ack     <= missing
-> data

Bug 1190.
10 years ago
Victor Julien 033409a042 iprep: cleanup ctx on shutdown
~~Dr.M~~ Error #1: LEAK 480 direct bytes 0x0aae7fc0-0x0aae81a0 + 0 indirect bytes
~~Dr.M~~ # 0 replace_malloc                    [/work/drmemory_package/common/alloc_replace.c:2373]
~~Dr.M~~ # 1 SRepInit                          [.../Suricata/src/reputation.c:594]
~~Dr.M~~ # 2 DetectEngineCtxInit               [.../src/detect-engine.c:844]
~~Dr.M~~ # 3 main                              [.../Suricata/src/suricata.c:2230]
10 years ago
Ken Steele b2b1239ddf Make AppLayerProfiling functions inline
The entire body of these functions are protected by ifdef PROFILING.
If the functions are inlined, then this check removes the need for the
function entirely.

Previously, the empty function was still called, even when not built
for profiling. The functions showed as being 0.25% of total CPU time
without being built for profiling.
10 years ago
Giuseppe Longo 07fffa6a7d Fixes comments for pfring section in suricata.yaml
Bug #1301
10 years ago
Giuseppe Longo 2d43dae934 PF_RING: force cluster type if vlan is disabled
If vlan is disabled the cluster_flow mode will still take VLAN tags
into account due to using pf_ring's 6-tuple mode.
So this forces to use pf_ring's 5-tuple mode.

Bug #1292
10 years ago
Giuseppe Longo 395d5b7f61 iprep: add unit tests for cidr
Implements unit tests to test the new API
10 years ago
Giuseppe Longo 5499cb71b0 detect-iprep: extends cidr
Adds new API to check if an IP address is belong
to a netblock and gets the value.
10 years ago
Giuseppe Longo a1d8439b25 iprep: extends cidr support
Implements new API to expand the IP reputation
to netblocks with CIDR notation

A new object 'srepCIDRTree' is kept in the DetectionEngineCtx,
which contains two tree (one for ipv4 and one for ipv6)
where the reputation values are stored.
10 years ago
Eric Leblond 667b9a5220 lua: add export of dns.rrname
Add the capability for a lua script to ask for rrname in DNS query.
10 years ago
Eric Leblond 74ffa2b264 lua: move function to common utils
LuaStateNeedProto function can be used for any protocol so let's
move it out of the http file.
10 years ago
Victor Julien 4d66775a56 stream: improve bad window update detection
Ignore more valid ACKs in FIN shutdown phase.

Improve heuristic for window shrinking in case of packet loss.
10 years ago
Victor Julien a54f52278b stream: fix 'bad window update' false positive
ACK packets completing a valid FIN shutdown could be flagged as
'bad window update' if they would shrink the window.

This patch detects this case before doing the bad window update
check.
10 years ago
Tom DeCanio ce472d88be sanity check tcp SACK edges prior to recording. Attempt to avoid Cisco ASA
tcp randomization issue with it not properly writing sequence numbers in SACK.
10 years ago
Victor Julien 5834a1a619 stream: improve handling of 3whs packet loss
If the 3whs ACK and some data after this is lost, we would get stuck
in the 'SYN_RECV' state, where from there each packet might be
considered invalid.

This patch improves the handling of this case.
10 years ago
Victor Julien e7a909f4ae stream: fix ssh/ssl logging on tcp session reuse
TCP session reuse wouldn't unset FLOW_NO_APPLAYER_INSPECTION.
10 years ago
Victor Julien 59d12f334e ssh.softwareversion: allow more characters
The keyword would not allow matching on "OpenSSH_5.5p1 Debian-6+squeeze5"
as the + and space characters were not allowed.

This patch adds support for them.
10 years ago
Victor Julien a68e19d998 stream: add counter for failed pseudo setups
Stream pseudo packets are taken from the packet pool, which can be empty.
In this case a pseudo packet will not be created and processed.

This patch adds a counter "tcp.pseudo_failed" to track this.
10 years ago
Victor Julien e4c8084a75 stream: clean up pseudo packet counting
Increment the counter from StreamTcpPseudoPacketCreateStreamEndPacket.
10 years ago
Giuseppe Longo 8c09648ad0 pfring: removes old API and #ifdef chunks 10 years ago
Giuseppe Longo dde78e499c pfring: checks if the lib version is >= 6
Checks if the PF_RING version installed on the system is 6,
so old version won't be supported.
10 years ago
Jason Ish 55c45ac91d Fix MPLS decoder rules. 10 years ago
Jason Ish 2d12209194 Use ENGINE_SET_INVALID_EVENT when the packet is too small for an
MPLS header, and when the payload type can not be determined.
10 years ago
Jason Ish 65f40cbeaa Don't default to ethernet, ethernet should be preceded by a pseudowire.
If the payload type can't be determined, raise an alert.
10 years ago
Jason Ish 348b0e0e9f Set decoder events for labels that shouldn't be seen on the wire.
Add unit tests to test for mpls decoder events.
10 years ago
Jason Ish 66a321ca2d Handle encapsulated ethernet without a PW by defaulting to ethernet
if a fall back.
10 years ago
Jason Ish 025342dc6c Handle explicitly IPv6 and IPv6 labels as well as encapsulated ethernet. 10 years ago
Jason Ish 3e3ab2dc9f Add MPLS counter.
Check length before decoding each label.
10 years ago
Jason Ish 7642489874 Basic MPLS decoder. 10 years ago
Anoop Saldanha b334b8a6e9 CUDA: Update the inspection engine to inform the cuda module that it
doesn't need the gpu results and to release the packet for the next run.

Previously the inspection engine wouldn't inform the cuda module, if it
didn't need the results.  As a consequence, when the packet is next taken
for re-use, and if the packet is still being processed by the cuda module,
the engine would wait till the cuda module frees the packet.

This commits updates this functionality to inform the cuda module to
release the packet for the afore-mentioned case.
10 years ago
Ken Steele 60c46170b0 Check replist is not NULL inline before doing any processing.
The replist is often NULL, so it is worth checking that case before making
the function call do perform work on the list.
10 years ago
Eric Leblond 9a36f7f633 detect-dce-opnum: add sanity check
Specifying the option dce_opnum without value was triggering a
segfault.
10 years ago
Ken Steele 2c9c0f1e8f Fix typo in configure message about nfnetlink 10 years ago
Victor Julien d44cb3f6fe pcap-log: add option to honor pass rules
Add option (disabled by default) to honor pass rules. This means that
when a pass rule matches in a flow, it's packets are no longer stored
by the pcap-log module.
10 years ago
Jason Ish a18e2ef402 Bug 1230: Check all SigMatch lists for a named byte_extract variable. 10 years ago
Jason Ish dc9d1ec867 Bug 1230: Simple test case demonstrating failure. 10 years ago
Victor Julien 4c73631f95 Suppress ARM valgrind warning
Not Suricata related, so suppress.
10 years ago
Ken Steele 38710697db Speed up SigMatchGetLastSMFromLists()
SigMatchGetLastSMFromLists() is finding the sm with the largest
index among all of the values returned from SigMatchGetLastSM() on
the set of (list and type) tuples passed as arguments.

The function was creating an array of the types, then creating an array
of the results of SigMatchGetLastSM(), sorting that list completely, then
only returning the first values from the list.

The new code, gets one set of arguments from the variable arguments, calls
SigMatchGetLastSM() and if the returned sm has a larger index, keeps that
as the last sm.
10 years ago
Victor Julien 9a5bf82ba5 tcp session reuse: reset detect state
Reset the detect state on TCP session reuse. We reset the app layer,
so we need to reset the stateful detection as well.
10 years ago
Victor Julien 0fff3c833e detect state: always lock de_state_m
Always lock the de_state_m on access, also at flow recycle or
cleanup.
10 years ago
Mats Klepsland 0d15d4f6c3 configure.ac: Moved libpcap before libpfring
Moved the libpcap section in configure.ac before libpfring to
enable libpfring to use the specified libpcap includes and
libraries when testing for libpfring support.

Bug #1294
10 years ago
Mats Klepsland 78c1af6b38 runmode-pfring: Fixed typo s/fron/from/ 10 years ago
Mats Klepsland a01b3339c7 runmode-pfring: Suppress errors when using DNA/ZC
PF_RING DNA/ZC don't use cluster-id and cluster-type. Therefore,
skip setting these values if DNA/ZC is being used.

Bug #1048
10 years ago
Victor Julien 944276b988 lua detect: expose stream payload
Allow a script to set the 'stream' buffer type. This will add the
script to the PMATCH list.

Example script:
alert tcp any any -> any any (content:"html"; lua:stream.lua; sid:1;)

    function init (args)
        local needs = {}
        needs["stream"] = tostring(true)
        return needs
    end

    -- return match via table
    function match(args)
        local result = {}

        b = tostring(args["stream"])
        o = tostring(args["offset"])

        bo = string.sub(b, o);
        print (bo)

        return result
    end

    return 0
10 years ago
Jason Ish 5b9c6d4774 Comment out in the action-order section, as its not needed if
the default configuration is used.
10 years ago
Jason Ish 2e5292e229 Don't require an action-order configuration section. If not present,
use the defaults.
10 years ago
Victor Julien d9c523a332 filestore: fix parsing bug
Filestore keyword can have options or no options, and the parser
was enforcing the NOOPT flag too strictly.

Bug #1288
10 years ago
Victor Julien 4816dcc3d3 flow json log: add 'shutdown' as flow end reason
When engine shuts down all flows in the hash are logged out. They
may not have timed out yet. So they are forced. Log the reason to
be 'shutdown'.
10 years ago