Use also the related address in redundancy detection for candidates from

the any-address/wildcard ports.

A TURN server can allocate different IPs for different allocation
requests from the same network interface, and a relayed candidate from a
wildcard port is not considered duplicate with another relayed candidate
using the same network interface in the current redundancy detection, if
their mapped addresses (as the "related address" for relayed candidates)
are different. Extra candidates would then be surfaced to the
application unnecessarily.

Bug: webrtc:9469
Change-Id: I504fde3b70cd727ef6ad4517072dcf37328a8380
Reviewed-on: https://webrtc-review.googlesource.com/86181
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24108}
This commit is contained in:
Qingsi Wang 2018-06-28 19:15:33 -07:00 committed by Commit Bot
parent 45c71eb3d4
commit 625efe6dfe

View File

@ -1191,6 +1191,11 @@ void BasicPortAllocatorSession::
// socket to this address, so ignore it.
if (c.address().port() != DISCARD_PORT) {
ips_from_non_any_address_ports.insert(c.address().ipaddr());
if (port_data.port()->Type() == RELAY_PORT_TYPE) {
// The related address of a relay candidate is the server reflexive
// address obtained from the TURN allocation response.
ips_from_non_any_address_ports.insert(c.related_address().ipaddr());
}
}
}
}
@ -1204,7 +1209,8 @@ void BasicPortAllocatorSession::
bool port_signalable = false;
for (const Candidate& c : port_data->port()->Candidates()) {
if (!CandidatePairable(c, port_data->port()) ||
ips_from_non_any_address_ports.count(c.address().ipaddr())) {
ips_from_non_any_address_ports.count(c.address().ipaddr()) ||
ips_from_non_any_address_ports.count(c.related_address().ipaddr())) {
continue;
}
// Even when a port is bound to the "any" address, it should normally