diff options
-rw-r--r-- | pjlib/include/pj/compat/os_auto.h.in | 2 | ||||
-rw-r--r-- | pjlib/src/pj/sock_common.c | 7 |
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)) { |