From e4d92bf96d0bb64df35790e5b49c58bfa6e9fbcc Mon Sep 17 00:00:00 2001
From: Jakub Adam <jakub.adam@ktknet.cz>
Date: Thu, 20 Apr 2017 06:47:00 +0200
Subject: [PATCH] component: accept TURN in
 nice_component_verify_remote_candidate()

When TURN is in operation, agent_recv_message_unlocked() may receive from
NiceSocket with type = NICE_SOCKET_TYPE_UDP_TURN. Such messages were always
dropped due to failed nice_component_verify_remote_candidate().

Bug: https://phabricator.freedesktop.org/D1727
---
 agent/component.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/agent/component.c b/agent/component.c
index 6eee90e..3e8a7a6 100644
--- a/agent/component.c
+++ b/agent/component.c
@@ -1510,7 +1510,8 @@ nice_component_verify_remote_candidate (NiceComponent *component,
                 (cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE ||
                     cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE ||
                     cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_SO)) ||
-            cand->transport == NICE_CANDIDATE_TRANSPORT_UDP) &&
+            cand->transport == NICE_CANDIDATE_TRANSPORT_UDP ||
+            nicesock->type == NICE_SOCKET_TYPE_UDP_TURN) &&
         nice_address_equal (address, &cand->addr)) {
       /* fast return if it's already the first */
       if (item == component->valid_candidates)
-- 
2.14.3

