From: Daniel Berger Date: 2002-09-01T04:57:33+09:00 Subject: Re: gethostbyname() requires reverse lookup to work? ts wrote: >>>>>> "D" == Daniel Berger writes: > > D> Couldn't you simply check RES_USE_INT6 and call gethostbyname or > D> gethostbyname2 as appropriate? I'm looking at Stevens, "Unix Network > D> Programming", p.240-249 > > RFC 2553 > > 6.1 Nodename-to-Address Translation > > The commonly used function gethostbyname() is inadequate for many > applications, first because it provides no way for the caller to > specify anything about the types of addresses desired (IPv4 only, > IPv6 only, IPv4-mapped IPv6 are OK, etc.), and second because many > implementations of this function are not thread safe. RFC 2133 > defined a function named gethostbyname2() but this function was also > inadequate, first because its use required setting a global option > (RES_USE_INET6) when IPv6 addresses were required, and second because > a flag argument is needed to provide the caller with additional > control over the types of addresses required. > > > > Guy Decoux Ok, but the question I have to ask is whether or not this actually affects anyone. Looking through the Perl 5.8 source code, I don't even *see* any refernce to gethostbyname2, although they use the reentrant functions where available. Using Google, I searched through the comp.lang.perl.misc archives. With over 10 years of posts, I found exactly 31 posts regarding IPv6, and NONE of them (that I saw) have any complaints with regards to incompatibility and/or thread problems with IPv6 (although, I realize Perl didn't really support threads until recently). I also couldn't find a single reference to RFC 2553. My point is, I think the code should be written so as not to worry about those (very?) rare cases where it might fail with regards to IPv6. I think reverse lookups are likely to be a much more prevalent cause of failures. Just my .02 Regards, Dan