Bug 1434531 - fix missing TCP relay candidates. r?drno
Because the nr_transport_addr_check_compatibility check also includes
protocol, it was failing checks that used to pass. However, the actual
address used was created farther down in code by copying the current
address and setting the protocol to TCP. Moving that address copy up
in the processing flow lets the more stringent check work.
MozReview-Commit-ID: 95SOQzxuxXB
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -527,19 +527,24 @@ static int nr_ice_component_initialize_t
nr_socket *buffered_sock;
nr_socket *turn_sock;
nr_ice_socket *turn_isock;
/* Skip non-TCP */
if (ctx->turn_servers[j].turn_server.transport != IPPROTO_TCP)
continue;
+ /* Create relay candidate */
+ if ((r=nr_transport_addr_copy(&addr, &addrs[i].addr)))
+ ABORT(r);
+ addr.protocol = IPPROTO_TCP;
+
if (ctx->turn_servers[j].turn_server.type == NR_ICE_STUN_SERVER_TYPE_ADDR) {
if (nr_transport_addr_check_compatibility(
- &addrs[i].addr,
+ &addr,
&ctx->turn_servers[j].turn_server.u.addr)) {
r_log(LOG_ICE,LOG_INFO,"ICE(%s): Skipping TURN server because of link local mis-match",ctx->label);
continue;
}
}
if (!ice_tcp_disabled) {
/* Use TURN server to get srflx candidates */
@@ -559,21 +564,16 @@ static int nr_ice_component_initialize_t
&ctx->turn_servers[j].turn_server,component->component_id,&cand))
ABORT(r);
TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
component->candidate_ct++;
cand=0;
}
}
- /* Create relay candidate */
- if ((r=nr_transport_addr_copy(&addr, &addrs[i].addr)))
- ABORT(r);
- addr.protocol = IPPROTO_TCP;
-
/* If we're going to use TLS, make sure that's recorded */
if (ctx->turn_servers[j].turn_server.tls) {
strncpy(addr.tls_host,
ctx->turn_servers[j].turn_server.u.dnsname.host,
sizeof(addr.tls_host) - 1);
}
if ((r=nr_transport_addr_fmt_addr_string(&addr)))