Commit 0b70e024 authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête
Browse files

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 e6a19418 (for early incoming checks)
in the normal inbound stun packets code path, where is similar
modification is needed.
parent e4d65ba7
...@@ -4468,7 +4468,14 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, ...@@ -4468,7 +4468,14 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
} }
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data; 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; local_candidate = cand;
break; break;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment