From 82b91bb2d1cca62bce149974a7ed83d8bc91d35f 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 5b85c36fb..06b41ee82 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 10ef435e7..942d27e8f 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -4562,7 +4562,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 ac65b7670..2a063505b 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, pt_filter:1, non_forwarding:1, // empty src/dst addr