On Wed, Jul 9, 2008 at 9:48 AM, Ondrej Sterbak <sterbo at email.cz> wrote: > Guys, > > I am working with this proxy for a month or so and I think there's a > better solution to this. There are 2 reasons for this. The first and > the most important is that loopback is not only 127.0.0.1 but whole > network 127/8 (e.g. Debian and Ubuntu systems put FQDN to 127.0.1.1). > The second is that you say this: > > The loopback check was > > there because most usages (apart from proxy.h, apparently) don't need it. > > So my solution is to put a check in proxy.h:is_uri_local if the > address is from 127/8 which solves all the problems with all > loopback's IPs. Unfortunately I was doing more changes there so I I don't think I will integrate your changes. That should be put in your application instead. The proxy sample applications are just, well, samples. It's nothing like a real proxy application (it doesn't even handle authentication!) . Thanks for the tip though. Cheers Benny > don't have exact code for you, but it would be something like this > change in: > if ((uri->port == global.name[i].port || > (uri->port==0 && global.name[i].port==5060)) && > pj_stricmp(&uri->host, &global.name[i].host)==0) > { > /* Match */ > return PJ_TRUE; > } > > to: > if ((uri->port == global.name[i].port || > (uri->port==0 && global.name[i].port==5060)) && > (pj_stricmp(&uri->host, &global.name[i].host)==0 || > (pj_ntohl(in_addr.s_addr) >> 24) == 127)) > { > /* Match */ > return PJ_TRUE; > } > > where in_addr.s_addr will be from pj_inet_aton(&uri->host, &in_addr); > > Best, > Ondrej > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080709/42bc6822/attachment.html