[Patch] gethostbyname2

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Feb 26 18:04:00 GMT 2009

On Feb 26 12:55, Pierre A. Humblet wrote:
> From: "Corinna Vinschen"
> | I'm sorry, but I really don't understand what you mean.  How are you
> | undoing work in minires when using minires in gethostbyname2?!?  Why
> | isn't it just possible to call res_query from there?
> It is possible of course. But the sequence would be the following
> 1) External DNS server sends compressed records to Windows resolver
> 2) Windows resolver uncompresses the records and puts them in nice structures
> 3) Minires takes the nice structures and recompresses them to wire format
> 4) Gethostbyname2 uncompresses them into nice structures
>     then 5) calls dup_ent,  which copies them in the tls.locals
> I would like to streamline the process:
> - With Windows resolver: 1, 2, 5  (that's the current patch, ~20% of  which is
>          cut&pasted from minires and could be restructured to use a common function)
> - Without: Straight fom wire format records to the tls.locals memory block
>                  Or: have a routine 2a) in minires that replaces 2. Then it would be 1, 2a, 5.

Uh, I see.  Well, you could change the minires code so that there is an
internal interface which can be used from net.cc or, FWIW, any other
part of Cygwin to optimize the above process.  If you really think
it's necessary to move gethostbyname2 to the minires sources, go for it.
However, in the long run I think it's better to keep gethostbyname2 in
net.cc and to have an optimized internal resolver interface for this
kind of call.

> | I never used the DnsQuery functions myself.  There's a DnsQuery flag
> | called DNS_QUERY_NO_NETBT documented in MSDN, maybe there's something
> | switched off on your machine so that's the default?
> Perhaps. But where is it or how does the native gethostbyname turn it on?

Did you search on the net?  I have honestly no idea why this happens and
I would have to do the same, sorry.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list