Vincent CHAVANIS wrote:
This fixes the segfault i had,
when tried to connect bearbox on X86_64SMP and DNS SERVERS IPV6 compatible.
gethostbyname2() works like gethostbyname(), but permits to specify the address
family (AF_INET) to which the address must belong.
Glibc2 also has reentrant versions gethostbyname_r() and gethostbyname2_r().
--- /cvs/gateway/gwlib/protected.c 2005-02-11 16:35:48.000000000 +0100
+++ /gateway/gwlib/protected.c 2006-02-23 14:00:23.000000000 +0100
@@ -193,7 +193,7 @@
bufflen = 1024;
*buff = (char*) gw_malloc(bufflen);
- while ((res=gethostbyname_r(name, &hp,*buff, bufflen, &tmphp, &herr)) ==
ERANGE) {
+ while ((res=gethostbyname2_r(name, AF_INET,&hp,*buff, bufflen, &tmphp,
&herr)) == ERANGE) {
/* enlarge the buffer */
bufflen *= 2;
*buff = (char*) gw_realloc(*buff, bufflen);
Thanks for the patch Vincent.
Actually gethostbyname2() should be avoided IMO if no IPv6 build is done. So the
question is, why does the response of the IPv6 eanbled DNS server break our
regular IPv4 gethostbyname_r()?
AFAIS, the usage of gethostbyname2() is suggested to be avoided, since it's
"only" a GNU extension, but no official API call.
Any comments from the others? I'm +-0 on commiting this, in terms of a clean
resolving via autoconf detection macro and gw-config.h.in #define.
Stipe
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany
tolj.org system architecture Kannel Software Foundation (KSF)
http://www.tolj.org/ http://www.kannel.org/
mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------