From db3ace01bfbf909a1ac084f4541ae0621e853d2a Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 25 Sep 2024 13:09:20 -0400 Subject: [PATCH] MT#55283 catch changes in a=mid If media type doesn't match, assume a change in a=mid and ignore it. Change-Id: Id0c8d7b9163445266e4179f4388109954226c4fa (cherry picked from commit 2aa11c2a2a694a009654c5d1e5cb04bcd85abaee) (cherry picked from commit 6480bd62842161ff10fa838d61227abe502e8e1b) --- daemon/call.c | 9 +- t/auto-daemon-tests.pl | 815 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 822 insertions(+), 2 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index c031be0f8..ea7c1e8e4 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -667,8 +667,13 @@ static struct call_media *__get_media(struct call_monologue *ml, const struct st // in this case, the media sections can be out of order and the media ID // string is used to determine which media section to operate on. med = g_hash_table_lookup(ml->media_ids, &sp->media_id); - if (med) - return med; + if (med) { + if (med->type_id == sp->type_id) + return med; + ilogs(ice, LOG_WARN, "Ignoring media ID '" STR_FORMAT "' as media type doesn't match. " + "Was media ID changed?", STR_FMT(&sp->media_id)); + med = NULL; + } if (flags->trickle_ice) ilogs(ice, LOG_ERR, "Received trickle ICE SDP fragment with unknown media ID '" STR_FORMAT "'", diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 26162b0ca..fdb84815e 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -82,6 +82,821 @@ sub stun_succ { +new_call; + +offer('a=mid mixup', { 'address family' => 'IP6' }, <