summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2019-06-12 21:44:48 +0200
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>2019-07-11 19:03:03 +0000
commit0b70e024faa1fa712a7f8f15b602f10ae7348f19 (patch)
treea6c3eb37bc3aeaddbb7c7ca644e2a6234b423f6f
parente4d65ba719f194cd2306e63485e4198cbffff4de (diff)
downloadlibnice-0b70e024faa1fa712a7f8f15b602f10ae7348f19.tar.gz
conncheck: test inbound stun address on the candidate base address
When receiving an stun packet on a socket, and looking for the matching local candidate, normally it doesn't make a difference to test the address or the base address. Because a pair cannot have a local candidate of type srv-rflx, where there would be a difference, the local candidate obtained will be part of a pair of the conncheck list. Except for the case of a pairs with tcp-act local candidate, where the addr has a port number of zero (tcp-act socket before connect), and the socket of the stun packet has a non-null port number (tcp-act socket after connect), corresponding to the base address of another peer-reflexive tcp-act local candidate, previously discoverd. The selection of the local candidate concerned by an inbound stun request happens when early incoming checks are processed, and when inbound stun packets are normally received during the conncheck. This commit complete commit e6a1941 (for early incoming checks) in the normal inbound stun packets code path, where is similar modification is needed.
-rw-r--r--agent/conncheck.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index ca5c516..e139ead 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -4468,7 +4468,14 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
}
for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data;
- if (nice_address_equal (&nicesock->addr, &cand->addr)) {
+ NiceAddress *addr;
+
+ if (cand->type == NICE_CANDIDATE_TYPE_RELAYED)
+ addr = &cand->addr;
+ else
+ addr = &cand->base_addr;
+
+ if (nice_address_equal (&nicesock->addr, addr)) {
local_candidate = cand;
break;
}