Changeset 1999


Ignore:
Timestamp:
Jun 9, 2008 10:07:11 AM (11 years ago)
Author:
bennylp
Message:

Related to r1996, do not return 0.0.0.0/8 class IP address in pj_gethostip() (thanks Helmut Wolf)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/sock_common.c

    r1952 r1999  
    469469 
    470470 
    471     /* If we end up with 127.x.x.x, resolve the IP by getting the default 
    472      * interface to connect to some public host. 
     471    /* If we end up with 127.0.0.0/8 or 0.0.0.0/8, resolve the IP 
     472     * by getting the default interface to connect to some public host. 
     473     * The 0.0.0.0/8 is a special IP class that doesn't seem to be 
     474     * practically useful for our purpose. 
    473475     */ 
    474476    if (status != PJ_SUCCESS || !pj_sockaddr_has_addr(addr) || 
    475                 (af==PJ_AF_INET && (pj_ntohl(addr->ipv4.sin_addr.s_addr) >> 24)==127)) 
     477        (af==PJ_AF_INET && (pj_ntohl(addr->ipv4.sin_addr.s_addr)>>24)==127) || 
     478        (af==PJ_AF_INET && (pj_ntohl(addr->ipv4.sin_addr.s_addr)>>24)==0)) 
    476479    { 
    477480                status = pj_getdefaultipinterface(af, addr); 
Note: See TracChangeset for help on using the changeset viewer.