[asterisk-scf-commits] asterisk-scf/release/pjproject.git branch "veesix" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Nov 23 17:01:25 CST 2010


branch "veesix" has been updated
       via  9a70990f8e88e8f5b2b350b085760420801d944b (commit)
      from  affef644ef803c2c8e45f8b7ac259cf2f27595ce (commit)

Summary of changes:
 pjlib/src/pj/addr_resolv_sock.c     |   14 ++++++++++++--
 pjsip/src/pjsip/sip_transport_tcp.c |    4 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 9a70990f8e88e8f5b2b350b085760420801d944b
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Nov 23 17:02:30 2010 -0600

    Add fixed test and bug fixes found while running tests.
    
    The TCP transport test is failing. I cannot figure out why.
    When attempting to connect(), it sets errno to EINVAL, which
    apparently means that I'm giving an improper address length or
    an address with an unconfigured family. I've confirmed through
    debugging that this is not the case. As a semi-last ditch effort,
    I'm pushing the meat of my local changes (i.e. not the logging
    changes) at this point so that I can try to pull on a separate
    system and see if that changes the results any.
    
    As a side note, I'm not a fan of the change made in addr_resolv_sock.c.
    I think such work should be moved to an outer function in pjsip instead
    of being in a library call in pjlib. For now though, I just want the
    test to not fail.

diff --git a/pjlib/src/pj/addr_resolv_sock.c b/pjlib/src/pj/addr_resolv_sock.c
index af18d79..aff1c15 100644
--- a/pjlib/src/pj/addr_resolv_sock.c
+++ b/pjlib/src/pj/addr_resolv_sock.c
@@ -102,8 +102,18 @@ PJ_DEF(pj_status_t) pj_getaddrinfo(int af, const pj_str_t *nodename,
     /* Copy node name to null terminated string. */
     if (nodename->slen >= PJ_MAX_HOSTNAME)
 	return PJ_ENAMETOOLONG;
-    pj_memcpy(nodecopy, nodename->ptr, nodename->slen);
-    nodecopy[nodename->slen] = '\0';
+    /* If an IPv6 address with square brackets is passed in, we
+     * don't want that
+     */
+    if (nodename->ptr[0] == '[' && nodename->ptr[nodename->slen - 1] == ']')
+    {
+        pj_memcpy(nodecopy, nodename->ptr + 1, nodename->slen - 2);
+        nodecopy[nodename->slen - 2] = '\0';
+    } else
+    {
+        pj_memcpy(nodecopy, nodename->ptr, nodename->slen);
+        nodecopy[nodename->slen] = '\0';
+    }
 
     /* Call getaddrinfo() */
     pj_bzero(&hint, sizeof(hint));
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 69c8a0a..1181f7f 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -588,7 +588,7 @@ static pj_status_t tcp_create( struct tcp_listener *listener,
 
     tcp->base.info = (char*) pj_pool_alloc(pool, 64);
     pj_ansi_snprintf(tcp->base.info, 64, "TCP to %s:%d",
-                     pj_inet_ntop2(remote->addr.sa_family, remote, remote_addr_str, sizeof(remote_addr_str)),
+                     pj_inet_ntop2(remote->addr.sa_family, pj_sockaddr_get_addr(remote), remote_addr_str, sizeof(remote_addr_str)),
                      (int)pj_sockaddr_get_port(remote));
 
     tcp->base.addr_len = pj_sockaddr_get_len(local);
@@ -820,7 +820,7 @@ static pj_status_t tcp_start_read(struct tcp_transport *tcp)
     tcp->rdata.pkt_info.src_addr_len = pj_sockaddr_get_len(&tcp->base.key.rem_addr);
     rem_addr = &tcp->base.key.rem_addr;
     pj_ansi_strcpy(tcp->rdata.pkt_info.src_name,
-           pj_inet_ntop2(rem_addr->addr.sa_family, rem_addr, rem_addr_str, sizeof(rem_addr_str)));
+           pj_inet_ntop2(rem_addr->addr.sa_family, pj_sockaddr_get_addr(rem_addr), rem_addr_str, sizeof(rem_addr_str)));
     tcp->rdata.pkt_info.src_port = pj_sockaddr_get_port(rem_addr);
 
     size = sizeof(tcp->rdata.pkt_info.packet);

-----------------------------------------------------------------------


-- 
asterisk-scf/release/pjproject.git



More information about the asterisk-scf-commits mailing list