Commit Graph

9189 Commits (bbf1f78ffef1e1ecbbada9155afc04f400247df3)
 

Author SHA1 Message Date
Victor Julien bbf1f78ffe streaming: keep track of tree 'head' 7 years ago
Victor Julien 450500e667 streaming: use rbtree for stream blocks
Switch StreamBufferBlocks implementation to use RBTREE instead of
a list. This makes inserts/removals and lookups a lot cheaper if
the number of data gaps is large.

Use separate compare functions for inserts and regular lookups.
Inserts care about the offset, while lookups care about the blocks
right edge as well.
7 years ago
Victor Julien 9bda558c59 stream/sack: optimize SACK size handling
Optimize by keeping count during insert/remove instead of
walking the tree per check.
7 years ago
Victor Julien 7ec7d234cc stream/sack: turn SACK record list into rbtree
Convert to rbtree from linked list. These ranges, of which there can
be multiple per packet, are fully controlled by an attacked. The
attacker could craft a stream of packet in such a way that the list
would grow very large. This would make inserts/removals very expensive,
as well as the list walk that is done and size calculation and pruning
operations.

The RBTREE makes inserts/removals much cheaper, at a slight overhead
for 'normal' operations and slightly higher per record memory use.
7 years ago
Victor Julien 51ce03e76a stream/segments: speed up inserts
Don't try to do a 'fast path' by checking RB_MAX. RB_MAX walks the
tree which means it can be quite expensive. This cost would be paid
for virtually every data segment. The actual insert that follows would
walk the tree again.

Instead, simply insert it. There is a slight cost of the unnecessary
overlap check, but this is much less than the tree walk in a full
tree.
7 years ago
Victor Julien f4ff33969e stream/segments: remove RB_MIN/RB_MAX 7 years ago
Victor Julien 00e65e3cfa stream/segments: optimize overlap tree operations
Now that with the RBTREE we have a properly sorted Segment tree,
where with exact SEQ matches the tree is sorted by payload_len
smallest to largest, we can avoid walking backwards when checking
for overlaps. Our direct RB_PREV either overlaps or not and that
is a reliable verdict for the rest of the tree.
7 years ago
Victor Julien 26b5e1ed13 stream/segments: turn linked list into rbtree
To improve worst case performance turn the segments list into a rbtree.
This greatly improves inserts, lookups and removals if the number of
segments gets very large.

The tree is sorted by the segment sequence number as its primary key.
If 2 segments have the same seq, the payload_len (segment length) is
used. Then the larger segment will be places after the smaller segment.
Exact matches are not added to the tree.
7 years ago
Victor Julien 6a0cf0dd74 tree: add scan-build assertions to suppress FPs 7 years ago
Victor Julien 555fb15ab4 tree: add 2-clause BSD licensed tree.h 7 years ago
Victor Julien 9266334430 stream: expand GAP detection 7 years ago
Victor Julien 3a0eca9fde detect/mpm: minor code cleanup 7 years ago
Victor Julien 164252e381 detect/file: fix minor scan-build warnings 7 years ago
Victor Julien 11f213fb80 stream/tcp: be more liberal in last_ack
Don't set even if seq is before next_seq, as this could still be
a valid packet that was sent before the state was reached.
7 years ago
Victor Julien d7dae87e8b stream/tcp: add debug statements to state dispatcher 7 years ago
Mats Klepsland eba0d04171 app-layer-ssl: don't decode empty extensions 7 years ago
Mats Klepsland 4d38d0844b doc: add documentation for Lua function 'TlsGetVersion' 7 years ago
Mats Klepsland 04e78ace0a lua: add function 'TlsGetVersion'
Add another function to get TLS version, since 'TlsGetCertInfo' only
works when a TLS session contains a clear text certificate, which is
not the case in TLSv1.3 or when a session is resumed.
7 years ago
Mats Klepsland 10fcc8d2ca doc: update tls.version documentation 7 years ago
Mats Klepsland df9853b75c detect-tls-version: add support for 'raw' matching
Add support for matching a 'raw' TLS version using a hex string, e.g:

  tls.version:0x7f12;

The above example matches TLSv1.3 draft 16.
7 years ago
Mats Klepsland 4323e7840f detect-tls-version: add support for TLSv1.3 7 years ago
Mats Klepsland e813842731 detect-ssl-version: add support for TLSv1.3 7 years ago
Mats Klepsland db2fc9208a lua: use 'SSLVersionToString' in TlsGetCertInfo() 7 years ago
Mats Klepsland 13918be589 tlslog: add support for TLSv1.3 7 years ago
Mats Klepsland 25fb02da9a output-json-tls: add support for TLSv1.3 7 years ago
Mats Klepsland 97cc3475bf app-layer-ssl: add function to get string from version
Add 'SSLVersionToString' to get string from version.
7 years ago
Mats Klepsland 91acd3831f app-layer-ssl: add support for earlier TLSv1.3 drafts
Add support for TLSv1.3 draft 1 to draft 21.
7 years ago
Mats Klepsland 831ddb62d2 app-layer-ssl: add support for TLSv1.3 from draft 22
Add support for draft 22 to draft 28 and for the final
version (RFC8446) of TLSv1.3.
7 years ago
Mats Klepsland e0ef578c46 app-layer-ssl: add support for session tickets
Add support for logging a session as 'resumed' when using a non-empty
session ticket extension in the client hello record.
7 years ago
Mats Klepsland 21897a4d7a app-layer-ssl: add better session id support
Verify that the session id from both the client hello record and the
server hello record matches before marking the session as 'resumed'.
7 years ago
Mats Klepsland f22bd5a75b app-layer-ssl: decode server hello record
Decoding server hello is needed to do a better implementation of
session resumption.
7 years ago
jason taylor 0f1c8711ce doc: README.md minor fixes
- Capitalization update
- Typo fix
- Spacing update

Signed-off-by: jason taylor <jtfas90@gmail.com>
7 years ago
Victor Julien 93364b9175 flow/timeout: code simplification and cleanup 7 years ago
Victor Julien c8ecca59f8 stream: minor code cleanup 7 years ago
Victor Julien af6f52cc09 rules: hide 'template' from --list-keywords 7 years ago
Victor Julien b0577402b6 rules: hide internal keywords from --list-keywords 7 years ago
Victor Julien 8c7aee92eb flow-manager: fix unittest initialization 7 years ago
Mats Klepsland 68cc53d188 app-layer-ssl: make sure that JA3 stuff is only initialized once
Avoid possible memory leaks by making sure that JA3 buffer and
string is only initialized once.
7 years ago
Mats Klepsland 5ec2f6e7b3 app-layer-ssl: fix memleak/coredump (Bug #2603) 7 years ago
Eric Leblond fcd5e138b9 af-packet: close the socket in case of early fail 7 years ago
Eric Leblond 7e8a749227 log-filestore: fix file descriptor leak
In the case we exceed the number of simultaneously open
file we can reach a state were we will not close the file
after writing.

Thanks to Steve Grubb <sgrubb@redhat.com> for the analysis.
7 years ago
Victor Julien 876156d3a1 profiling/app-layer: fix TCP parsers showing UDP stats 7 years ago
Victor Julien 1f16b42d78 profiling: add missing logger labels 7 years ago
Victor Julien 1f4cd75f05 detect: clean up sgh flags and add cocci check 7 years ago
Victor Julien e6b74f8ee0 stream: minor code cleanups 7 years ago
Victor Julien 7abb8745bf detect/mpm: clean up setup code 7 years ago
Jason Ish 1c6bc5754c dhcp: check length of option before accessing
Prevent Rust index out of bounds panic.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2571
7 years ago
Jason Ish 7bc2469eb1 dhcp: remove println!() that got committed 7 years ago
Victor Julien 88277d0402 detect: fix file_data detect issue with alert ip
Fix mpm progress being updated by irrelevant engines. Esp in the
case of file_data engines, signature can contain multiple versions
of the same engine, registered for different 'progress' values.

This would lead to signatures being considered 'can't match' even
in cases where they clearly could still match.

Only consider those progress values that apply to the protocol in
use.
7 years ago
Victor Julien a68eec630f detect/parse: try to set flow direction for sigs w/o explict app proto as well 7 years ago