[Date Prev][Date Next] [Chronological] [Thread] [Top]

gethostbyaddr, IPv6, Solaris

I just noticed that slapd's reverse-lookup code always uses (some variant
of)gethostbyaddr, which is only defined to support AF_INET addresses. We
probably need to use getnameinfo() or getipnodebyaddr() to properly support
AF_INET6 addresses. getnameinfo() may be the best choice.

I'm also running into issues on Solaris 8 with gethost* re-entrancy problems,
caused by using SASL/GSSAPI. It appears that all of the software involved
(OpenLDAP, Cyrus SASL, Heimdal) uses the proper re-entrant interfaces.
However, it's all for nought because
 (a) the Solaris Name Service Switch turns all calls into the non-reentrant
 (b) even the re-entrant functions (like getnameinfo) in libresolv are built
up on the non-reentrant versions.

It's kind of strange that Sun would have such a glaring weakness in their C
library; I guess there's still the possibility that something else is
misbehaving. But I've looked through the available source code pretty
carefully and I believe everyone is playing by the book. (With the exception
of a problem in Heimdal calling res_search instead of res_nsearch, which I
found and patched.)

Kurt suggested putting a mutex around the SASL calls to fix this problem.
That seems a bit unwieldy, but unless someone has a better idea I guess we're
stuck with that.

This was only causing intermittent problems on a single CPU box with heavy
load, but on a multi-CPU machine it very rapidly causes failures; no matter
how many clients you try to start they will all run into connection errors
until only one client is running. The problem is evident in the slapd log
files when reverse-lookups are enabled because garbage strings will be logged
for the hostnames.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support