public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* dig and host don't work in IPv6
@ 2023-07-28 15:58 Andrew Schulman
  2023-07-28 16:52 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Schulman @ 2023-07-28 15:58 UTC (permalink / raw)
  To: cygwin

Our agency has started using IPv6. My PC has IPv4 and IPv6 addresses. DNS
servers are all IPv6 addresses.

All of this works great, except that now the host and dig commands no longer
work, even with -6:

$ dig -6 cygwin.com

; <<>> DiG 9.11.9 <<>> -6 cygwin.com
;; global options: +cmd
;; connection timed out; no servers could be reached


It does work if I specify the DNS server in the command:

$  dig @2620:117:5010:1a1::f005 cygwin.com

; <<>> DiG 9.11.9 <<>> @2620:117:5010:1a1::f005 cygwin.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56580
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1220
; COOKIE: d078f7e381ceee2117dbf35864c3e4d5b7b37dc8c646f48c (good)
;; QUESTION SECTION:
;cygwin.com.            IN  A

;; ANSWER SECTION:
cygwin.com.     3600    IN  A   8.43.85.97

;; Query time: 142 msec
;; SERVER: 2620:117:5010:1a1::f005#53(2620:117:5010:1a1::f005)
;; WHEN: Fri Jul 28 11:55:01 EDT 2023
;; MSG SIZE  rcvd: 83


It also works if I manually add a 'nameserver' line to /etc/resolv.conf. That's
not a sustainable solution though, since the nameservers change and I drop into
and out of the IPv6 VPN.

Should I be doing something differently? Or is it a bug?

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXTERNAL] dig and host don't work in IPv6
  2023-07-28 15:58 dig and host don't work in IPv6 Andrew Schulman
@ 2023-07-28 16:52 ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2023-07-28 17:16   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2023-07-28 23:03   ` Andrew Schulman
  0 siblings, 2 replies; 7+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2023-07-28 16:52 UTC (permalink / raw)
  To: Andrew Schulman, cygwin

> Should I be doing something differently? Or is it a bug?

It may be sort of a limitation (IIRC, in Cygwin's minires) but:

Did you try to use

options=osquery

and (separate by spaces) / or

options=inet6

in /etc/resolv.conf ?

HTH,

Anton Lavrentiev
Contractor NIH/NLM/NCBI


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXTERNAL] dig and host don't work in IPv6
  2023-07-28 16:52 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
@ 2023-07-28 17:16   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2023-07-28 23:03   ` Andrew Schulman
  1 sibling, 0 replies; 7+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2023-07-28 17:16 UTC (permalink / raw)
  To: Andrew Schulman, cygwin

> It may be sort of a limitation (IIRC, in Cygwin's minires) but:
 
> > Should I be doing something differently? Or is it a bug?

> > the host and dig commands no longer work

Reading your question again, I don't think Cygwin's minires limitation (if any) can be at play here because IIRC neither dig nor host (as actually a specialization of dig) use the resolver API but work directly at the DNS protocol level...

OTOH, they probably are looking at the nsaddr section of the resolver context structure to see what INET6 nameservers are available -- and they don't see any in there, that's why they fail?..

These are just my assumptions, though.

Are your [other] applications (that use the resolver API, with the osquery option, as suggested previously) able to resolve IPv6 addresses?

Anton Lavrentiev
Contractor NIH/NLM/NCBI

Cygwin's /usr/include/resolv.h has only IPv4 entries for nameservers:

struct __res_state {
        int     retrans;                /* retransmition time interval */
        int     retry;                  /* number of times to retransmit */
        u_long  options;                /* option flags - see below. */
        int     nscount;                /* number of name servers */
        struct sockaddr_in
                nsaddr_list[MAXNS];     /* address of name server */          // <<<=== IPv4 only
#define nsaddr  nsaddr_list[0]          /* for backward compatibility */
        u_short id;                     /* current message id */
        char    *dnsrch[MAXDNSRCH+1];   /* components of domain to search */
        char    defdname[256];          /* default domain (deprecated) */
        u_long  pfcode;                 /* RES_PRF_ flags - see below. */
        unsigned ndots:4;               /* threshold for initial abs. query */
        unsigned nsort:4;               /* number of elements in sort_list[] */
        char    unused[3];
        struct {
                struct in_addr  addr;
                u_int32_t       mask;
        } sort_list[MAXRESOLVSORT];
        res_send_qhook qhook;           /* query hook */
        res_send_rhook rhook;           /* response hook */
        int     res_h_errno;            /* last one set for this context */
        int     _vcsock;                /* PRIVATE: for res_send VC i/o */
        u_int   _flags;                 /* PRIVATE: see below */
        union {
                /* On an 32-bit arch this means 512b total. */
                char    pad[72 - 3*sizeof (int) - 2*sizeof (void *)];
                struct {
                        u_int16_t               nscount;
                        u_int16_t               nstimes[MAXNS]; /* ms. */
                        int                     nssocks[MAXNS];
                        struct __res_state_ext *ext;    /* extention for IPv6 */
                } _ext;
        } _u;
};


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXTERNAL] dig and host don't work in IPv6
  2023-07-28 16:52 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2023-07-28 17:16   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
@ 2023-07-28 23:03   ` Andrew Schulman
  2023-07-29  2:35     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Schulman @ 2023-07-28 23:03 UTC (permalink / raw)
  To: cygwin

> > Should I be doing something differently? Or is it a bug?
> 
> It may be sort of a limitation (IIRC, in Cygwin's minires) but:
> 
> Did you try to use
> 
> options=osquery
> 
> and (separate by spaces) / or
> 
> options=inet6
> 
> in /etc/resolv.conf ?

Thanks. Unfortunately neither of those options fixes the problem.

And yes, other Cygwin network clients work normally, for example curl and ssh.

Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXTERNAL] dig and host don't work in IPv6
  2023-07-28 23:03   ` Andrew Schulman
@ 2023-07-29  2:35     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2023-07-29 14:26       ` Andrew Schulman
  0 siblings, 1 reply; 7+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2023-07-29  2:35 UTC (permalink / raw)
  To: Andrew Schulman, cygwin

> Thanks. Unfortunately neither of those options fixes the problem.

Sorry...  Did you try using the -d option to see what DNS servers these commands try to actually connect to (and time out, eventually).

(strace can help as well, I think.)

Anton Lavrentiev
Contractor NIH/NLM/NCBI


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXTERNAL] dig and host don't work in IPv6
  2023-07-29  2:35     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
@ 2023-07-29 14:26       ` Andrew Schulman
  2023-08-01  3:04         ` Lee
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Schulman @ 2023-07-29 14:26 UTC (permalink / raw)
  To: cygwin

> Sorry...  Did you try using the -d option to see what DNS servers these commands try to actually connect to (and time out, eventually).

No help unfortunately.

$ host -d6 cygwin.com
Trying "cygwin.com"
;; connection timed out; no servers could be reached

> (strace can help as well, I think.)

Posted at https://pastebin.com/XWwxJ41b. I'm not able to make much sense of it,
except that on line 1339, I waited almost 5 seconds for sendmsg:

4964291 6958349 [isc-worker0000] host 20999 cygwin_sendmsg: 28 = sendmsg(20,
0x7FFDFC830, 0x0)

Thanks for taking a look. I'm looking at other options in resolv.conf, but
haven't found anything useful.

I can't find any documention of the osquery option. This answer[1] says
"res_init() uses the Windows resolver if either /etc/resolv.conf does not exist,
or /etc/resolv.conf contains options osquery." Doesn't help in this case though.

Andrew

[1]
https://stackoverflow.com/questions/10523828/how-does-gcc-cygwin-get-the-dns-server


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXTERNAL] dig and host don't work in IPv6
  2023-07-29 14:26       ` Andrew Schulman
@ 2023-08-01  3:04         ` Lee
  0 siblings, 0 replies; 7+ messages in thread
From: Lee @ 2023-08-01  3:04 UTC (permalink / raw)
  To: Andrew Schulman; +Cc: cygwin

On 7/29/23, Andrew Schulman via Cygwin <cygwin@cygwin.com> wrote:
>> Sorry...  Did you try using the -d option to see what DNS servers these
>> commands try to actually connect to (and time out, eventually).
>
> No help unfortunately.
>
> $ host -d6 cygwin.com
> Trying "cygwin.com"
> ;; connection timed out; no servers could be reached

Have you tried the windows version of bind from isc.org?

I don't remember when ISC dropped (will drop?) support for windows,
but I've been using dig from the bind9.16.41 package for a while.  Not
that I use it all that much, but it works for me.. or at  least dig
does.  named on windows has something funky going on that I never
figured out, so I'm running named on Debian.

Get it here
https://ftp.isc.org/isc/bind9/9.16.41/BIND9.16.41.x64.zip

unzip and put that directory in your path
$ which dig
/cygdrive/c/Temp/BIND/dig

and have fun!
$ dig @2600:x:x:x::x:x www.google.com aaaa +short
2607:f8b0:4004:c09::67
2607:f8b0:4004:c09::69
2607:f8b0:4004:c09::93
2607:f8b0:4004:c09::63

Lee@i3668 ~
$ dig @2600:x:x:x::x:x www.google.com a +short
172.253.122.147
172.253.122.103
172.253.122.99
172.253.122.104
172.253.122.105
172.253.122.106

ipv6 address hidden to protect the guilty :)

... hrmmm ... I just tried your "host -d6 cygwin.com" and got
$ host -d6 cygwin.com
Trying "cygwin.com"
;; connection timed out; no servers could be reached

Do you have a firewall blocking outbound udp/tcp to port 53?  I do,
which is most probably why I get the timeout.  But this works:
$ host cygwin.com 2600:x:x:x::x:x
Using domain server:
Name: 2600:x:x:202::x:x
Address: 2600:x:x:202::x:x#53
Aliases:

cygwin.com has address 8.43.85.97
cygwin.com mail is handled by 10 sourceware.org.


Maybe try using whatever dig you already have installed and do
  ipconfig /all | grep "DNS Server"
and then
  dig @<my dns server address> cygwin.com

Regards,
Lee


>
>> (strace can help as well, I think.)
>
> Posted at https://pastebin.com/XWwxJ41b. I'm not able to make much sense of
> it,
> except that on line 1339, I waited almost 5 seconds for sendmsg:
>
> 4964291 6958349 [isc-worker0000] host 20999 cygwin_sendmsg: 28 =
> sendmsg(20,
> 0x7FFDFC830, 0x0)
>
> Thanks for taking a look. I'm looking at other options in resolv.conf, but
> haven't found anything useful.
>
> I can't find any documention of the osquery option. This answer[1] says
> "res_init() uses the Windows resolver if either /etc/resolv.conf does not
> exist,
> or /etc/resolv.conf contains options osquery." Doesn't help in this case
> though.
>
> Andrew
>
> [1]
> https://stackoverflow.com/questions/10523828/how-does-gcc-cygwin-get-the-dns-server
>
>
> --
> 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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-01  3:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 15:58 dig and host don't work in IPv6 Andrew Schulman
2023-07-28 16:52 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-07-28 17:16   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-07-28 23:03   ` Andrew Schulman
2023-07-29  2:35     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-07-29 14:26       ` Andrew Schulman
2023-08-01  3:04         ` Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).