about pj_sockaddr_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi , I have found some issues about pj_sockaddr_init() using pjsip 0.9.0 !!

 <1> In

PJ_DEF(pj_status_t) pj_sockaddr_init(int af,
         pj_sockaddr *addr,
         const pj_str_t *cp,
         pj_uint16_t port)
{
    pj_status_t status;
    if (af == PJ_AF_INET) {


 addr->addr.sa_family = PJ_AF_INET;
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I think here could add this
line , If comparing with ipv6 version

 return pj_sockaddr_in_init(&addr->ipv4, cp, port);
    }
    /* IPv6 specific */
    PJ_ASSERT_RETURN(af==PJ_AF_INET6, PJ_EAFNOTSUP);
    pj_bzero(addr, sizeof(pj_sockaddr_in6));
    addr->addr.sa_family = PJ_AF_INET6;

    status = pj_sockaddr_set_str_addr(af, addr, cp);
    if (status != PJ_SUCCESS)
 return status;
    addr->ipv6.sin6_port = pj_htons(port);
    return PJ_SUCCESS;
}


<2> in sock_common.c --> static pj_status_t create_sip_udp_sock()

(pj_sockaddr_has_addr(&bind_addr)) {


     pj_sockaddr_init(af, p_pub_addr , NULL, (pj_uint16_t)0);
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I
think here should add this line
                                                  because in next line
"pj_sockaddr_copy_addr()" will check if "sa_family" type is correct !!

     pj_sockaddr_copy_addr(p_pub_addr, &bind_addr);
 } else {
     status = pj_gethostip(af, p_pub_addr);
     if (status != PJ_SUCCESS) {
  pjsua_perror(THIS_FILE, "Unable to get local host IP", status);
  pj_sock_close(sock);
  return status;
     }
 }



These suggestions is just derived from my porting work !! Thanks !!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080930/0ab70528/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux