TT#14008 ignore "received from" address when ICE is in use

Also add a safeguard against filling the remote peer address with an
address from the wrong family

closes #1305

Change-Id: Iac18212b4d526a2f7d49a06ddcd724aa89b06060
pull/1346/head
Richard Fuchs 4 years ago
parent e792053549
commit 124d89ade0

@ -1025,6 +1025,13 @@ 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) {
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;
if (PS_ISSET(ps, FILLED) && !MEDIA_ISSET(media, DTLS)) {
@ -1033,8 +1040,8 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp,
dtls_shutdown(ps);
}
ilog(LOG_DEBUG, "set FILLED flag for stream %s%s:%d%s",
FMT_M(sockaddr_print_buf(&ps->endpoint.address), ps->endpoint.port));
ilog(LOG_DEBUG, "set FILLED flag for stream, remote %s%s%s",
FMT_M(endpoint_print_buf(&ps->endpoint)));
PS_SET(ps, FILLED);
if (flags && flags->pierce_nat)

@ -1523,6 +1523,12 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl
sp->index = ++num;
codec_store_init(&sp->codecs, NULL);
__sdp_ice(sp, media);
if (SP_ISSET(sp, ICE)) {
// ignore "received from" (SIP-source-address) when ICE is in use
flags->trust_address = 1;
}
errstr = "No address info found for stream";
if (!flags->fragment
&& fill_endpoint(&sp->rtp_endpoint, media, flags, NULL, media->port_num))
@ -1626,7 +1632,6 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl
if (attr_get_by_id(&media->attributes, ATTR_RTCP_FB))
SP_SET(sp, RTCP_FB);
__sdp_ice(sp, media);
__sdp_t38(sp, media);
/* determine RTCP endpoint */

Loading…
Cancel
Save