From faa95000b05863cd2a5762140a035e72ddbd4aa7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 17 Sep 2021 11:38:56 -0400 Subject: [PATCH] TT#14008 fix kernel RTCP mux test AVPF extended (non-compound) RTCP packets don't satisy the same RTP-like header rules as regular RTCP compound packets, therefore we move the RTCP mux test ahead of the RTP header parsing test. Change-Id: Iecb3895d16796095f572c2eda2efa0a7a0dc69e7 (cherry picked from commit 4fa48df9524be9878ad076633a4ee1f73d376c50) --- kernel-module/xt_RTPENGINE.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index b142a0041..164c19292 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -4034,10 +4034,15 @@ static inline int srtp_decrypt(struct re_crypto_context *c, return c->cipher->decrypt(c, s, r, pkt_idx); } -static inline int is_muxed_rtcp(struct rtp_parsed *r) { - if (r->header->m_pt < 194) +static inline int is_muxed_rtcp(struct sk_buff *skb) { + // XXX shared code + unsigned char m_pt; + if (skb->len < 8) // minimum RTCP size + return 0; + m_pt = skb->data[1]; + if (m_pt < 194) return 0; - if (r->header->m_pt > 223) + if (m_pt > 223) return 0; return 1; } @@ -4296,6 +4301,9 @@ src_check_ok: if (!g->target.rtp) goto not_rtp; + if (g->target.rtcp_mux && is_muxed_rtcp(skb)) + goto skip1; + parse_rtp(&rtp, skb); if (!rtp.ok) { if (g->target.rtp_only) @@ -4303,9 +4311,6 @@ src_check_ok: goto not_rtp; } - if (g->target.rtcp_mux && is_muxed_rtcp(&rtp)) - goto skip1; - rtp_pt_idx = rtp_payload_type(rtp.header, &g->target); // Pass to userspace if SSRC has changed.