Victor Julien
8999de2f93
Add proper RST handling to all TCP states.
15 years ago
Victor Julien
1578ef1e3e
Make sure that the stream engine fully reassembles both sides of the session upon receiving a valid RST.
15 years ago
Victor Julien
14ad853b94
Process a stream end pseudo packet when going from TIME_WAIT to CLOSED.
15 years ago
Victor Julien
d0374ced38
Implement SACK in the stream engine.
15 years ago
Victor Julien
892a8a4985
Make stream inline use the chunk size settings.
15 years ago
Victor Julien
2dc057d1b1
Set datalink on stream pseudo packets to prevent unified2 from writing a malformed record.
15 years ago
Victor Julien
4f5aad1476
Enforce configurable minimum chunk size in raw stream reassembly. Minor stream cleanups, unittest updates.
15 years ago
Victor Julien
936b34ddf6
Remove minimum init chunk length code, set a default limit of 2560 to the minimum chunk size, allow toclient raw reassembly to start even if toserver hasn't started yet.
15 years ago
Victor Julien
bc7e21aee6
Add special sguil mode to log-pcap to support logging into date based directory structure and rotate when the day passes. Also do not log packets beyond stream reassembly depth and encrypted traffic.
15 years ago
Eric Leblond
9be1f1a31c
Use GET_PKT macros.
15 years ago
Victor Julien
174db08567
Force reassembly of unack'd data on receiving a valid RST packet.
15 years ago
Victor Julien
b9429ecec1
Fix invalid RST considered valid due to wrong returns codes. Only validate ACK from a RST packet if an ACK value was set.
15 years ago
Victor Julien
cb67d61ab5
Fix broken setup of end of stream pseudo packet.
15 years ago
Eric Leblond
a8417377e7
Don't use direct pkt access
...
pkt field in Packet needs to be accessed via macro. This
patch supress some direct access.
15 years ago
Victor Julien
00e4dde6a6
Fix PKT_STREAM_EOF never being set, resulting in some raw stream chunks never being inspected. Improve debug output.
15 years ago
Victor Julien
1dca88fe69
Do the actual checksum recalculation and packet replacement on modifing a packet in the stream engine.
15 years ago
Victor Julien
3a774165fa
Initial version of a inline raw reassembly function that reassembles in a sliding window. Introduce new unittest helpers for stream reassembly.
15 years ago
Victor Julien
8cacd5fe50
Fix the stream.inline config option. Set PKT_STREAM_EST flag also for packets that are part of a session in a state beyond TCP_ESTABLISHED.
15 years ago
Victor Julien
a8bb98836b
Don't handle and validate the TCP timestamp at the same time. Instead validate first, then later when all other validation has been done as well, handle.
15 years ago
Victor Julien
8d3f9c53a9
Minor cleanups.
15 years ago
Victor Julien
0f072648e6
Another iteration of the reassembly depth enforcement, now considering retransmissions.
15 years ago
Victor Julien
935958219d
Rename RST validation function to match convention
15 years ago
Victor Julien
94fe0d5fa2
Add ACK validation to Reset/RST validation code.
15 years ago
Victor Julien
7af9c58af7
Improve ACK value validation, timestamp checking code. Overall layout.
15 years ago
Victor Julien
6ffb9da9be
Better support ack/psh data packets on several states. Updates to ack validation code.
15 years ago
Victor Julien
25f5589078
First round of adding 'stream events'. Basic stream tracking events added.
15 years ago
Victor Julien
2849d2b1d3
Initial code for stream 'inline' mode: packets that are (partly) overlapping with already accepted packets (meaning in the streams seg list) are rewritten to make sure they contain the exact same data.
15 years ago
Victor Julien
3857154f4b
Fix the pseudo packet having the wrong proto set, causing massive fp's. Flag packets to be part of the established phase of a tcp session, so we won't prematurely inspect the app layer state.
15 years ago
Gurvinder Singh
55a863359c
support for pseudo packet creation from reassembled stream segments
15 years ago
Gurvinder Singh
2beb7af7f8
support for validating the ACK before updating the last_ack field and also update next_seq if we missed the last packet
15 years ago
Victor Julien
c955254b4e
Adapt stream code to packet memory allocation changes.
15 years ago
Victor Julien
fadd6d6361
Add pseudo packet counter.
15 years ago
Victor Julien
f606621e8c
Fix the pseudo packet having the wrong proto set, causing massive fp's. Flag packets to be part of the established phase of a tcp session, so we won't prematurely inspect the app layer state.
15 years ago
Victor Julien
6482c34909
Increment flow use cnt for pseudo packets as the flow is not supposed to disappear while dealing with those packets.
15 years ago
Victor Julien
2072ad80af
Never create a pseudo packet based on a pseudo packet.
15 years ago
Victor Julien
61a9936d55
Inspect a pseudo packet upon receiving a RST so that we are sure both sides of the TCP session are inspected.
15 years ago
Gurvinder Singh
00f21f34e8
support for pseudo packet creation from reassembled stream segments
15 years ago
Victor Julien
8fa5a2c025
Split applayer and raw stream reassembly
...
Split stream reassembly in 2 parts: a part that sends ack'd data to the app
layer parsers as soon as it's available, and another part that queues up
data into larger chunks for raw inspection.
15 years ago
Victor Julien
b5a5ef14b9
Make sure we reuse a TCP session if we receive a valid 3WHS on a closed TCP session, can happen if a new session has the same tuple.
15 years ago
Eric Leblond
1db4aadd16
Supress usage of Packet declaration in tests.
...
For convenience, a massive usage of 'Packet p;' declaration has
been done in the tests function. Although this was completely
legal, this is not possible anymore because of the new Packet
allocation structure. This massive patch modifies all suricata
files to use a SCMalloc allocated pointer to Packet instead.
This patch has been done using coccinelle (http://coccinelle.lip6.fr )
which is a semantic patching tool. This ensures that things like call
to SCFree() should have not been forget because the semantic patch
explicitly forces the call to SCFree(p) before each return. With this
patch all unittests are running fine with a small and a big default
packet size.
15 years ago
Eric Leblond
dd038c1906
Modify files to avoid direct pckt payload access
...
This patch implements the needed modification of payload access
in a Packet structure to support the abstraction introduced by
the extended data system.
15 years ago
Eric Leblond
8471626916
Fix error message and adds information to config
...
This patch fixes a typo in an error message and add some
information to the checksum verification option.
15 years ago
Victor Julien
c64b9362cf
Remove unused stream flag.
15 years ago
Anoop Saldanha
e47a9b59e9
accept tcp packets with syn+urg+push
15 years ago
Gurvinder Singh
892dea31e4
added the counter for tcp.segment_memcap_drop to show the dropped segments count due to memory limit
15 years ago
Victor Julien
0eb0d48f35
Disable broken unittests and fix one.
15 years ago
Victor Julien
f1e6e80a1e
Properly set tmp_ra_base_seq in streams. By Gurvinder.
15 years ago
Gurvinder Singh
6a5bc52461
support for several tcp evasion attacks. Thanks to Judy Novak and G2 Inc for reporting them
15 years ago
Pablo Rincon
5c43db85ce
Drop streams on inline mode when a drop rule match from a reassembled stream and/or app layer inspection
15 years ago
Victor Julien
c25921edf0
Add config output for new stream settings.
16 years ago
Gurvinder Singh
7577823cdf
support for stopping the evasion, which is caused by the use of TCP RST packets for linux based systems
16 years ago
Gurvinder Singh
f0928a4555
support for enforcing the depth until when the reassembly will be performed
16 years ago
Gurvinder Singh
8b0ca4f628
support for seperate memcaps for reassembly and stream engine
16 years ago
Victor Julien
18c923318a
Fix bug where valid FIN packets would be rejected.
16 years ago
Victor Julien
05d382f533
Fix broken stream engine config initialization: due wrong casts settings could be overwritten in memory.
16 years ago
Victor Julien
580b09c2b8
Make sure we inspect all outstanding reassembled stream chunks (smsg) if the stream is shutting down. Make sure to do inspect signatures that use dsize against the tcp packet payload, even if that payload was already added to the stream. Likewise, the dsize signatures are not inspected against the reassembled stream.
16 years ago
Victor Julien
b8fec77f37
Fix tcp connections that are reset (RST packet) not always inspecting the reassembled stream. Update transaction id code to make sure both directions of a transaction are inspected before incrementing the inspect_id.
16 years ago
Anoop Saldanha
015385c6bd
changes to the dce parser stub data processed var. changed to stub data fresh var to indicate if the stub is fresh or not
16 years ago
Anoop Saldanha
45ea0d914e
dce stub content keywords support using dcepayload.c support for all dce related content keywords
16 years ago
Pablo Rincon
8cc525c939
UDP support at AppLayer message handling
16 years ago
Victor Julien
a0c1209a44
Inspect the reassembled stream together with the packet payload in the same direction.
16 years ago
Victor Julien
9f95ab7441
Make sure a stream that has a failing app layer inspection module no longer stops reassembly, but only app layer inspection. This way we can continue to inspect the reassembled stream.
16 years ago
Victor Julien
4e7df60b2f
Make pcap file mode read multiple packets per 'read'. Update threading model to deal with this.
16 years ago
William Metcalf
2eef905c07
GPL and Copyright header updates.
16 years ago
Gurvinder Singh
5fe1dc1d24
support for sslv2/sslv3 their unit tests and better stream no reassembly flag handling
16 years ago
Gerardo Iglesias Galvan
9f4fae5b1a
Fix inconsistent use of dynamic memory allocation
16 years ago
William Metcalf
ce01927515
Import of GPLv2 Header 050410
16 years ago
Victor Julien
070ed778b8
Libcap-ng support by Gurvinder Singh and myself. Basic support for per thread caps is added, but not activated as it doesn't seem to work yet. Work around for incompatibility between libnet 1.1 and libcap-ng added.
16 years ago
Gurvinder Singh
e0b4838471
fix bug 133, error caused by seq mismatch in fin_wait_2 state, whis was dicarding the packet which should be accepted
16 years ago
Victor Julien
0eabde4a9b
Gnu99 inline fixes for stream engine.
16 years ago
Victor Julien
eeb98c6900
Move SCSetThreadName to proper functions.
16 years ago
Gerardo Iglesias Galvan
9f35a24a1f
Set threads name. Fix bug #83
16 years ago
Victor Julien
ad02732907
Properly cleanup stream engine spinlocks and mutexes at shutdown. Fixes drd errors in unittests.
16 years ago
Pablo Rincon
2ce728d019
Adding support for ecn flags after the handshake
16 years ago
Victor Julien
2b3479577b
Fix ecn/cwr unittests
16 years ago
Victor Julien
5eb4095b9a
Comment ECN/CWR changes more.
16 years ago
Pablo Rincon
83ddc5813a
Support for ecn/cwr TCP sessions
16 years ago
Gurvinder Singh
8e444f1772
stream and application layer improvements
16 years ago
Victor Julien
f4ee4f5670
Properly clear list tail ptr in segment list.
16 years ago
Jason Ish
eab93e766a
Do policy lookup for defrag. Add unit test for a default host os policy. Update example config to use a default. Add 2 new policies to the stream to cover all the policies for stream and defrag.
16 years ago
Gurvinder Singh
7438f981da
stream memory leaks fixed and unit tests added
16 years ago
Pablo Rincon
25a3a5c6d8
Adding mem wrapper to debug runtime alloc()/free() functions. Fixing some memory leaks.
16 years ago
Jan Jezek
4e72ccf987
Fixed Win32 compilation, unit tests now compile.
16 years ago
Victor Julien
60685f8b3c
Make unittests run more quiet.
16 years ago
Pablo Rincon
d0404d8447
Renaming errors with naming conventions
16 years ago
Victor Julien
53977fded6
Small compilation fixes when debugging is disabled.
16 years ago
Victor Julien
6a53ab9c5a
Stream engine memory handling update
...
The stream engine memory handling needed updating as it didn't scale. Changes:
- pools can now be initialized to size 0, meaning unlimited
- stream engine uses a memcap setting. Sessions, segments and aldata is part
of this, app layer state isn't.
- memory is accounted using a global int that is spinlocked.
- a counter for sessions that have not been picked up because of memcap was
added.
- all reassembly errors are converted to debug msgs.
16 years ago
Victor Julien
f08d01a8e8
Set sensible tcp timeout defaults and no longer set the timeouts from the stream engine.
16 years ago
Victor Julien
0d34990d7f
Add OpenBSD's strlcpy and strlcat and replace all strcat/strcpy/strncat/strncpy by those calls.
16 years ago
Victor Julien
434da6b965
Set no reassembly flags on sessions we don't recognize the protocol for.
16 years ago
Gurvinder Singh
5c8d90afc8
memory leak fixes
16 years ago
Victor Julien
eb67bb442e
Fixup unittests that use buffers that simulate configuration files. They now include the YAML header.
16 years ago
Victor Julien
9ececacda3
Fix packet timestamp handling for encapsulated packets.
16 years ago
Victor Julien
c1283a6628
Fix app layer proto detection code not being thread safe.
16 years ago
Gurvinder Singh
fde948f488
bug 41 patch
16 years ago
Victor Julien
6b36e23e45
Fix not decreasing the flow use_cnt reference counter in some cases from the app layer detection code. This caused some streams to never fully time out and thus clutter up the flow table and session pool.
16 years ago
Gurvinder Singh
a66c6752d5
stream os_policy support
16 years ago
Gurvinder Singh
567bbf604b
stream reassembling fixes
16 years ago
Victor Julien
9b422c443e
Fix up initialization and hopefully make the SEQ macro's fix up an 64bit issue we're seeing...
16 years ago
Victor Julien
4824868766
Application layer detection improvements
...
- improve locking of application layer handling, making sure that the flow cannot be freed/cleared when the detection engine is still working with it.
- add a check to the app layer detection to make sure that a match function will only inspect an app layer state if it's of the right type.
16 years ago
Gurvinder Singh
0a85fd6787
htp error fixed
16 years ago
Gurvinder Singh
d8433c7255
fixed-pool-error-and-tcp-state-transition
16 years ago
Victor Julien
ecf86f9c23
Rename to Suricata.
16 years ago
Pablo Rincon
e26833be3f
Changing mutex/spinlocks/conditions naming types
16 years ago
Pablo Rincon
769022f4be
Adding support for Mac OS X, FreeBSD, centrailizing mutex/spins/conditions in a macro API, and some unittests
16 years ago
Gurvinder Singh
c1e485cc44
app layer error handling
16 years ago
Victor Julien
54b9663cd1
TCP streams: support falling back to 3WHS when we were led to believe we were in 4WHS mode. Add unittests.
16 years ago
Victor Julien
2af6ed0c8c
Support newly reported 4WHS TCP setup.
16 years ago
Gurvinder Singh
d2765511ce
async stream handling support
16 years ago
Anoop Saldanha
ceb7e495ae
refactoring perf stats code
16 years ago
Gurvinder Singh
e7952b1331
some changes in threading constants
16 years ago
Gurvinder Singh
40b8afdd56
support for thread exit constants
16 years ago
Gurvinder Singh
7895748606
add unit test for no stream reassembly
16 years ago
Gurvinder Singh
94674c58f3
unit tests for no packet & payload inspection
16 years ago
Gurvinder Singh
bbb385422d
function to set packet flags
16 years ago
Gurvinder Singh
cc0b4f7181
initial version to support detection byepass
16 years ago
Victor Julien
968d8df12b
More logging API usage. Changed logging macro's slightly so the vars inside them won't conflict with vars used by the calling function.
16 years ago
Victor Julien
bcc5bbef93
Yet more logging api usage changes.
16 years ago
Victor Julien
91bc83e5c6
More logging API usage changes.
16 years ago
Victor Julien
3a28171fbd
Another round of logging api usage updates.
16 years ago
Victor Julien
be3bbe0a85
Fix segv in reassembly. Fix sequence gap handling tests.
16 years ago
Victor Julien
b3cb29b758
Fix engine lockup due to mutex locking error.
16 years ago
Victor Julien
5ecd187b6f
Tie app layer parsing to the stream engine.
16 years ago
Gurvinder Singh
c06b2849fb
fixed unit tests and add the comments
16 years ago
Gurvinder Singh
e88249ee24
small performance enhancement
16 years ago
Gurvinder Singh
37b4682407
target based paws handling
16 years ago
Gurvinder Singh
573027a1ec
PAWS support and one unittest
16 years ago
Gurvinder Singh
45cb8f5f0c
changed flag name
16 years ago
Gurvinder Singh
3350245f75
timestamp support
16 years ago
Victor Julien
597d0e9a20
Fix detection of failed thread startup. Cleanup startup output a bit.
16 years ago
Victor Julien
0d0ffb9963
Reorganize header inclusions.
16 years ago
Victor Julien
301522f316
Add TCP_GET_WSCALE macro for easy access to wscale. Update StreamTcp to use it. Default to wscale 14 (max) in case of midstream as there seems to be no reliable way to predict wscale if we missed it.
16 years ago
Victor Julien
edfddcb282
Clean up stream tests memory handling. Remove counters in the address handling that were thread unsafe.
16 years ago
Gurvinder Singh
aa87f70470
stream size match function and unittests
16 years ago
Victor Julien
15b75d727a
Fix reassembly unittests.
16 years ago
Victor Julien
a39108843e
Small tm module API rename to reflect that Init/Deinit/ExitPrintStats are per thread calls.
16 years ago
Victor Julien
b102ea2123
Big update:
...
- Implement "closing" state in flow.
- Add protocol specific timeouts.
- Lots of stream tracking updates, fixing a lot of out of window issues.
- Stream reassembly fixes.
- Implement a new IDS runmode with 4 stream and detect threads.
- Added a BUG_ON macro that aborts the engine if the expression is true.
- Better balance the flow queue handler for traffic that doesn't have flow (like icmp currently).
- Simplify application level protocol in the Tcp Session.
- Add some debugging memory counters.
16 years ago
Victor Julien
b4f0e82463
Small flow updates.
16 years ago
Gurvinder Singh
2e3d7fcb9d
Fixed seg fault
16 years ago
Gurvinder Singh
9dcf6e2de2
handle the FLOW_STATE_CLOSED
16 years ago
Gurvinder Singh
ced5157dc9
Flow get state protocol specific
16 years ago
Gurvinder Singh
ab76253ec6
registering stream timeouts and flow prunning unit tests
16 years ago
Gurvinder Singh
a4ad7939d2
proto specific free function
16 years ago
Victor Julien
18f556ade1
Fix a number of broken overlap calculations. Add comments exmplaining them all.
17 years ago
Victor Julien
84da1e9dc4
Add seg_list integrity testing to reassemly. Remove all debug output but some. Better deal with packets before the point that we already reassembled.
17 years ago
Gurvinder Singh
0a32b6491f
Handling of IDS missed packets and its unitests
17 years ago
Anoop Saldanha
244f5d547a
new registration functions for the stats api, with local thread storage for counter ids
17 years ago
Victor Julien
0a9fca7e57
Fix compilation without unittests enabled.
17 years ago
Victor Julien
522efdcf03
Small reshuffle of the free funcs in the Stream code.
17 years ago
Gurvinder Singh
6824eddb0f
New function for task3
17 years ago
Brian Rectanus
fa5939ca91
64 bit cleanup part2
17 years ago
Anoop Saldanha
8af9f902e8
additional support for type qualifier for the stats api
17 years ago
Victor Julien
54ae12b1f9
Fixes for the stream reassembly. It turned out that using both a prev_seg pointer and a list_seg->prev pointer at the same time was not the best of ideas. So removed the prev_seg ptr. Cleaned up some copy functions too. Added some more debug statements. Made sure the L7 stuff doesn't kick in when running the unittests for reassembly.
17 years ago
Victor Julien
387472185d
Small reshuffling of the unittests, fix of a buffer overflow, hide some dbg output in the stream reassembly.
17 years ago
Gurvinder Singh
994473cea0
Target Based Stream Reassembly with comments
17 years ago
Victor Julien
689bbfdc45
Rename all structure definitions in the "typedef struct _SomeStruct" format to "typedef struct SomeStruct_" to make the Doxygen output more useful.
...
Remove the Trie multi pattern matcher code. It wasn't used anymore.
17 years ago
Victor Julien
1c2240cfeb
Stream reassembly update and WIP code for L7 modules.
17 years ago
Victor Julien
51a9e36e10
Remove vips references. Rename to eidps.
17 years ago
Victor Julien
668e9514d7
Pool update. Stream reassembly start.
17 years ago
Victor Julien
9c7f5afa79
Large update: pcap support, threading fixes, initial stream tracking, time handling, pool support, runmodes, decoders added, autojunk update.
17 years ago