STUN: improve extraction of Mapped-Address metadata (#2370)

Enable parsing of Mapped-Address attribute for all STUN flows: that
means that STUN classification might require more packets.

Add a configuration knob to enable/disable this feature.

Note that we can have (any) STUN metadata also for flows *not*
classified as STUN (because of DTLS).

Add support for ipv6.

Restore the correct extra dissection logic for Telegram flows.
This commit is contained in:
Ivan Nardi
2024-04-08 10:24:51 +02:00
committed by GitHub
parent f5905a62c7
commit 1b3ef7d7b2
35 changed files with 409 additions and 248 deletions
+1
View File
@@ -249,6 +249,7 @@ struct ndpi_detection_module_config_struct {
int stun_opportunistic_tls_enabled;
int stun_max_packets_extra_dissection;
int stun_mapped_address_enabled;
int dns_subclassification_enabled;
int dns_parse_response_enabled;
+7 -3
View File
@@ -1287,8 +1287,12 @@ struct ndpi_flow_struct {
struct {
u_int8_t maybe_dtls : 1, is_turn : 1, pad : 6;
struct {
u_int32_t ipv4;
union {
u_int32_t v4;
u_int8_t v6[16];
} address; /* Network-order */
u_int16_t port;
u_int16_t is_ipv6: 1, _pad: 15;
} mapped_address;
} stun;
@@ -1513,8 +1517,8 @@ struct ndpi_flow_struct {
_Static_assert(sizeof(((struct ndpi_flow_struct *)0)->protos) <= 256,
"Size of the struct member protocols increased to more than 256 bytes, "
"please check if this change is necessary.");
_Static_assert(sizeof(struct ndpi_flow_struct) <= 1024,
"Size of the flow struct increased to more than 1024 bytes, "
_Static_assert(sizeof(struct ndpi_flow_struct) <= 1032,
"Size of the flow struct increased to more than 1032 bytes, "
"please check if this change is necessary.");
#endif
#endif