diff options
author | Liong Sauw Ming <ming@teluu.com> | 2016-02-29 08:24:58 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2016-02-29 08:24:58 +0000 |
commit | 12b8a79058b3930091723e4a97c2dcdc8a27b56f (patch) | |
tree | 4b9504e0391fee682368ab862a96de0170a17124 /pjsip | |
parent | eb0b1607c6e12e7ad45293891f6014527b33af5b (diff) |
Re #1882 (misc): Various IPv6 fixes:
- For contact rewrite feature, when contact address is IPv6, it shouldn't be replaced with IPv4 address
- If tp_type is already of type IPv6, adding it with PJSIP_TRANSPORT_IPV6 will result in an invalid transport type
- Add check if pj_getaddrinfo() returns zero address.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5249 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 61501431..2eee77d4 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1645,8 +1645,12 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc, status = pj_sockaddr_parse(pj_AF_UNSPEC(), 0, via_addr, &recv_addr); if (status == PJ_SUCCESS) { - /* Compare the addresses as sockaddr according to the ticket above */ - matched = (uri->port == rport && + /* Compare the addresses as sockaddr according to the ticket above, + * but only if they have the same family (ipv4 vs ipv4, or + * ipv6 vs ipv6) + */ + matched = (contact_addr.addr.sa_family != recv_addr.addr.sa_family) || + (uri->port == rport && pj_sockaddr_cmp(&contact_addr, &recv_addr)==0); } else { /* Compare the addresses as string, as before */ @@ -3099,7 +3103,8 @@ pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id, * to use IPv6 as well. */ if (pj_strchr(&sip_uri->host, ':')) - tp_type = (pjsip_transport_type_e)(((int)tp_type) + PJSIP_TRANSPORT_IPV6); + tp_type = (pjsip_transport_type_e)(((int)tp_type) | + PJSIP_TRANSPORT_IPV6); flag = pjsip_transport_get_flag_from_type(tp_type); @@ -3164,6 +3169,7 @@ pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id, af = (dinfo.type & PJSIP_TRANSPORT_IPV6)? PJ_AF_INET6 : PJ_AF_INET; status = pj_getaddrinfo(af, &dinfo.addr.host, &cnt, &ai); + if (cnt == 0) status = PJ_ENOTSUP; } if (status == PJ_SUCCESS) { |