From ef6293b4df0eec94677935663f48b67756fc4fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 31 Jul 2019 15:04:21 -0400 Subject: 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. --- agent/conncheck.c | 8 ++++++++ tests/test-drop-invalid.c | 2 +- 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); -- cgit v1.2.1