summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2011-08-11 08:45:38 +0000
committerLiong Sauw Ming <ming@teluu.com>2011-08-11 08:45:38 +0000
commit462f6a6774e1bf33282ec5d7358b9fe1aa2aa298 (patch)
tree460f88a3b29f220548ef93ea5cbc9d6acb02a66f
parentafe1bd5bc2b105e83b5ce787d290a74f93371253 (diff)
Fixed #1342: disable local host resolution on iPhone OS
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3692 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/include/pj/compat/os_auto.h.in2
-rw-r--r--pjlib/src/pj/sock_common.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/pjlib/include/pj/compat/os_auto.h.in b/pjlib/include/pj/compat/os_auto.h.in
index 1dc88028..77980d36 100644
--- a/pjlib/include/pj/compat/os_auto.h.in
+++ b/pjlib/include/pj/compat/os_auto.h.in
@@ -177,6 +177,8 @@
# include "Availability.h"
/* Use CFHost API for pj_getaddrinfo() (see ticket #1246) */
# define PJ_GETADDRINFO_USE_CFHOST 1
+ /* Disable local host resolution in pj_gethostip() (see ticket #1342) */
+# define PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION 1
# ifdef __IPHONE_4_0
/* Is multitasking support available? (see ticket #1107) */
# define PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT 1
diff --git a/pjlib/src/pj/sock_common.c b/pjlib/src/pj/sock_common.c
index 170fe5c7..c0d450c3 100644
--- a/pjlib/src/pj/sock_common.c
+++ b/pjlib/src/pj/sock_common.c
@@ -784,6 +784,8 @@ PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
addr->addr.sa_family = (pj_uint16_t)af;
PJ_SOCKADDR_RESET_LEN(addr);
+#if defined(PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION) && \
+ PJ_GETHOSTIP_DISABLE_LOCAL_RESOLUTION == 1
/* Get hostname's IP address */
count = 1;
status = pj_getaddrinfo(af, pj_gethostname(), &count, &ai);
@@ -797,7 +799,10 @@ PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
TRACE_((THIS_FILE, "hostname IP is %s",
pj_sockaddr_print(&ai.ai_addr, strip, sizeof(strip), 0)));
}
-
+#else
+ PJ_UNUSED_ARG(ai);
+ PJ_UNUSED_ARG(count);
+#endif
/* Get default interface (interface for default route) */
if (cand_cnt < PJ_ARRAY_SIZE(cand_addr)) {