[Patch] gethostbyname2

Pierre A. Humblet pierre@phumblet.no-ip.org
Thu Feb 26 15:30:00 GMT 2009

At 04:52 AM 2/26/2009, Corinna Vinschen wrote:
| >On Feb 25 23:03, Pierre A. Humblet wrote:
| > > I tried to compile Exim with IPv6 enabled and Cygwin 1.7, but it needs
| > > gethostbyname2.
| > > Here is an implementation of that function.
| > > In attachment I am including the same patch as well as a short test function.
| > >
| >
| >This is way cool!  I have this function on my TODO list for ages.
| >
| >But there's a problem.  You're using DnsQuery_A directly, but this
| >function only exists since Win2K.  Would it be a big problem to rework
| >the function to use the resolver functions instead?  They are part of
| >Cygwin now anyway and that would abstract gethostbyname2 from the
| >underlying OS capabilities.

I was afraid of that. Using res_query was my initial thought, but I realized that when using the
Windows resolver I would undo in gethostbyname2 all the work done in minires.

I am wondering if gethostbyname2 should not be moved out of  net.cc and integrated
with minires. We could design shortcuts to use the most appropriate method.

I have read RFC 2133, section 6.1 . Do we want to implement having a
RES_OPTIONS in the environment,  in  /etc/resolv.conf, or only by setting the
appropriate flag in _res? What does Linux do?

I am still fighting one issue with Windows. On XP, when using the native gethostbyname
I can resolve computers on my local net (through NetBIOS or such). But I can't get
them with DnsQuery, except my own computer, despite what I think the doc says.
Any insight?


More information about the Cygwin-patches mailing list