From e663d1c95b79ce624a4cbff60b4dae77bbe75de2 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 2 Sep 2022 12:24:23 -0400 Subject: [PATCH] TT#189900 use explicit flag to enable kernel SSRC tracking Zero SSRC are technically invalid, but the code accepts them as valid and therefore sets up things like crypto contexts for zero SSRCs. Consequently it's possible to have a zero SSRC first in the list of SSRCs and other valid SSRCs later in the list, which means we can't use the presence of a non-zero SSRC first in the list as a flag to determine whether SSRC tracking is in use or not. Use an explicit flag instead. Change-Id: I88736e5d6b0f66c58f8d675137231760951e7610 (cherry picked from commit 85ec6e28703167e668c8b0acca27ce594e4b098a) --- daemon/media_socket.c | 1 + kernel-module/xt_RTPENGINE.c | 2 +- kernel-module/xt_RTPENGINE.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index cea149570..60cbea398 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1230,6 +1230,7 @@ static const char *kernelize_one(struct rtpengine_target_info *reti, GQueue *out if (!reti->decrypt.cipher || !reti->decrypt.hmac) return "decryption cipher or HMAC not supported by kernel module"; + reti->track_ssrc = 1; for (unsigned int u = 0; u < G_N_ELEMENTS(stream->ssrc_in); u++) { if (stream->ssrc_in[u]) reti->ssrc[u] = htonl(stream->ssrc_in[u]->parent->h.ssrc); diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index aa99b5ff9..e13013b31 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -4560,7 +4560,7 @@ src_check_ok: // Pass to userspace if SSRC has changed. // Look for matching SSRC index if any SSRC were given - if (likely(g->target.ssrc[0])) { + if (likely(g->target.track_ssrc)) { errstr = "SSRC mismatch"; for (ssrc_idx = 0; ssrc_idx < RTPE_NUM_SSRC_TRACKING; ssrc_idx++) { if (g->target.ssrc[ssrc_idx] == rtp.header->ssrc) diff --git a/kernel-module/xt_RTPENGINE.h b/kernel-module/xt_RTPENGINE.h index 59306e33b..4fe795431 100644 --- a/kernel-module/xt_RTPENGINE.h +++ b/kernel-module/xt_RTPENGINE.h @@ -118,6 +118,7 @@ struct rtpengine_target_info { stun:1, rtp:1, rtp_only:1, + track_ssrc:1, do_intercept:1, transcoding:1, // SSRC subst and RTP PT filtering non_forwarding:1, // empty src/dst addr