X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:to:from:subject:mime-version :content-type; q=dns; s=default; b=HeRxBQ/37I+f17uYZseV0qOcLPN9f c3PFFz70pm/bnKjE+Mybgniz52SS11/HT+zUxoAQ0DBeILJw0X5q7q1RoaV9deug ppMSPmeFso4k/JdvRlQMM1j5qdD0mQ6SJxjFHax1CWclpP067sbwjG7xmhebIJGj /jDS9yKd4WE438= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:to:from:subject:mime-version :content-type; s=default; bh=m+8Vs0oz55nPVe1dkMngCAHigwQ=; b=MeY gLjfAuPumrbGZ5qNzauocfqE/iNftt0Gt47LXjGLA/4JjIXZ8Xqr+bPsxYAHm6UK ow+DVxLu4sG2cKobCcMP4ApdJU952DUkD6uNHdUBFYzSRPOFKhcIyBKn6pfgXvOU sOQhkPhNfQLK3PlOaj5f4Ls81fBWq/69YzKi6Mwg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=4.0 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL,T_MANY_HDRS_LCASE autolearn=no version=3.3.2 X-HELO: vms173009pub.verizon.net X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=PYxIXZlY c=1 sm=1 tr=0 a=qu2GBZ4KwuZJuA9HnZzXhA==:117 a=kj9zAlcOel0A:10 a=o83nqyVRAAAA:8 a=o1OHuDzbAAAA:8 a=oR5dmqMzAAAA:8 a=YNv0rlydsVwA:10 a=Cm6j6Bj7P8sni3n64iIA:9 a=yNoYWc9tBxk_FsYN:21 a=scnvoP1v5SgrD-vX:21 a=CjuIK1q_8ugA:10 Message-id: <0NHP009ITJ361TD0@vms173009.mailsrvcs.net> Date: Mon, 05 Jan 2015 09:03:59 -0500 To: cygwin AT cygwin DOT com From: "Pierre A. Humblet" Subject: Resolving localhost on Windows 7 (for exim) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed 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 } It would be nice if this would be tried ASAP. However I am not setup currently to build cygwin. 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. I Pierre -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple