Reworked teams handling

This commit is contained in:
Luca Deri
2023-06-15 22:31:11 +02:00
parent 2321c11eb5
commit 9cc4cbb9d1
6 changed files with 74 additions and 60 deletions
+1 -7
View File
@@ -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
+46 -23
View File
@@ -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:
+3 -3
View File
@@ -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 */