On 24/03/2012 7:44 a.m., Henrik Nordström wrote:
fre 2012-03-23 klockan 19:49 +0400 skrev Alexander Komyagin:
It seems I finally figured out where the problem is. Squid 3.2.0.16
performs host verification for each request. And this verification
produces the call to libc getaddrinfo() function (converting IP address
from text to numeric in my case), but uClibc implementation of this
functions looks like not aware of AF_HOSTNUMERIC hint flag, thus
performing full lookup (I haven't checked details yet). With RSBAC-Net
turned on it's too much overhead. (Actually there are two calls for such
conversion per request - one more is in url.cc:urlParseFinish()
function)
Why is the overhead with RSBAC-Net that high in this case?
getaddrinfo() is a quite frequenty used call.
But I agree that getaddrinfo for converting textual ip to addrinfo to
compare with resolved hostname may be a bit overkill. Not even sure why
we are converting textual IP to to addrinfo there, we should already
have it in IpAddress internal representaion form.
getaddrinfo() is how we parse "Host: 10.0.0.1" or "http://10.0.0.1/"
into that internal form.
Being the POSIX way to parse (domain|IP) patterns it is used anywhere we
might encounter that pattern. So if this does pan out to be uClibC we
may need to detect this brokeness and use the bundled getaddrinfo()
implementation.
Amos