Bug 1434531 - fix missing TCP relay candidates. r?drno draft
authorMichael Froman <mfroman@mozilla.com>
Fri, 02 Feb 2018 16:03:51 -0600
changeset 750860 b7eb3b2ca9a9ccf8fa1f946431ad27a2cbf95534
parent 750839 fea9e610ec9d550f2aad41d0d83cf02f485460c4
push id97765
push userbmo:mfroman@nostrum.com
push dateFri, 02 Feb 2018 23:27:46 +0000
reviewersdrno
bugs1434531
milestone60.0a1
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
media/mtransport/third_party/nICEr/src/ice/ice_component.c
--- 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)))