diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2024-05-10 19:23:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 19:23:50 +0200 |
commit | 4b4b358562a80b546d10f779dba8c56c5d0c6502 (patch) | |
tree | 54636681c7f1f469f2249673292bfd84fd94e5ff /src | |
parent | 6bbae9a70a2b346968406d582f411447c9cbbd00 (diff) |
Line: use common helper to detect RTP/RTCP packets (#2429)
Add an explicit upper limit on the number of packets processed before
giving up.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/protocols/line.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/protocols/line.c b/src/lib/protocols/line.c index 6b69d690c..da28e613b 100644 --- a/src/lib/protocols/line.c +++ b/src/lib/protocols/line.c @@ -38,6 +38,7 @@ static void ndpi_search_line(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct const * const packet = &ndpi_struct->packet; + int rc; NDPI_LOG_DBG(ndpi_struct, "searching LineCall\n"); @@ -82,12 +83,12 @@ static void ndpi_search_line(struct ndpi_detection_module_struct *ndpi_struct, /* It might be a RTP/RTCP packet. Ignore it and keep looking for the LINE packet numbers */ /* Basic RTP detection */ - if((packet->payload[0] >> 6) == 2 && /* Version 2 */ - (packet->payload[1] == 201 || /* RTCP, Receiver Report */ - packet->payload[1] == 200 || /* RTCP, Sender Report */ - is_valid_rtp_payload_type(packet->payload[1] & 0x7F)) /* RTP */) { - NDPI_LOG_DBG(ndpi_struct, "Probably RTP; keep looking for LINE\n"); - return; + rc = is_rtp_or_rtcp(ndpi_struct, NULL); + if(rc == IS_RTCP || rc == IS_RTP) { + if(flow->packet_counter < 10) { + NDPI_LOG_DBG(ndpi_struct, "Probably RTP; keep looking for LINE\n"); + return; + } } else { if((u_int8_t)(flow->l4.udp.line_base_cnt[packet->packet_direction] + flow->l4.udp.line_pkts[packet->packet_direction]) == packet->payload[3]) { |