Bug 1189198 - don't start STUN transactions with a protocol mis-match. r=mtseng

This commit is contained in:
Nils Ohlmeier [:drno] 2015-07-31 11:23:26 -07:00
parent ecb3e74e2c
commit 230e7cef07
2 changed files with 4 additions and 2 deletions

View File

@ -554,8 +554,8 @@ int nr_ice_candidate_initialize(nr_ice_candidate *cand, NR_async_cb ready_cb, vo
cand->state=NR_ICE_CAND_STATE_INITIALIZING;
if(cand->stun_server->type == NR_ICE_STUN_SERVER_TYPE_ADDR) {
if(cand->base.ip_version != cand->stun_server->u.addr.ip_version) {
r_log(LOG_ICE, LOG_INFO, "ICE-CANDIDATE(%s): Skipping srflx/relayed candidate with different IP version (%u) than STUN/TURN server (%u).", cand->label,cand->base.ip_version,cand->stun_server->u.addr.ip_version);
if(nr_transport_addr_cmp(&cand->base,&cand->stun_server->u.addr,NR_TRANSPORT_ADDR_CMP_MODE_PROTOCOL)) {
r_log(LOG_ICE, LOG_INFO, "ICE-CANDIDATE(%s): Skipping srflx/relayed candidate because of IP version/transport mis-match with STUN/TURN server (%u/%s - %u/%s).", cand->label,cand->base.ip_version,cand->base.protocol==IPPROTO_UDP?"UDP":"TCP",cand->stun_server->u.addr.ip_version,cand->stun_server->u.addr.protocol==IPPROTO_UDP?"UDP":"TCP");
ABORT(R_NOT_FOUND); /* Same error code when DNS lookup fails */
}

View File

@ -380,6 +380,8 @@ static int nr_stun_client_send_request(nr_stun_client_ctx *ctx)
snprintf(string, sizeof(string)-1, "STUN-CLIENT(%s): Sending to %s ", ctx->label, ctx->peer_addr.as_string);
r_dump(NR_LOG_STUN, LOG_DEBUG, string, (char*)ctx->request->buffer, ctx->request->length);
assert(ctx->my_addr.protocol==ctx->peer_addr.protocol);
if(r=nr_socket_sendto(ctx->sock, ctx->request->buffer, ctx->request->length, 0, &ctx->peer_addr))
ABORT(r);