diff options
author | Luca Deri <deri@ntop.org> | 2023-06-15 22:29:07 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2023-06-15 22:31:11 +0200 |
commit | 9cc4cbb9d136d5e131ce03c1e96fecc249601c88 (patch) | |
tree | 0d0501c398a33285b53ee5d6c2c71771732ca6a7 /src | |
parent | 2321c11eb56211733050429bbeb0a89ddc0caed0 (diff) |
Reworked teams handling
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_typedefs.h | 8 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 69 | ||||
-rw-r--r-- | src/lib/protocols/rtp.c | 6 |
3 files changed, 50 insertions, 33 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 898d305fc..c45669432 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1444,13 +1444,7 @@ struct ndpi_flow_struct { char *nat_ip; /* Via HTTP X-Forwarded-For */ } http; - struct { - ndpi_multimedia_flow_type flow_type; - } skype_teams; - - struct { - ndpi_multimedia_flow_type flow_type; - } zoom; + ndpi_multimedia_flow_type flow_type; /* Put outside of the union to avoid issues in case the protocol diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 39673ca48..fb54035fd 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -6070,6 +6070,51 @@ static void ndpi_reconcile_msteams_udp(struct ndpi_detection_module_struct *ndpi /* ********************************************************************************* */ +static int ndpi_reconcile_msteams_call_udp_port(struct ndpi_detection_module_struct *ndpi_str, + struct ndpi_flow_struct *flow, + u_int16_t sport, u_int16_t dport) { + + /* + https://extremeportal.force.com/ExtrArticleDetail?an=000101782 + + Audio: UDP 50000-50019; 3478; 3479 + Video: UDP 50020-50039; 3480 + Sharing: UDP 50040-50059; 3481 + */ + + if((dport == 3478) || (dport == 3479) || ((sport >= 50000) && (sport <= 50019))) + flow->flow_type = ndpi_multimedia_audio_flow; + else if((dport == 3480) || ((sport >= 50020) && (sport <= 50039))) + flow->flow_type = ndpi_multimedia_video_flow; + else if((dport == 3481) || ((sport >= 50040) && (sport <= 50059))) + flow->flow_type = ndpi_multimedia_screen_sharing_flow; + else { + flow->flow_type = ndpi_multimedia_unknown_flow; + return(0); + } + + return(1); +} + +/* ********************************************************************************* */ + +static void ndpi_reconcile_msteams_call_udp(struct ndpi_detection_module_struct *ndpi_str, + struct ndpi_flow_struct *flow) { + if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_SKYPE_TEAMS_CALL) { + struct ndpi_packet_struct *packet = &ndpi_str->packet; + + if((packet != NULL) && (packet->udp != NULL)) { + u_int16_t sport = ntohs(packet->udp->source); + u_int16_t dport = ntohs(packet->udp->dest); + + if(ndpi_reconcile_msteams_call_udp_port(ndpi_str, flow, sport, dport) == 0) + ndpi_reconcile_msteams_call_udp_port(ndpi_str, flow, dport, sport); + } + } +} + +/* ********************************************************************************* */ + static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, ndpi_protocol *ret) { @@ -6159,29 +6204,7 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s } } - if(ret->app_protocol == NDPI_PROTOCOL_SKYPE_TEAMS_CALL) { - if(flow->l4_proto == IPPROTO_UDP) { - u_int16_t sport = ntohs(flow->c_port); - u_int16_t dport = ntohs(flow->s_port); - - /* - https://extremeportal.force.com/ExtrArticleDetail?an=000101782 - - Audio: UDP 50000-50019; 3478; 3479 - Video: UDP 50020-50039; 3480 - Sharing: UDP 50040-50059; 3481 - */ - - if((dport == 3478) || (dport == 3479) || ((sport >= 50000) && (sport <= 50019))) - flow->skype_teams.flow_type = ndpi_multimedia_audio_flow; - else if((dport == 3480) || ((sport >= 50020) && (sport <= 50039))) - flow->skype_teams.flow_type = ndpi_multimedia_video_flow; - else if((dport == 3481) || ((sport >= 50040) && (sport <= 50059))) - flow->skype_teams.flow_type = ndpi_multimedia_screen_sharing_flow; - else - flow->skype_teams.flow_type = ndpi_multimedia_unknown_flow; - } - } + ndpi_reconcile_msteams_call_udp(ndpi_str, flow); break; case NDPI_PROTOCOL_RDP: diff --git a/src/lib/protocols/rtp.c b/src/lib/protocols/rtp.c index c727cca58..093e509af 100644 --- a/src/lib/protocols/rtp.c +++ b/src/lib/protocols/rtp.c @@ -131,19 +131,19 @@ static u_int8_t isZoom(struct ndpi_flow_struct *flow, case 30: /* Screen Share */ *is_rtp = 0; *payload_offset = 27; - flow->zoom.flow_type = ndpi_multimedia_screen_sharing_flow; + flow->flow_type = ndpi_multimedia_screen_sharing_flow; break; case 15: /* Audio */ *is_rtp = 1; *payload_offset = 27; - flow->zoom.flow_type = ndpi_multimedia_audio_flow; + flow->flow_type = ndpi_multimedia_audio_flow; break; case 16: /* Video */ *is_rtp = 1; *payload_offset = 32; - flow->zoom.flow_type = ndpi_multimedia_video_flow; + flow->flow_type = ndpi_multimedia_video_flow; break; case 33: /* RTCP */ |