From c5f56c47588fd0711cebff2310ae70d476c0819c Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 17 Apr 2024 12:54:01 -0400 Subject: [PATCH] MT#55283 fix kernel SRTCP indexing Only increase the SRTCP index when encrypted SRTCP is actually in use. This would be apparent when a stream is switched from RTCP to SRTCP. Change-Id: I3a31377b89c5124035152d504e7d99f8cf1d96a1 --- kernel-module/xt_RTPENGINE.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index 2bc25e979..6582e7b72 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -4788,7 +4788,7 @@ static inline int srtp_encrypt(struct re_crypto_context *c, } static inline int srtcp_encrypt(struct re_crypto_context *c, struct rtpengine_srtp *s, struct rtp_parsed *r, - uint64_t pkt_idx) + uint64_t *pkt_idxp) { int ret; uint32_t idx; @@ -4797,13 +4797,14 @@ static inline int srtcp_encrypt(struct re_crypto_context *c, return 0; if (!c->cipher->encrypt_rtcp) return 0; - ret = c->cipher->encrypt_rtcp(c, s, r, &pkt_idx); + ret = c->cipher->encrypt_rtcp(c, s, r, pkt_idxp); if (ret) return ret; - idx = htonl(0x80000000ULL | pkt_idx); + idx = htonl(0x80000000ULL | *pkt_idxp); memcpy(r->payload + r->payload_len, &idx, sizeof(idx)); r->payload_len += sizeof(idx); + (*pkt_idxp)++; return 0; } @@ -4987,7 +4988,7 @@ static void proxy_packet_output_rtcp(struct sk_buff *skb, struct rtpengine_outpu pkt_idx = o->output.encrypt.last_rtcp_index[ssrc_idx]++; spin_unlock_irqrestore(&o->encrypt_rtcp.lock, flags); pllen = rtp->payload_len; - srtcp_encrypt(&o->encrypt_rtcp, &o->output.encrypt, rtp, pkt_idx); + srtcp_encrypt(&o->encrypt_rtcp, &o->output.encrypt, rtp, &o->output.encrypt.last_rtcp_index[ssrc_idx]); srtcp_authenticate(&o->encrypt_rtcp, &o->output.encrypt, rtp, pkt_idx); skb_put(skb, rtp->payload_len - pllen); }