conncheck: inbound stun on tcp passive pairs should trigger a check
authorFabrice Bellet <fabrice@bellet.info>
Sun, 3 May 2020 15:22:42 +0000 (17:22 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Thu, 7 May 2020 17:46:05 +0000 (17:46 +0000)
An inbound stun request on a newly discovered pair should trigger a
conncheck in the reverse direction, and not promote the pair directly in
state succeeded. This is particulary required if the agent is in
aggressive controlling mode.

agent/conncheck.c

index 67d4f5b..fc4a2b8 100644 (file)
@@ -2086,12 +2086,9 @@ conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream,
           break;
         }
       }
-      if (pair == NULL) {
-        pair = priv_conn_check_add_for_candidate_pair_matched (agent,
-            stream->id, component, lcand, rcand, NICE_CHECK_SUCCEEDED);
-        if (pair)
-          pair->valid = TRUE;
-      }
+      if (pair == NULL)
+        priv_conn_check_add_for_candidate_pair_matched (agent,
+            stream->id, component, lcand, rcand, NICE_CHECK_WAITING);
     }
 
     priv_schedule_triggered_check (agent, stream, component,
@@ -4837,16 +4834,11 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
             remote_candidate2 ? remote_candidate2 : remote_candidate);
         if(remote_candidate && stream->remote_ufrag[0]) {
           if (local_candidate &&
-              local_candidate->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE) {
-            CandidateCheckPair *pair;
-
-            pair = priv_conn_check_add_for_candidate_pair_matched (agent,
+              local_candidate->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE)
+            priv_conn_check_add_for_candidate_pair_matched (agent,
                 stream->id, component, local_candidate, remote_candidate,
-                NICE_CHECK_SUCCEEDED);
-            if (pair) {
-              pair->valid = TRUE;
-            }
-          } else
+                NICE_CHECK_WAITING);
+          else
             conn_check_add_for_candidate (agent, stream->id, component, remote_candidate);
         }
       }