From 2a1f628581050c9706b6dff270afa0f94b968564 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 22 Feb 2022 10:05:48 -0500 Subject: [PATCH] TT#14008 ignore cross-family endpoint changes for ICE Change-Id: I0e4a54b9255395ffd792665ce558a7f270cbb5d2 (cherry picked from commit e3de05e77d38ca84b1c0e160b35bc36128f4a808) --- daemon/call.c | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index de0d95e61..dc441fce7 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1121,20 +1121,29 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp, && !ice_ufrag_cmp(media->ice_agent, &sp->ice_ufrag)) return; - if (ps->selected_sfd && ep.address.family != ps->selected_sfd->socket.family) { - if (ep.address.family && !is_trickle_ice_address(&ep)) - ilog(LOG_WARN, "Ignoring updated remote endpoint %s%s%s as the local " - "socket is %s", FMT_M(endpoint_print_buf(&ep)), - ps->selected_sfd->socket.family->name); - return; - } + if (!MEDIA_ISSET(media, ICE)) { + if (PS_ISSET(ps, FILLED) && ps->selected_sfd + && ep.address.family != ps->selected_sfd->socket.family) + { + if (ep.address.family && !is_trickle_ice_address(&ep)) + ilog(LOG_WARN, "Ignoring updated remote endpoint %s%s%s as the local " + "socket is %s", FMT_M(endpoint_print_buf(&ep)), + ps->selected_sfd->socket.family->name); + return; + } - ps->endpoint = ep; + ps->endpoint = ep; - if (PS_ISSET(ps, FILLED) && !MEDIA_ISSET(media, DTLS)) { - /* we reset crypto params whenever the endpoint changes */ - call_stream_crypto_reset(ps); - dtls_shutdown(ps); + if (PS_ISSET(ps, FILLED) && !MEDIA_ISSET(media, DTLS)) { + /* we reset crypto params whenever the endpoint changes */ + call_stream_crypto_reset(ps); + dtls_shutdown(ps); + } + } + else { + // ICE + if (!PS_ISSET(ps, FILLED)) + ps->endpoint = ep; } /* endpont-learning setup */ @@ -2662,13 +2671,16 @@ static int __media_init_from_flags(struct call_media *other_media, struct call_m call_str_cpy(call, &media->format_str, &sp->format_str); } - // deduct address family from stream parameters received - other_media->desired_family = sp->rtp_endpoint.address.family; - // for outgoing SDP, use "direction"/DF or default to what was offered - if (media && !media->desired_family) - media->desired_family = other_media->desired_family; - if (media && sp->desired_family) - media->desired_family = sp->desired_family; + /* deduct address family from stream parameters received */ + if (!other_media->desired_family || !MEDIA_ISSET(other_media, ICE)) + other_media->desired_family = sp->rtp_endpoint.address.family; + /* for outgoing SDP, use "direction"/DF or default to what was offered */ + if (media && (!media->desired_family || !MEDIA_ISSET(media, ICE))) { + if (!media->desired_family) + media->desired_family = other_media->desired_family; + if (sp->desired_family) + media->desired_family = sp->desired_family; + } return 0; }