diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-01-20 05:11:08 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-01-20 05:11:08 +0000 |
commit | 0eb48a0f8bec49ce1b6360ad1c8accd7972db4ca (patch) | |
tree | 3515c2f4e6a7771689be340f499a058f6677fc55 | |
parent | 8c97c54eb974fcea900db84feac108d37a282933 (diff) |
Fix ticket #71: When host doesn't have any NIC interfaces, pj_gethostip() should return 127.0.0.1 instead of error
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@885 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjlib/src/pj/addr_resolv_sock.c | 6 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/pjlib/src/pj/addr_resolv_sock.c b/pjlib/src/pj/addr_resolv_sock.c index af3d40c3..e433dc32 100644 --- a/pjlib/src/pj/addr_resolv_sock.c +++ b/pjlib/src/pj/addr_resolv_sock.c @@ -87,14 +87,16 @@ pj_status_t pj_gethostip(pj_in_addr *addr) status = pj_sock_connect(fd, &a, sizeof(a)); if (status != PJ_SUCCESS) { pj_sock_close(fd); - return status; + /* Return 127.0.0.1 as the address */ + return PJ_SUCCESS; } len = sizeof(a); status = pj_sock_getsockname(fd, &a, &len); if (status != PJ_SUCCESS) { pj_sock_close(fd); - return status; + /* Return 127.0.0.1 as the address */ + return PJ_SUCCESS; } pj_sock_close(fd); diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index b7194111..79b39283 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -880,6 +880,7 @@ static pj_status_t create_sip_udp_sock(pj_in_addr bound_addr, status = pj_gethostip(&p_pub_addr->sin_addr); if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Unable to get local host IP", status); pj_sock_close(sock); return status; } |