This is the mail archive of the cygwin 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: Resolving localhost on Windows 7 (for exim)


Hi Pierre,

On Jan  5 09:03, Pierre A. Humblet wrote:
> While porting exim to Windows 64 I have observed strange results when
> resolving localhost
> 
> On Windows XP,
> 
> Resolv: search "localhost" type 28
> Resolv: query "localhost" type 28
> Resolv: DnsQuery: 0 (Windows)
> Resolv: localhost Section 0 Type 28 Windows Record Length 16
> 08:02:06  3760 DNS lookup of localhost (AAAA) succeeded
> Resolv: search "localhost" type 1
> Resolv: query "localhost" type 1
> Resolv: DnsQuery: 0 (Windows)
> Resolv: localhost Section 1 Type 1 Windows Record Length 4
> 08:44:13  5552 DNS lookup of localhost (A) succeeded
> 
> We see that for IPV4 localhost things are fine.
> Windows returns an answer section (1) and Cygwin processes it correctly.
> 
> However for IPV6 it returned a question section (0) but with data in it.
> Cygwin essentially drops that.
> That's why above the application tried an A record after getting the AAAA
> record, which was empty.
> 
> 
> However of Windows 7
> CYGWIN_NT-6.1 Dell3020 1.7.33-2(0.280/5/3) 2014-11-13 15:47 x86_64 Cygwin
> 
> Resolv: search "localhost" type 28
> Resolv: query "localhost" type 28
> Resolv: DnsQuery: 0 (Windows)
> Resolv: localhost Section 0 Type 28 Windows Record Length 16
> 08:22:24 140244 DNS lookup of localhost (AAAA) succeeded
> Resolv: search "localhost" type 1
> Resolv: query "localhost" type 1
> Resolv: DnsQuery: 0 (Windows)
> Resolv: localhost Section 0 Type 1 Windows Record Length 4
> 
> We see that Windows returns question sections in both cases and localhost is
> never resolved.
> From what I have seen Windows never returns question section in normal cases
> so I suggest
> inserting the following on line 251 of minires-os-if.c, to essentially turn
> question sections
> in answer sections (after  while (rr) { )
> 
> if ((rr->Flags.DW & 0x3) == 0) {
>         DPRINTF(debug, "Got section 0 %s %d with data length %d\n", DomName,
> Type, rr->wDataLength);
>         if (rr->wDataLength > 0)
>                 rr->Flags.DW |= 1; // Make it an answer section as there is
> data
> }

Can you please send at least a real patch?  Without the formatting
matching the surrounding code I'm totally unsure where to apply this
code.  A ChangeLog entry would be helpful as well.

> It would be nice if this would be tried ASAP.
> However I am not setup currently to build cygwin.

It's not exactly tricky to set this up...

> Occasionally I also see localhost queries fail.
> I have not been able to pinpoint what causes that.
> 
> Resolv: search "localhost" type 28
> Resolv: query "localhost" type 28
> Resolv: DnsQuery: 9003 (Windows)
> 08:00:14 145640 DNS lookup of localhost (AAAA) gave HOST_NOT_FOUND
> 08:00:14 145640 returning DNS_NOMATCH
> Resolv: search "localhost" type 1
> Resolv: query "localhost" type 1
> Resolv: DnsQuery: 9003 (Windows)
> 
> 
> In light of RFC 6761 we should handle localhost in gethostbyname2, for both
> IP4 and IP6
> While we are at it we should also handle numerical domains w.x.y.z there.
> That's less urgent, I can do that in the coming weeks.

Cool, I'm looking forward to your patches!


Thanks,
Corinna

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

Attachment: pgphIOwRBPJno.pgp
Description: PGP signature


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