This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] gethostbyname2


----- Original Message ----- 
From: "Corinna Vinschen"
To: <cygwin-patches>
Sent: Thursday, February 26, 2009 11:05 AM
Subject: Re: [Patch] gethostbyname2


| On Feb 26 10:29, Pierre A. Humblet wrote:
| > 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'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.

| > 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?
|
| 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?
To answer Dave, "DNS Client" service is running, I have never experimented turning it off.

Pierre 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]