Commit graph

36 commits

Author SHA1 Message Date
Ivan Nardi
7cba34a1e3
Improve IPv6 support, enabling IPv6 traffic on (almost) all dissectors. (#1380)
There are no valid reasons for a (generic) protocol to ignore IPv6
traffic.
Note that:
* I have not found the specifications of "CheckPoint High Availability
Protocol", so I don't know how/if it supports IPv6
* all LRU caches are still IPv4 only

Even if src_id/dst_id stuff is probably useless (see #1279), the right
way to update the protocol classification is via `ndpi_set_detected_protocol()`
2021-12-04 13:30:10 +01:00
Ivan Nardi
afc2b641eb
Fix writes to flow->protos union fields (#1354)
We can write to `flow->protos` only after a proper classification.

This issue has been found in Kerberos, DHCP, HTTP, STUN, IMO, FTP,
SMTP, IMAP and POP code.
There are two kinds of fixes:
 * write to `flow->protos` only if a final protocol has been detected
 * move protocol state out of `flow->protos`
The hard part is to find, for each protocol, the right tradeoff between
memory usage and code complexity.

Handle Kerberos like DNS: if we find a request, we set the protocol
and an extra callback to further parsing the reply.

For all the other protocols, move the state out of `flow->protos`. This
is an issue only for the FTP/MAIL stuff.

Add DHCP Class Identification value to the output of ndpiReader and to
the Jason serialization.

Extend code coverage of fuzz tests.

Close #1343
Close #1342
2021-11-15 16:20:57 +01:00
Ivan Nardi
730c2360bd
Remove struct ndpi_packet_struct from struct ndpi_flow_struct (#1319)
There are no real reasons to embed `struct ndpi_packet_struct` (i.e. "packet")
in `struct ndpi_flow_struct` (i.e. "flow"). In other words, we can avoid
saving dissection information of "current packet" into the "flow" state,
i.e. in the flow management table.

The nDPI detection module processes only one packet at the time, so it is
safe to save packet dissection information in `struct ndpi_detection_module_struct`,
reusing always the same "packet" instance and saving a huge amount of memory.
Bottom line: we need only one copy of "packet" (for detection module),
not one for each "flow".

It is not clear how/why "packet" ended up in "flow" in the first place.
It has been there since the beginning of the GIT history, but in the original
OpenDPI code `struct ipoque_packet_struct` was embedded in
`struct ipoque_detection_module_struct`, i.e. there was the same exact
situation this commit wants to achieve.

Most of the changes in this PR are some boilerplate to update something
like "flow->packet" into something like "module->packet" throughout the code.
Some attention has been paid to update `ndpi_init_packet()` since we need
to reset some "packet" fields before starting to process another packet.

There has been one important change, though, in ndpi_detection_giveup().
Nothing changed for the applications/users, but this function can't access
"packet" anymore.
The reason is that this function can be called "asynchronously" with respect
to the data processing, i.e in context where there is no valid notion of
"current packet"; for example ndpiReader calls it after having processed all
the traffic, iterating the entire session table.

Mining LRU stuff seems a bit odd (even before this patch): probably we need
to rethink it, as a follow-up.
2021-10-05 15:49:52 +02:00
Luca Deri
61fc5be202 Reworked flow risk implementation 2021-07-23 17:27:15 +02:00
Luca Deri
8761ac1887 Renamed Skyp in Skype_Teams as the protocol is now shared across these apps 2021-06-02 21:47:01 +02:00
Luca Deri
a31bd5ac3c Cleaned up tls/quic datatypes 2021-01-21 19:17:33 +01:00
Luca Deri
68b6ac7da8 (C) Update 2021-01-07 11:13:36 +01:00
Luca Deri
8413faf2ef Boundary fix 2020-09-25 09:56:24 +02:00
Luca Deri
044ed14b4f Various optimizations to reduce not-necessary calls
Optimized various UDP dissectors
Removed dead protocols such as pando and pplive
2020-09-24 23:26:03 +02:00
Luca Deri
3ba7667887 Various ethereum improvements 2020-01-08 22:01:45 +01:00
Luca Deri
29dd45838d Updated (C) 2020-01-05 18:24:58 +01:00
Luca Deri
da029607a0 Removed (unreliable) line protocol detection 2019-11-18 21:21:52 +01:00
Luca Deri
ab9246f51f Adedd DTLS check in STUN
Uodated (C)
2019-09-21 09:16:56 +02:00
Luca
cce8a6026f Reworked SSL/TLS field naming 2019-08-08 15:20:05 +02:00
Luca
419160f351 Implemented DTLS support
Renamed ssl to tls
2019-08-08 12:45:27 +02:00
Luca
a0be9ea639 Fixed wrong detection of RTP as WhatsApp voice 2019-07-29 16:28:56 +02:00
Luca Deri
1777841ec1 Line dissection improvements 2019-07-16 00:02:34 +02:00
Luca Deri
5a018e0bc0 Added Line protocol dissection
Add fix for discarding STUN over TCP flows
2019-07-15 00:19:45 +02:00
Luca
667e77c609 Major code cleanup
Converted some not popular protocols to NDPI_PROTOCOL_GENERIC with category detection
2018-07-21 16:02:54 +02:00
Luca Deri
564d622cc9 Added ndpi_fill_protocol_category call
Introduced intitial Skype in/out support
2018-05-11 13:48:14 +02:00
Luca Deri
6a9fc935eb Added fix for invalid RTP/Skype detection
Added change in config.h generated by nDPI to avoid name clashes (the GNU autotools are really outdated)
2018-02-21 08:18:37 +01:00
Luca Deri
06bb9a9c57 Remove too strict check for RTP 2018-02-21 07:43:59 +01:00
Michele Campus
cb8f4f87bf
Merge branch 'dev' into dev 2017-12-07 22:45:28 +01:00
Luca Deri
8547b50be7
Merge pull request #493 from evengx/dev
Fixed ndpi_win32.h so that it compiles on MinGW+GCC
2017-11-28 17:51:53 +01:00
Jacob Masen-Smith
950f5db3dd Changed MinGW __forceinline strategy to something with less side effects 2017-11-23 20:40:43 -08:00
Luca
8eaf0cefa1 Warning fix 2017-11-23 15:39:20 +01:00
Vitaly Lavrov
2787c2390c Refactoring the debugging output.
levels of debug output:
 0 - ERROR: Only for errors.
 1 - TRACE: Start of each packets and if found protocol.
 2 - DEBUG: Start of searching each protocol and excluding protocols.
 3 - DEBUG_EXTRA: For all other messages.

Added field ndpi_struct->debug_logging for enable debug output of each protocols.

Simple macros for debugging output are added:
NDPI_LOG_ERR(), NDPI_LOG_INFO(), NDPI_LOG_DBG(), NDPI_LOG_DBG2(),
NDPI_EXCLUDE_PROTO()
2017-10-26 20:41:22 +03:00
Luca Deri
e6b594a626 Fixed TINC bug (cache usage)
Merged MS Lync with Skype (Microsoft renamed MS Lync in Skype for Business)
Renumbered Nintendo protocols in former MS Lync that was no longer used
Fix for #425
2017-07-27 00:18:15 +02:00
theirix
fb3fc0c6de Fixed buffer overflows with safe str search
1. Detected a lot of memory errors using address sanitizer
and ndpi-scapy tool.

2. Added ndpi_match_prefix function that compares strings
with taking care of payload packet len. Almost drop-in
replacement for match_first_bytes function.

3. Replaced unsafe match_first_bytes usage with a ndpi_match_prefix
and additional length checks.
2016-04-12 22:08:30 +03:00
Luca Deri
169c837613 Fix for https://github.com/ntop/nProbe/issues/7 for wrong RTP identification 2015-11-18 10:46:58 +01:00
Luca Deri
25631a25f7 Implemented MS Lync support 2015-10-22 00:32:48 +02:00
Luca
5266c726f2 Reworked protocol initialization. Work in progress (more cleanup is needed) 2015-07-08 11:58:55 -07:00
Luca
60884f9047 Split former protocol into upper and lower protocol 2015-07-01 17:40:14 +02:00
Luca
07ebed7fae Removed commented code
Renamed ndpi_int_add_connection() with ndpi_set_detected_protocol()
2015-07-01 16:45:29 +02:00
Michele Campus
8da7af7b7b deleted protocol type (real-correlated) 2015-06-29 16:24:51 +02:00
Luca Deri
2e5ceac844 Initial import from SVN 2015-04-19 07:25:59 +02:00