From aa4b06956c59cdb0f3186e1c10bd614faac5589d Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Wed, 22 Jul 2015 10:54:11 -0700 Subject: [PATCH] Bug 1186339 - skip STUN/TURN servers with non-matching IP versions for TCP sockets. r=bwc --- .../mtransport/third_party/nICEr/src/ice/ice_candidate.c | 2 +- .../third_party/nICEr/src/net/nr_socket_multi_tcp.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c index 4f69a27d9e0..381414bd9db 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c @@ -555,7 +555,7 @@ int nr_ice_candidate_initialize(nr_ice_candidate *cand, NR_async_cb ready_cb, vo 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 (%d) than STUN/TURN server (%d).", cand->label,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); ABORT(R_NOT_FOUND); /* Same error code when DNS lookup fails */ } diff --git a/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c b/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c index 3eb3d74b0c6..b0300de5117 100644 --- a/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c +++ b/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c @@ -170,8 +170,15 @@ static int nr_socket_multi_tcp_create_stun_server_socket( nr_tcp_socket_ctx *tcp_socket_ctx=0; nr_socket * nrsock; - if (stun_server->transport!=IPPROTO_TCP) + if (stun_server->transport!=IPPROTO_TCP) { + r_log(LOG_ICE,LOG_INFO,"%s:%d function %s skipping UDP STUN server(addr:%s)",__FILE__,__LINE__,__FUNCTION__,stun_server->u.addr.as_string); ABORT(R_BAD_ARGS); + } + + if (stun_server->u.addr.ip_version!=addr->ip_version) { + r_log(LOG_ICE,LOG_INFO,"%s:%d function %s skipping STUN with different IP version (%u) than local socket (%u),",__FILE__,__LINE__,__FUNCTION__,stun_server->u.addr.ip_version,addr->ip_version); + ABORT(R_BAD_ARGS); + } if ((r=nr_socket_factory_create_socket(sock->ctx->socket_factory,addr, &nrsock))) ABORT(r);