diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2020-04-20 23:24:21 +0200 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2020-05-07 17:46:05 +0000 |
commit | e7b049429fc3e1d5a5ce9197d5d5c128d599e379 (patch) | |
tree | c1b4d58d35880c0b51dec0052940fd1303333b71 | |
parent | ade16ee939e54ab8ebf73043169edc6d32c3239c (diff) | |
download | libnice-e7b049429fc3e1d5a5ce9197d5d5c128d599e379.tar.gz |
conncheck: properly select tcp-active discovered candidate
Some tcp-active discovered peer-reflexive local candidates may only be
recognised by their local socket, if they have the same address and same
port. It may happen when a nat generates an identical mapping from two
different base local candidates.
-rw-r--r-- | agent/conncheck.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c index 01731f9..7ba378b 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -1971,9 +1971,14 @@ local_candidate_and_socket_compatible (NiceAgent *agent, g_assert (socket); g_assert (lcand); - if (nice_socket_has_compatible_transport (socket, &transport)) + if (nice_socket_has_compatible_transport (socket, &transport)) { ret = (lcand->transport == transport); - else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN) + /* tcp-active discovered peer-reflexive local candidate, where + * socket is the tcp connect related socket */ + if (ret && transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE && + nice_address_get_port (&lcand->addr) > 0) + ret = (lcand->sockptr == socket); + } else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN) /* Socket of type udp-turn will match a unique local candidate * by its sockptr value. An an udp-turn socket doesn't carry enough * information when base socket is udp-turn-over-tcp to disambiguate |