summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-02-14 17:19:50 +0200
committerMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-02-14 17:19:50 +0200
commitcfebf09323a44f2bc892f5eb48905466a2325afc (patch)
treef811bd4ba5547a7b56f25f5beb218c0d8ad9da5b
parent54fbc7e90524cef4459a320ca631ecf294c8b0ec (diff)
Don't do STUN SRV lookup on the IP address-based account URI
Currently, only IPv4 addresses are supported, as is the case elsewhere. Added FIXME comments to add IPv6 support later.
-rw-r--r--src/sip-connection-helpers.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/sip-connection-helpers.c b/src/sip-connection-helpers.c
index 0fda819..d0a1774 100644
--- a/src/sip-connection-helpers.c
+++ b/src/sip-connection-helpers.c
@@ -523,6 +523,7 @@ tpsip_conn_resolv_stun_server (TpsipConnection *conn, const gchar *stun_host)
return;
}
+ /* FIXME: support IPv6 as well */
if (inet_aton (stun_host, &test_addr))
{
tpsip_conn_set_stun_server_address (conn, stun_host);
@@ -646,14 +647,27 @@ void
tpsip_conn_discover_stun_server (TpsipConnection *conn)
{
TpsipConnectionPrivate *priv = TPSIP_CONNECTION_GET_PRIVATE (conn);
+ const gchar *url_host;
char *srv_domain;
+ struct in_addr test_addr;
+
+ g_return_if_fail (priv->account_url != NULL);
- if ((NULL == priv->account_url) || (NULL == priv->account_url->url_host))
+ url_host = priv->account_url->url_host;
+
+ if (url_host == NULL)
{
DEBUG("unknown domain, not making STUN SRV lookup");
return;
}
+ /* FIXME: support IPv6 as well */
+ if (inet_aton (url_host, &test_addr))
+ {
+ DEBUG("AOR URI has IP address, not making STUN SRV lookup");
+ return;
+ }
+
if (NULL == priv->sofia_resolver)
{
priv->sofia_resolver =
@@ -661,9 +675,9 @@ tpsip_conn_discover_stun_server (TpsipConnection *conn)
}
g_return_if_fail (priv->sofia_resolver != NULL);
- DEBUG("creating a new STUN SRV query for domain %s", priv->account_url->url_host);
+ DEBUG("creating a new STUN SRV query for domain %s", url_host);
- srv_domain = g_strdup_printf ("_stun._udp.%s", priv->account_url->url_host);
+ srv_domain = g_strdup_printf ("_stun._udp.%s", url_host);
sres_query (priv->sofia_resolver,
priv_stun_discover_cb,