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
(cherry picked from commit c5f56c4758)
pull/1852/head
Richard Fuchs 1 year ago
parent 58db56ed98
commit 6bbc282792

@ -4831,7 +4831,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;
@ -4840,13 +4840,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;
}
@ -5030,7 +5031,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);
}

Loading…
Cancel
Save