On Mon, Jul 7, 2008 at 9:52 PM, Filippo Zangheri <filippo.zangheri at yahoo.it> wrote: > >> Sorry I don't get you. Isn't it that even with this check is in place, > you > >> would still get "127.0.0.1" address returned by if_enum_by_af()? > > > > No, I don't get loopback address returned by if_enum_by_af() when that > check > > is in place and when ppp connection is active. I mean, with the check in > place: > > > > ... > > > > But if I remove that check, I get: > > > > 1. ppp on > > > > 17:31:32.313 stateful_proxy 82.59.213.185:5060 > > 17:31:32.313 stateful_proxy 127.0.0.1:5060 <--- This was missing with > check in place > > 17:31:32.313 stateful_proxy 192.168.2.20:5060 > > 17:31:32.313 stateful_proxy asus-laptop:5060 > > 17:31:32.313 stateful_proxy localhost:5060 > > > > 2. ppp off > > > > 15:39:34.583 stateful_proxy Local host aliases: > > 15:39:34.583 stateful_proxy 127.0.0.1:5060 > > 15:39:34.583 stateful_proxy asus-laptop:5060 > > 15:39:34.583 stateful_proxy localhost:5060 > > > > > > So, that's ok. Isn't it? > It's strangely funny that ppp somewhat interferes with the loopback address. > I mean, is it ok to remove the loopback-address check from > ip_helper_generic.c:if_enum_by_af()? > One of the negative impact of this is it will add loopback address to ICE candidates, which is useless. But I've made some changes in r2112. There is now PJ_IP_HELPER_IGNORE_LOOPBACK_IF setting in pj/config.h, and default value is one which means by default pjlib will ignore loopback interfaces. I also made changes in proxy.h, to include the loopback address if PJ_IP_HELPER_IGNORE_LOOPBACK_IF is set (in other words, loopback address should always be added to proxy's aliases). > I hope to shed some light on getifaddrs() issue. > > Sometimes the address list filled up by getifaddrs() may contain some > weird entries: > > 1. some entries may have struct sockaddr *ifa_addr = NULL; > the solution here is to perform a NULL check: > > if (it->ifa_addr == NULL) continue; > > > 2. some other may appear more than once in that list; > looking with more attention to all the list entries I got > the following[1]: > > $ ./test > name: lo, addr: 1.0.0.0, address_family: 17 <--- ?? > name: eth0, addr: 2.0.0.0, address_family: 17 > name: wmaster0, addr: 3.0.0.0, address_family: 17 > name: wlan0, addr: 4.0.0.0, address_family: 17 > interface ppp0 has ifa_addr member NULL! > name: lo, addr: 127.0.0.1, address_family: 2 <---- > AF_INET > name: wlan0, addr: 192.168.2.20, address_family: 2 > name: ppp0, addr: 82.59.213.185, address_family: 2 > > > This result suggests that inside the list, every time the > list is filled up, under any circumstances, there will be > only one entry with a valid address family, and that should > be the only list entry taken in consideration. > > This is already implemented. I only suggest that you > developers (Benny?) comment out that (I'm trying to prove :) ) > useless loopback check. > Yes the enum_ip_interface() will only return the interfaces that have the requested address family, so that's not a problem. The loopback check was there because most usages (apart from proxy.h, apparently) don't need it. Cheers, Benny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080707/6fc2c3d1/attachment-0001.html