> From: Alex Kasatkin
> Sent: Thursday, 11 September 2003 12:43 AM
> Paul Hampson [EMAIL PROTECTED] wrote:
> > > From: Alex Kasatkin
> > > Sent: Thursday, 11 September 2003 12:16 AM
> > > Paul Hampson [EMAIL PROTECTED] wrote:
> > > > What's c_r? Is that where the ghostby{addr,name}_r stuff lives? I guess that
> > > > could be detected as
> > > > a required library for the gethostby{addr,name}_r function-using modules
> > > > (hopefully just libradius)
> > > AFAIR it's threaded c library.
> > If you run
> > CFLAGS=-lc_r ./configure {etc}
> > what types get detected for gethostby{addr,name}_r? It _might_ be worth having
> > an extra check for that once we know what style is in the library.
> dev:~/freeradius-0.9.1# setenv CFLAGS -lc_r ; ./configure ... blablabla.
>
> checking whether the C compiler (gcc -lc_r -pthread -D_THREAD_SAFE -Wall
> -D_GNU_SOURCE -DNDEBUG ) works... yes
> checking whether the C compiler (gcc -lc_r -pthread -D_THREAD_SAFE -Wall
> -D_GNU_SOURCE -DNDEBUG ) is a cross-compiler... no
> ...
> checking gethostbyaddr_r() syntax... GNU-style
> checking gethostbyname_r() syntax... configure: warning: ****** BSD Style
> gethostbyname might NOT be thread-safe! ******
> BSD-style
OK, a little bit of reading:
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2003-06/0632.html
http://bugzilla.mozilla.org/show_bug.cgi?id=70213#c36
suggests that FreeBSD doesn't have the _r-style functions, and that the
gethostbyname_r being
detected is not in fact thread-safe, and pending removal.
So for the moment, I guess, this is not solved. The best bet currently is to force
FreeBSD to
use the BSD-style functions for both. Or wait for a new 4.x release w/out the
gethostby{addr,name}_r defines.
(Wider thinking/reading follows. Immediate results are unchanged from above... :-)
The FreeBSD manpage for the new way, getipnodeby{addr,name}
http://www.freebsd.org/cgi/man.cgi?query=getipnodebyname&apropos=0&sektion=0&manpath=FreeBSD+4.8-RELEASE&format=html
notes that
hptr = gethostbyname(name);
can be replaced by
hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num);
with requisite freehostent call.
But getipnodebyname is mentioned as being not thread-safe...
Linux doesn't have 'em either...
Aha! More reading, and apparently getnameinfo and getaddrinfo are the new new way to
go:
http://www.freebsd.org/cgi/man.cgi?query=getaddrinfo&apropos=0&sektion=0&manpath=FreeBSD+4.8-RELEASE&format=html
http://www.freebsd.org/cgi/man.cgi?query=getnameinfo&apropos=0&sektion=0&manpath=FreeBSD+4.8-RELEASE&format=html
And of course, under FreeBSD, getaddrinfo and getnameinfo aren't thread safe. ;-)
Maybe FreeBSD == --without-threads should be added to a FreeRADIUS FAQ?
So configure tests could check for _these_ by preference to the gethostby* and then
the two functions which wrap them for the rest of the server (in src/lib/misc.c) can
get
extra #define'd paths for them.
Well, maybe not by preference?... _I_ think they're preferable, 'cause it'll ease us
eventually
supporting IPv6 in the server (as opposed to IPv6 support in RADIUS, which I _think_
we have?)
Note: getnameinfo ~= gethostbyaddr, getaddrinfo ~= gethostbyname!
However, since they're not threadsafe under FreeBSD, and no-one else's detection is
barfing
AFAIK, this isn't really urgent.
Hopefully this whole ugly mess will soon be behind us. 'cause that's certainly where
the pain is in.
Volunteers? ;-)
--
=========================================================
Paul "TBBle" Hampson
Bubblesworth Pty Ltd (ABN: 51 095 284 361)
[EMAIL PROTECTED]
This is a one line proof...if we start
sufficiently far to the left.
-- Cambridge University Math Department
---------------------------------------------------------
Random signature generator 3.0 by Paul "TBBle" Hampson
=========================================================
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html