diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2019-07-31 15:04:21 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2019-07-31 15:05:32 -0400 |
commit | ef6293b4df0eec94677935663f48b67756fc4fdd (patch) | |
tree | e08e10fca736bc04803b0410e46c67b88abbc620 | |
parent | a5b9d30d11d637977cd28aa5a8872b6431b83eca (diff) | |
download | libnice-ef6293b4df0eec94677935663f48b67756fc4fdd.tar.gz |
conncheck: Drop valid STUN for which we can't find a request
It's most likely caused by a retransmission received after the initial
request already had a reply.
-rw-r--r-- | agent/conncheck.c | 8 | ||||
-rw-r--r-- | tests/test-drop-invalid.c | 2 | ||||
-rw-r--r-- | tests/test-thread.c | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c index 0e3d1c0..36774aa 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -4584,6 +4584,14 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, return TRUE; } + /* This is most likely caused by a second response to a request which + * already has received a valid reply. + */ + if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE) { + nice_debug ("Agent %p : Valid STUN response for which we don't have a request, ignoring", agent); + return TRUE; + } + if (valid != STUN_VALIDATION_SUCCESS) { nice_debug ("Agent %p : STUN message is unsuccessful %d, ignoring", agent, valid); return FALSE; diff --git a/tests/test-drop-invalid.c b/tests/test-drop-invalid.c index 404d353..585ce28 100644 --- a/tests/test-drop-invalid.c +++ b/tests/test-drop-invalid.c @@ -96,7 +96,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, * Assert on any unreleated packet received. This would include anything * send before the negotiation is over. */ - g_assert (len == 16); + g_assert_cmpuint (len, ==, 16); g_assert (strncmp ("1234567812345678", buf, 16) == 0); if (component_id == 2) diff --git a/tests/test-thread.c b/tests/test-thread.c index 7493f97..32a0fce 100644 --- a/tests/test-thread.c +++ b/tests/test-thread.c @@ -160,7 +160,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, if (count_val == 10) return; - g_assert (len == 10); + g_assert_cmpuint (len, ==, 10); memset (data, count_val + '1', 10); |