MT#61404 always update egress RTP index

Add a simple function that acts as an encryption callback to just update
the ext_seq (index) of the egress SSRC context. The kernel module
already does this, but the daemon only did it when SRTP was involved.
This now tracks egress packet indexes in all cases.

Change-Id: I9460744de55ead4b05aceb322fd8482442ff2b41
(cherry picked from commit 0da49000ba)
(cherry picked from commit 3e8a35511b)
mr12.5.1
Richard Fuchs 2 months ago
parent a0173ec810
commit 4f0a8c250c

@ -221,6 +221,10 @@ const int num_transport_protocols = G_N_ELEMENTS(transport_protocols);
static const struct streamhandler_io __shio_noop = {
.kernel = __k_null,
};
static const struct streamhandler_io __shio_noop_index = {
.kernel = __k_null,
.rtp_crypt = rtp_update_index,
};
static const struct streamhandler_io __shio_decrypt = {
.kernel = __k_srtp_decrypt,
.rtp_crypt = call_savp2avp_rtp,
@ -256,6 +260,10 @@ static const struct streamhandler __sh_noop = {
.in = &__shio_noop,
.out = &__shio_noop,
};
static const struct streamhandler __sh_noop_index = {
.in = &__shio_noop,
.out = &__shio_noop_index,
};
static const struct streamhandler __sh_savp2avp = {
.in = &__shio_decrypt,
.out = &__shio_noop,
@ -292,8 +300,8 @@ static const struct streamhandler __sh_savpf2savp = {
/* ********** */
static const struct streamhandler * const __sh_matrix_in_rtp_avp[__PROTO_LAST] = {
[PROTO_RTP_AVP] = &__sh_noop,
[PROTO_RTP_AVPF] = &__sh_noop,
[PROTO_RTP_AVP] = &__sh_noop_index,
[PROTO_RTP_AVPF] = &__sh_noop_index,
[PROTO_RTP_SAVP] = &__sh_avp2savp,
[PROTO_RTP_SAVPF] = &__sh_avp2savp,
[PROTO_UDP_TLS_RTP_SAVP] = &__sh_avp2savp,
@ -304,7 +312,7 @@ static const struct streamhandler * const __sh_matrix_in_rtp_avp[__PROTO_LAST] =
};
static const struct streamhandler * const __sh_matrix_in_rtp_avpf[__PROTO_LAST] = {
[PROTO_RTP_AVP] = &__sh_avpf2avp,
[PROTO_RTP_AVPF] = &__sh_noop,
[PROTO_RTP_AVPF] = &__sh_noop_index,
[PROTO_RTP_SAVP] = &__sh_avpf2savp,
[PROTO_RTP_SAVPF] = &__sh_avp2savp,
[PROTO_UDP_TLS_RTP_SAVP] = &__sh_avpf2savp,

@ -142,6 +142,18 @@ int rtp_avp2savp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
return 0;
}
// just updates the ext_seq in ssrc
int rtp_update_index(str *s, struct packet_stream *ps, struct ssrc_ctx *ssrc) {
struct rtp_header *rtp;
if (G_UNLIKELY(!ssrc))
return -1;
if (rtp_payload(&rtp, NULL, s))
return -1;
packet_index(ssrc, rtp);
return 0;
}
/* rfc 3711, section 3.3 */
int rtp_savp2avp(str *s, struct crypto_context *c, struct ssrc_ctx *ssrc_ctx) {
struct rtp_header *rtp;

@ -18,6 +18,8 @@ const rtp_payload_type *get_rtp_payload_type(unsigned int, struct codec_store *)
int rtp_avp2savp(str *, struct crypto_context *, struct ssrc_ctx *);
int rtp_savp2avp(str *, struct crypto_context *, struct ssrc_ctx *);
int rtp_update_index(str *, struct packet_stream *, struct ssrc_ctx *);
void rtp_append_mki(str *s, struct crypto_context *c);
int srtp_payloads(str *to_auth, str *to_decrypt, str *auth_tag, str *mki,
int auth_len, int mki_len,

Loading…
Cancel
Save