summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2020-05-05 17:09:47 +0200
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2020-05-07 17:46:05 +0000
commit8efaf78c99dbb342d1f5bc52837a4cf906a3efbb (patch)
tree4f726a3b9af197ec08e45c03c5729411bfcc36ff
parent6f0710c43b162114a7a746b9f68b476a02c343a6 (diff)
downloadlibnice-8efaf78c99dbb342d1f5bc52837a4cf906a3efbb.tar.gz
conncheck: another rare case of local tcp active candidate matching
An inbound stun request may come on a tcp pair, whose tcp-active socket has just been created and connected (the local candidate port is zero), but has not caused the creation of a discovered peer-reflexive local candidate (with a non-zero port). This inbound request is stored in an early icheck structure to be replayed later. When being processed after remote creds have been received, we have to find which local candidate it belongs to, by matching with the address only, without the port.
-rw-r--r--agent/conncheck.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 21a739a..234a879 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -2064,6 +2064,24 @@ conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream,
}
}
+ if (lcand == NULL) {
+ for (j = component->local_candidates; j; j = j->next) {
+ NiceCandidate *cand = j->data;
+ NiceAddress *addr = &cand->base_addr;
+
+ /* tcp-active (not peer-reflexive discovered) local candidate, where
+ * socket is the tcp connect related socket */
+ if (nice_address_equal_no_port (&icheck->local_socket->addr, addr) &&
+ nice_address_get_port (&cand->addr) == 0 &&
+ cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE &&
+ local_candidate_and_socket_compatible (agent, cand,
+ icheck->local_socket)) {
+ lcand = cand;
+ break;
+ }
+ }
+ }
+
g_assert (lcand != NULL);
for (j = component->remote_candidates; j; j = j->next) {