Question about local ip address selection

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

 



Hi

I wonder how it comes that pj_gethostip(..) always will return the 
loopback adapter in case everything else fails.

This caused a slight confusion in my trials since we established the 
network connection ourselves (Windows Mobile). The connection returned 
ok but I guess the IP adapter was not yet completly configured when I 
initialized pjsip leading to that I got the loopback adapter configured 
as my ip address.

IMO it feels like if the PJ_IP_HELPER_IGNORE_LOOPBACK_IF is set this part :

/* If else fails, returns loopback interface as the last resort */
    if (status != PJ_SUCCESS) {
        PJ_LOG(1,("XXX","failed to get the first one, returning loopback 
if"));
        if (af==PJ_AF_INET) {
            addr->ipv4.sin_addr.s_addr = pj_htonl (0x7f000001);
        } else {
            pj_in6_addr *s6_addr;
   
            s6_addr = (pj_in6_addr*) pj_sockaddr_get_addr(addr);
            pj_bzero(s6_addr, sizeof(pj_in6_addr));
            s6_addr->s6_addr[15] = 1;
        }
        status = PJ_SUCCESS;
    }

should not be executed and an error should be returned instad of 
returning the loopback adapter.

I do not really understand how the server should be able to contact me 
if my Contact: header contains 127.0.0.1. However I spotted the reply a 
few days ago to another question where Benny said, quote:
"

The selected IP shouldn't matter much IMO. For signaling, the IP will be
(re)learnt from REGISTER response. And for media, that exactly what ICE is
for, among other things.
"

It might very well be that I do not get the full picture here. Is there a way that the server will respond with a local IP for us in the 200 OK for REGISTER? Atleast in the current setup it does not (is ICE required for this).






[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