Commit Graph

15697 Commits (240e068b81275e287ffe6555d4c457a0b3916066)
 

Author SHA1 Message Date
Philippe Antoine 240e068b81 conf: avoid quadratic complexity
Ticket: 6878

Follow up on 15649424a7

When adding many sequence nodes, either from start or scalar event

We add "sequence nodes" whose name is an integer cf sequence_node_name
and then run ConfNodeLookupChild to see if it had been already set
(from the command line cf comment in the code)
And ConfNodeLookupChild iterates the whole linked list...

1. We add node 1
2. To add node 2, we check if node 1 equals this new node
3. To add node 3, we check if nodes 1, or 2 equals this new node's name
And so on...

This commits avoids these checks ig the list is empty at the beginning
2 years ago
Andreas Herz 1f9600e487 dataset: cleanup datasets that hit the memcap while loading
Datasets that hit the memcap limit need to be discarded if the memcap is
hit or otherwise the datasets are still loaded with partial data while
the signature is not loaded due to the memcap error.

Ticket: #6678
2 years ago
Victor Julien dc5b78ec71 decode/ppp: fix iplen check int handling
** CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
/src/decode-ppp.c: 64 in DecodePPPCompressedProto()
/src/decode-ppp.c: 55 in DecodePPPCompressedProto()

________________________________________________________________________________________________________
*** CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
/src/decode-ppp.c: 64 in DecodePPPCompressedProto()
58             case 0x57: { /* PPP_IPV6 */
59                 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) {
60                     ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL);
61                     return TM_ECODE_FAILED;
62                 }
63                 DEBUG_VALIDATE_BUG_ON(len < data_offset);
>>>     CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
>>>     "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:".
64                 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset));
65                 return DecodeIPV6(tv, dtv, p, pkt + data_offset, iplen);
66             }
67             case 0x2f: /* PPP_VJ_UCOMP */
68                 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) {
69                     ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL);
/src/decode-ppp.c: 55 in DecodePPPCompressedProto()
49             case 0x21: { /* PPP_IP */
50                 if (unlikely(len < (data_offset + IPV4_HEADER_LEN))) {
51                     ENGINE_SET_INVALID_EVENT(p, PPPVJU_PKT_TOO_SMALL);
52                     return TM_ECODE_FAILED;
53                 }
54                 DEBUG_VALIDATE_BUG_ON(len < data_offset);
>>>     CID 1596376:    (CONSTANT_EXPRESSION_RESULT)
>>>     "65535 /* 32767 * 2 + 1 */ < (uint16_t)(len - data_offset)" is always false regardless of the values of its operands. This occurs as the logical first operand of "?:".
55                 uint16_t iplen = MIN(USHRT_MAX, (uint16_t)(len - data_offset));
56                 return DecodeIPV4(tv, dtv, p, pkt + data_offset, iplen);
57             }
58             case 0x57: { /* PPP_IPV6 */
59                 if (unlikely(len < (data_offset + IPV6_HEADER_LEN))) {
60                     ENGINE_SET_INVALID_EVENT(p, PPPIPV6_PKT_TOO_SMALL);
2 years ago
Juliana Fajardini ce1556cefd pgsql: check for eol when parsing response
It was brought to my attention by GLongo that Pgsql parser handled eof
diffrently for requests and responses, and apparently there isn't a good
reason for such a difference therefore, apply same logic used for
rs_pgsql_parse_request for checking for eof when parsing a response.
2 years ago
Juliana Fajardini 54ea6c5983 eve/alert: add missing pgsql metadata
Bug #6092
2 years ago
Sascha Steinbiss 120313f4da ja4: implement for TLS and QUIC
Ticket: OISF#6379
2 years ago
Sascha Steinbiss 9d0db71ebf ja3: make feature compile time configurable 2 years ago
Sascha Steinbiss 32f23b6d2f suricata: initialize feature tracking earlier
This gives app layer code a chance to access feature
information.
2 years ago
Jeff Lucovsky c305ed149c flow/inject: Select thread_id by flow flag
Issue: 6957

Rather than selecting the thread_id index by packets traveling to the
server, use the flow flags. If the flow has been reversed, the second
slot is represents the thread id to be used.
2 years ago
Victor Julien 516441b600 decode/ppp: add missing types definitions
Recognize PPP_CCP, PPP_CBCP and PPP_COMP_DGRAM.

Does not implement decoders for these record types, so these
are logged as unsupported types. Was "wrong_type" before.
2 years ago
Victor Julien 7e3f071e49 decode/ppp: clean up ppph pointer use
No users of the pointer anymore, so remove it.
2 years ago
Victor Julien 6067955afd decode/ppp: remove ppph check in favor of flag
As we now support variable size headers, we can't use the old pointer.

Replace with a flag.
2 years ago
Victor Julien 68092ff33c decode/ppp: support different header formats
Support compressed proto and optional HDLC header.

Bug: #6942.
2 years ago
Philippe Antoine bd3bed6c31 detect/analyzer: add more details for tcp_mss
Issue: #6355
2 years ago
Philippe Antoine 49caf005a4 detect/analyzer: create tojson function for generic integers
As will be needed for tcp.mss
2 years ago
Philippe Antoine 784ce30ae1 util: remove unused bloom filter code
Ticket: 4083
2 years ago
Philippe Antoine b113bdd9e3 src: remove unused headers-exported functions
+ remove double definition of IPPairLock

Ticket: #4083
2 years ago
Jeff Lucovsky 2dfa4cecb5 stats: Memcap pressure max relocation
This commit moves the memcap pressure/pressure_max stats from the global
stats namespace into the memcap namespace.

With per-thread stats, they will be within the flow-manager's values.

Issue: 6398
2 years ago
Jeff Lucovsky 7a5a1e2560 doc: Describe noalert keyword
Issue: 6685
2 years ago
Philippe Antoine 3643b6ed4b output: generic simple tx json logger
Ticket: 3827
2 years ago
Philippe Antoine 688efe79f0 output/dns: do not add empty app-layer metadata 2 years ago
Philippe Antoine 74aa80022c output/dnp3: restrict function scope to one file 2 years ago
Victor Julien 76322368ed pcap: support LINKTYPE_IPV6 (229)
This is just another variant of DLT_RAW.

Ticket: #6943.
2 years ago
Victor Julien 49c67b2bb1 defrag: fix wrong datalink being logged
Eve's packet_info.linktype should correctly indicated what the `packet`
field contains. Until now it was using DLT_RAW even if Ethernet or other
L2+ headers were present.

This commit records the datalink of the packet creating the first
fragment, which can include the L2+ header data.

Bug: #6887.
2 years ago
Juliana Fajardini 72146b969c eve/stats: allow hiding counters whose valued is 0
Some stats can be quite verbose if logging all zero valued-counters.
This allows users to disable logging such counters. Default is still
true, as that's the expected behavior for the engine.

Task #5976
2 years ago
Lukas Sismis 10590e6d94 dpdk: support 52 byte long key on ice (E810) cards 2 years ago
Lukas Sismis d4085fceb6 dpdk: enlarge key length to 52 bytes 2 years ago
Philippe Antoine 365a66ac1c ci: clean some disk space to run CIFuzz again 2 years ago
Jason Ish 1657b6ff3c cargo: add description and license
Required for publishing to crates.io.
2 years ago
Jason Ish b9127e8b96 automake/rust: remove path.lib
Remove the path.lib parameter that is substituted into the output
Cargo.toml by autoconf. Instead, as part of the build, "cd" into the
source directory. We already set the Rust target directory to the
external build directory.

This makes the Cargo.toml more generic, and in a format suitable for
publishing to crates.io. It also makes it easier to pull in external
crates without needing to patch up their Cargo.toml, for example, it
might make pulling libhtp-rs easier.
2 years ago
Victor Julien 172775ed84 alert/syslog: fetch ipproto once 2 years ago
Victor Julien 7ad1a6b21b alert/syslog: stringify addresses outside alert loop 2 years ago
Victor Julien 291250f705 alert/syslog: minor code cleanups 2 years ago
Victor Julien 285fda5de8 alert/syslog: only hold lock for syslog call 2 years ago
Juliana Fajardini 172b55c547 log/stats: allow longer counter names
With the addition of exception policy stats counters, the human readable
version of the sats log was mis-aligned, when counters for per-app-proto
were enabled.

Width change made large enough to accomodate a counter as long as
"app_layer.error.bittorrent-dht.exception_policy.pass_packet" which
could be valid.

Task #5816
2 years ago
Juliana Fajardini 0f6dbf650e yaml: minor wording fix on Suricata package version 2 years ago
Juliana Fajardini 8defee93b2 yaml: explicitly mention exception policy in conf
While our documentation indicated what were the possible configuration
settings for exception policies, our yaml only explicitly mentioned
exception policy for the master switch. Clearly indicate which config
settings are about exception policies.

Related to
Task #5816
2 years ago
Juliana Fajardini 514e8b8b04 userguide: document exception policy stats
Configuration options and defaults, existing counters etc.

Related to
Task #5816
2 years ago
Juliana Fajardini 94b111283d userguide: highlight exception policy effects
Some exception policies can only be applied to entire flows or
individual packets, for some exception scenarios. Make this easier to
read, in the documentation.

Related to
Task #5816
2 years ago
Juliana Fajardini caf590d51f stream/midstream: add counter for exception policy
Add stats counters for when there is an exception policy applied in case
of a session picked up midstream.

Task #5816
2 years ago
Juliana Fajardini fd9a20ffcf stream/reassemble: add exception policy counters
Add stats counters for exception policies applied in case of memcap hit
during stream reassembly.

Task #5816
2 years ago
Juliana Fajardini 2dee3772bf stream/tcp: add ssnmemcap exception policy counter
Add stats counters for exception policies applied in case a stream
session memcap is hit.

Task #5816
2 years ago
Juliana Fajardini a71ace8575 applayer: add stats counters for exception errors
Add stats counters for exception policy are applied for app-layer errors

Part of
Task #5816
2 years ago
Juliana Fajardini 485c0e1d9a defrag: add exception policy memcap stats counters
Add defrag memcap stats counter.

Task #5816
2 years ago
Juliana Fajardini 657419b53e decode/flow: add exception policy stats counters
We will register stats counters for all policies, even though for now
Suri only uses one possible configuration policy at a time. The idea is
that this could change in the near future, so we want to have this
ready.

Task #5816
2 years ago
Juliana Fajardini c2c8cdb78a exceptions: make types and ToStr fns more accessible
Decode file needed ExceptionPolicy types and exception-policy file
needed Decode types, rendering some works quite difficult to work
around.

ExceptionPolicyToStr is useful for registering exception policy
counters, so make that public.

Part of
Task #5816
2 years ago
Juliana Fajardini ce001d8eae schema: apply clang formatting changes 2 years ago
Juliana Fajardini 112f5cc0ad app-layer/htp: clean up unused code in unittests
Remove unit test that was disabled and printf statements that were
replaced but not deleted, both in 48cf0585fb.
2 years ago
Juliana Fajardini cea917c38c app-layer: fix minor typo and formatting in LogInfo
Also update copyright years.
2 years ago
Daniel Olatunji d9148d1023 detect/analyzer: add more details for tcp_seq
Log the matched Sequence number of a packet
Issue: 6353
2 years ago