summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-02-05 21:30:14 +0000
committerPhilip Withnall <philip.withnall@collabora.co.uk>2016-02-05 21:40:33 +0000
commite1486f20763b7d52b6394b436fde121f01905111 (patch)
treeca151e93322a4a4423abefb56d80dc81e7e69cb8
parent41ab61def82aa275649afd5f4a3fcb43e75fb360 (diff)
agent: Use provided CandidatePair rather than re-finding a pairwip/phab/T3557-non-unique-pair-foundations
In priv_update_selected_pair(), commit 57393333 changed the code to re-find a CandidatePair matching the given lfoundation and rfoundation. However, the foundation does not uniquely identify candidate pairs, and if we’re aiming to set a specific candidate pair as the selected pair, this could result in the wrong pair being selected. This can happen when handling multiple similar candidate pairs, such as when generating peer reflexive candidates from multiple sources. See https://tools.ietf.org/html/rfc5245#section-2.4. Originally spotted by Fabrice Bellet in https://phabricator.freedesktop.org/T3557. Differential Revision: https://phabricator.freedesktop.org/D742
-rw-r--r--agent/conncheck.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 60d2fbf..fb311b6 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1207,17 +1207,20 @@ static void priv_limit_conn_check_list_size (GSList *conncheck_list, guint upper
*/
static gboolean priv_update_selected_pair (NiceAgent *agent, NiceComponent *component, CandidateCheckPair *pair)
{
- CandidatePair cpair;
+ CandidatePair cpair = { 0, };
g_assert (component);
g_assert (pair);
- if (pair->priority > component->selected_pair.priority &&
- nice_component_find_pair (component, agent, pair->local->foundation,
- pair->remote->foundation, &cpair)) {
+ if (pair->priority > component->selected_pair.priority) {
nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s "
"(prio:%" G_GUINT64_FORMAT ").", agent, component->id,
pair->local->foundation, pair->remote->foundation, pair->priority);
+ cpair.local = pair->local;
+ cpair.remote = pair->remote;
+ cpair.priority = pair->priority;
+ /* cpair.keepalive is not used by nice_component_update_selected_pair() */
+
nice_component_update_selected_pair (component, &cpair);
priv_conn_keepalive_tick_unlocked (agent);