summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2009-05-29 19:10:55 -0400
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2009-05-29 19:10:55 -0400
commit07e8358986bc13e933c293e75b47f171a2a59e48 (patch)
treec9a440337b6b4fbf34a0db2e76e69919a1c5bded
parent2dff1e17563fe584f408e0b0dd099a6213493104 (diff)
downloadlibnice-07e8358986bc13e933c293e75b47f171a2a59e48.tar.gz
Attempt to work around binding responses with no mapped address to have interop with gtalk2voip.com ICE implementation. Thanks to wahjava for reporting the issue
-rw-r--r--agent/conncheck.c19
-rw-r--r--stun/usages/ice.c2
-rw-r--r--stun/usages/ice.h4
3 files changed, 20 insertions, 5 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index e4f34a0..5ccc711 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1912,8 +1912,8 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
nice_debug ("Agent %p : stun_bind_process/conncheck for %p res %d "
"(controlling=%d).", agent, p, (int)res, agent->controlling_mode);
-
- if (res == STUN_USAGE_ICE_RETURN_SUCCESS) {
+ if (res == STUN_USAGE_ICE_RETURN_SUCCESS ||
+ res == STUN_USAGE_ICE_RETURN_NO_MAPPED_ADDRESS) {
/* case: found a matching connectivity check request */
CandidateCheckPair *ok_pair = NULL;
@@ -1949,8 +1949,19 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
* not match any local candidate, see 7.1.2.2.1
* "Discovering Peer Reflexive Candidates" ICE ID-19) */
- ok_pair = priv_process_response_check_for_peer_reflexive(agent, stream, component,
- p, sockptr, &sockaddr, local_candidate, remote_candidate);
+ if (res == STUN_USAGE_ICE_RETURN_NO_MAPPED_ADDRESS) {
+ /* note: this is same as "adding to VALID LIST" in the spec
+ text */
+ p->state = NICE_CHECK_SUCCEEDED;
+ nice_debug ("Agent %p : Mapped address not found."
+ " conncheck %p SUCCEEDED.", agent, p);
+ priv_conn_check_unfreeze_related (agent, stream, p);
+ } else {
+ ok_pair = priv_process_response_check_for_peer_reflexive(agent,
+ stream, component, p, sockptr, &sockaddr,
+ local_candidate, remote_candidate);
+ }
+
if (!ok_pair)
ok_pair = p;
diff --git a/stun/usages/ice.c b/stun/usages/ice.c
index 594ee2b..17202f6 100644
--- a/stun/usages/ice.c
+++ b/stun/usages/ice.c
@@ -156,7 +156,7 @@ StunUsageIceReturn stun_usage_ice_conncheck_process (StunMessage *msg,
if (val != STUN_MESSAGE_RETURN_SUCCESS)
{
stun_debug (" No MAPPED-ADDRESS: %d\n", val);
- return STUN_USAGE_ICE_RETURN_ERROR;
+ return STUN_USAGE_ICE_RETURN_NO_MAPPED_ADDRESS;
}
}
diff --git a/stun/usages/ice.h b/stun/usages/ice.h
index 853e1ea..fad5950 100644
--- a/stun/usages/ice.h
+++ b/stun/usages/ice.h
@@ -1,3 +1,4 @@
+
/*
* This file is part of the Nice GLib ICE library.
*
@@ -83,6 +84,8 @@ typedef enum {
* the STUN reply
* @STUN_USAGE_ICE_RETURN_INVALID_ADDRESS: The mapped address argument has
* an invalid address family
+ * @STUN_USAGE_ICE_RETURN_NO_MAPPED_ADDRESS: The response is valid but no
+ * MAPPED-ADDRESS or XOR-MAPPED-ADDRESS attribute was found
*
* Return value of stun_usage_ice_conncheck_process() and
* stun_usage_ice_conncheck_create_reply() which allows you to see what
@@ -97,6 +100,7 @@ typedef enum {
STUN_USAGE_ICE_RETURN_INVALID_METHOD,
STUN_USAGE_ICE_RETURN_MEMORY_ERROR,
STUN_USAGE_ICE_RETURN_INVALID_ADDRESS,
+ STUN_USAGE_ICE_RETURN_NO_MAPPED_ADDRESS,
} StunUsageIceReturn;