delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/02/14/20:09:12

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F9F9386182E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1707959350;
bh=bhsn1DwGA15gZG+NmMQ37ex30OFM+Iv56TqavmNJffM=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=ug8eYjIAx/VN+Zo/6drfWqefzTOeZvFIu89bmKfYkkkmsl1F8FzngDc34bj5Uu7BO
rbmebbWepmvO2mOOookIiVQpFNKPl7XoJX43lXJD7vyca/f1aZboUluum9CWXxN6xZ
U1uCfnKzozIYrJfHSwVYg/PFGI9YAx0NobxLc2ug=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EBC923861011
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EBC923861011
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707959296; cv=none;
b=dv9S1e3Gmzg78UNUjbwchIE/wHVmC7gcG1buj39mu5V2RnHaiiOQuIloUJotOjWoOclSzI2sMBwQRsO0iNrjw00cMPYX1fl4RtWrG0VG6EaYI4UYw/YwRWq1SDV7VtA9/QuTn8XdleDxGCTrBgVp/QYDxtoKxdmLnL7fYDb8y4U=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1707959296; c=relaxed/simple;
bh=XqDkOriOppH3blmfPsOpMrAaUX7u40MPGxRkJm0TL0U=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=RHf603ZdKKuVbTi/63uADW4eWNPZebQB0JrgHg1Hp+yPiwlrWMAWvP1Qb5UZE6j8HuBtNGvp1kvhy2KlV3nLQYHEkn4JkUqY5l8EVK9C1M68+BvIr3ioBvpwWK+b1MGzb8+WaIX9koubpK2CCZ4IRlmQlsd/mtJ5oA3ajTJG5wE=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <c874178f-dc16-4725-94e5-5a92f98e424e@SystematicSW.ab.ca>
Date: Wed, 14 Feb 2024 18:08:11 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Win 11 Cygwin dns-utils "dig" and "host": Option -6 causes
command to timeout
To: cygwin AT cygwin DOT com
References: <00209ed4-b4a3-4125-9a8a-32ea0fcefc7d AT jhmg DOT net>
Organization: Systematic Software
In-Reply-To: <00209ed4-b4a3-4125-9a8a-32ea0fcefc7d@jhmg.net>
X-Rspamd-Queue-Id: E8C992002B
X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,
SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,
WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6
X-Stat-Signature: io7z1cax5xhp3b7nrzuf4pimjn573qks
X-Rspamd-Server: rspamout04
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX1+0M8bvjWD52MSWvULiz6yKdIOLvtOdBg4=
X-HE-Tag: 1707959291-971673
X-HE-Meta: U2FsdGVkX1+Y9TbK1AjHl7AUY/bt5+/xj2zG36Oa7VitJ8LrIGp0ghs9JFKk1t+LMKIss2KRwt+x6WfkKugGVs6vzlxo+yWsjYuGLbtn/kkSxSH+tw90yYCgbewahrp1ViiWP1+c6V4z+I7Dr/yxu2E4ai5ItdKDYP7J+jk+ncglni3t2sXvA3cu6DZLl2dcnZO8mRJ8CzWRM+u2sFBJEVzGLzaWw6rQKbYJk0Wz516vFwHmQkUfGpE9waCIF9C1PWB2ByH7P4ueWs9tJh63MgxZgLJFMLWbqaOx7934uFqKr/0XjPj+lFnoa+iM/s6Gy7bOY5SHtu6wJpCm7bjcIOUB8unPyDYuld9UYl2HRnfGxCyguK99zlZ5Vs94yf1xfSzWJjm4kWusTKWf7kLT3w==
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 41F19C67000861

On 2024-02-14 16:28, Jim Garrison via Cygwin wrote:
> Win 11 Cygwin "dig" and "host": Option -6 causes command to hang
> 
> TL;DR
> -----
> 
> It appears "dig" and "host" both depend on the existence of /etc/resolv.conf, 
> but only when the -6 option (send queries over IPv6) is specified.
> 
> /etc/resolv.conf does not exist on either my old Win 10 or relatively new Win 11 
> systems.
> 
> I have a vague recollection that at some point, maybe Windows 7 or even XP, 
> there was a Cygwin /etc/resolv.conf that was a link to 
> C:\windows\system32\drivers\etc\resolv.conf, but I don't think this has been 
> true for quite a while if it ever was.  Also resolv.conf does not exist in the 
> windows location either.
> 
> Details
> -------
> 
> Sample:
> 
>      # Default query over IPv4
>      $ host google.com
>      google.com has address 74.125.197.102
>      google.com has address 74.125.197.100
>      google.com has address 74.125.197.138
>      google.com has address 74.125.197.101
>      google.com has address 74.125.197.139
>      google.com has address 74.125.197.113
>      google.com has IPv6 address 2607:f8b0:400e:c03::64
>      google.com has IPv6 address 2607:f8b0:400e:c03::71
>      google.com has IPv6 address 2607:f8b0:400e:c03::65
>      google.com has IPv6 address 2607:f8b0:400e:c03::66
>      google.com mail is handled by 10 smtp.google.com.
> 
> 
>      # Query over IPv6
>      $ host -6 google.com
>      ;; connection timed out; no servers could be reached

Ditto!

Without IPv6 nameservers in /etc/resolv.conf I get:

$ host -6 google.com
;; connection timed out; no servers could be reached
Failing assertion due to probable leaked memory in context 0xa00020be0 ("dig") 
(stats[4].gets == 1).
mem.c:1121: INSIST(ctx->stats[i].gets == 0U) failed.

but with IPv6 nameservers in /etc/resolv.conf I get:

$ host -6 google.com
google.com has address 142.251.211.238
google.com has IPv6 address 2607:f8b0:400a:804::200e
google.com mail is handled by 10 smtp.google.com.

>      # Query over IPv6 with explicit DNS server
>      $ host -6 google.com 2601:xxx:xxx:xxx:201:2eff:fe70:3bfe
>      Using domain server:
>      Name: 2601:xxx:xxx:xxx:201:2eff:fe70:3bfe
>      Address: 2601:xxx:xxx:xxx:201:2eff:fe70:3bfe#53
>      Aliases:
> 
>      google.com has address 74.125.197.139
>      google.com has address 74.125.197.113
>      google.com has address 74.125.197.102
>      google.com has address 74.125.197.100
>      google.com has address 74.125.197.138
>      google.com has address 74.125.197.101
>      google.com has IPv6 address 2607:f8b0:400e:c03::71
>      google.com has IPv6 address 2607:f8b0:400e:c03::65
>      google.com has IPv6 address 2607:f8b0:400e:c03::66
>      google.com has IPv6 address 2607:f8b0:400e:c03::64
>      google.com mail is handled by 10 smtp.google.com.
> 
> I ran the failing command above in strace and saw that it's trying to open 
> /etc/resolv.conf
> 
>      [...]
>        206  515079 [main] host 2426 open: open(/etc/resolv.conf, 0x0)
>         58  515137 [main] host 2426 normalize_posix_path: src /etc/resolv.conf
>         59  515196 [main] host 2426 normalize_posix_path: /etc/resolv.conf = 
> normalize_posix_path (/etc/resolv.conf)
>         63  515259 [main] host 2426 mount_info::conv_to_win32_path: 
> conv_to_win32_path (/etc/resolv.conf)
>         68  515327 [main] host 2426 mount_info::cygdrive_win32_path: src 
> '/etc/resolv.conf', dst ''
>         61  515388 [main] host 2426 mount_info::conv_to_win32_path: src_path 
> /etc/resolv.conf, dst C:\cygwin64\etc\resolv.conf, flags 0x30008, rc 0
>         81  515469 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtCreateFile (\??\C:\cygwin64\etc\resolv.conf)
>         82  515551 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtQueryInformationFile (\??\C:\cygwin64\etc\resolv.conf)
>         90  515641 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtCreateFile (\??\C:\cygwin64\etc\resolv.conf.exe)
>         81  515722 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtQueryInformationFile (\??\C:\cygwin64\etc\resolv.conf.exe)
>         90  515812 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtCreateFile (\??\C:\cygwin64\etc\resolv.conf.lnk)
>         81  515893 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtQueryInformationFile (\??\C:\cygwin64\etc\resolv.conf.lnk)
>         88  515981 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtCreateFile (\??\C:\cygwin64\etc\resolv.conf.exe.lnk)
>         82  516063 [main] host 2426 symlink_info::check: 0xC0000034 = 
> NtQueryInformationFile (\??\C:\cygwin64\etc\resolv.conf.exe.lnk)
>         81  516144 [main] host 2426 symlink_info::check: 0 = 
> symlink.check(C:\cygwin64\etc\resolv.conf, 0x7FFFFB4B0) (mount_flags 0x30008, 
> path_flags 0x0)
>         64  516208 [main] host 2426 mount_info::conv_to_win32_path: 
> conv_to_win32_path (/etc)
>         59  516267 [main] host 2426 mount_info::cygdrive_win32_path: src '/etc', 
> dst ''
>         60  516327 [main] host 2426 mount_info::conv_to_win32_path: src_path 
> /etc, dst C:\cygwin64\etc, flags 0x30008, rc 0
>         69  516396 [main] host 2426 symlink_info::check: 0x0 = NtCreateFile 
> (\??\C:\cygwin64\etc)
>        233  516629 [main] host 2426 symlink_info::check: not a symlink
>         65  516694 [main] host 2426 symlink_info::check: 0 = 
> symlink.check(C:\cygwin64\etc, 0x7FFFFB4B0) (mount_flags 0x30008, path_flags 0x0)
>         62  516756 [main] host 2426 path_conv::check: 
> this->path(C:\cygwin64\etc\resolv.conf), has_acls(1)
>         61  516817 [main] host 2426 build_fh_pc: fh 0x80000BE18, dev 000000C3
>         60  516877 [main] host 2426 fhandler_base::open: 
> (\??\C:\cygwin64\etc\resolv.conf, 0x0)
>         89  516966 [main] host 2426 seterrno_from_nt_status: 
> /cygdrive/d/a/scallywag/cygwin/cygwin-3.5.0-1.x86_64/src/newlib-cygwin/winsup/cygwin/fhandler/base.cc:717 status 0xC0000034 -> windows error 2
>         75  517041 [main] host 2426 geterrno_from_win_error: windows error 2 == 
> errno 2
>         59  517100 [main] host 2426 fhandler_base::open: 0xC0000034 = 
> NtCreateFile (0x7FF84CA3A060, 0x80100000, \??\C:\cygwin64\etc\resolv.conf, io, 
> NULL, 0x0, 0x7, 0x1, 0x4020, NULL, 0)
>         85  517185 [main] host 2426 fhandler_base::open: 0 = 
> fhandler_base::open(\??\C:\cygwin64\etc\resolv.conf, 0x0)
>         90  517275 [main] host 2426 fhandler_base::open_fs: 0 = 
> fhandler_disk_file::open(\??\C:\cygwin64\etc\resolv.conf, 0x0)
>         90  517365 [main] host 2426 open: -1 = open(/etc/resolv.conf, 0x0), errno 2
>      [...]
> 
> I confirmed this was the problem by creating /etc/resolv.conf (within the Cygwin 
> root, not a symlink) and included the search domain and IPv4 and IPv6 dns 
> servers, after which the -6 option no longer timed out.

I added a Cygwin postinstall script:

	/etc/postinstall/0p_l_etc_resolv_conf.dash

to create resolv.conf from `ipconfig /all` DNS servers, an internal list of open 
public DNS servers, and search domains, update:

	/var/run/resolvconf/resolv.conf

when changed, and `ln -frsvt /etc/`, also run from a Scheduled Task on System 
Restart.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019