Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostip: on macOS avoid DoH when given a numerical IP address #5459

Closed
wants to merge 2 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented May 26, 2020

USE_RESOLVE_ON_IPS (defined on macOS) means that addresses still need to
get "resolved" but not with DoH.

Reported-by: Viktor Szakats
Fixes #5454

USE_RESOLVE_ON_IPS (defined on macOS) means that addresses still need to
get "resolved" but not with DoH.

Reported-by: Viktor Szakats
Fixes #5454
@bagder bagder added the name lookup DNS and related tech label May 26, 2020
@vszakats
Copy link
Member

Thank you — there is an improvement! But it now falls into the same trap inside Curl_resolv_check() a few lines later. (respwait becomes 1 in Curl_getaddrinfo())

@bagder
Copy link
Member Author

bagder commented May 26, 2020

Ah right, I didn't consider the fact that it will do the name resolve in a separate thread and thus get the response back asynchronously and not immediately...

@vszakats
Copy link
Member

vszakats commented May 26, 2020

Retried with your latest update and it's a success now (on macOS):

stderr

* Found bundle for host dns.cloudflare.com: 0x7ff6b5c0c010 [serially]
* Server doesn't support multiplex (yet)
*   Trying 2606:4700::6810:85e5:443...
* Hostname 'dns.cloudflare.com' was found in DNS cache
*   Trying 2606:4700::6810:85e5:443...
* Connected to dns.cloudflare.com (2606:4700::6810:85e5) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Connected to dns.cloudflare.com (2606:4700::6810:85e5) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: cloudflare.com
* Server certificate: CloudFlare Inc ECC CA-2
* Server certificate: Baltimore CyberTrust Root
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7ff6b601d600)
> POST /dns-query HTTP/2
Host: dns.cloudflare.com
accept: */*
content-type: application/dns-message
content-length: 41

* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* We are completely uploaded and fine
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: cloudflare.com
* Server certificate: CloudFlare Inc ECC CA-2
* Server certificate: Baltimore CyberTrust Root
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7ff6b6023200)
> POST /dns-query HTTP/2
Host: dns.cloudflare.com
accept: */*
content-type: application/dns-message
content-length: 41

* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* We are completely uploaded and fine
< HTTP/2 200 
< date: Tue, 26 May 2020 13:19:32 GMT
< content-type: application/dns-message
< content-length: 98
< access-control-allow-origin: *
< cf-request-id: 02f2bc7a720000cea3a8b36200000001
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< server: cloudflare
< cf-ray: 5997c9d71f55cea3-GVA
< 
* Connection #0 to host dns.cloudflare.com left intact
* a DOH request is completed, 1 to go
< HTTP/2 200 
< date: Tue, 26 May 2020 13:19:32 GMT
< content-type: application/dns-message
< content-length: 123
< access-control-allow-origin: *
< cf-request-id: 02f2bc7a790000ceabdf94a200000001
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< server: cloudflare
< cf-ray: 5997c9d72f74ceab-GVA
< 
* Connection #1 to host dns.cloudflare.com left intact
* a DOH request is completed, 0 to go
* DOH Host name: ftp.thp.uni-duisburg.de
* TTL: 172276 seconds
* DOH A: 134.91.141.1
* CNAME: op2.thp.uni-duisburg.de
* CNAME: op2.thp.uni-duisburg.de
*   Trying 134.91.141.1:21...
* Connected to ftp.thp.uni-duisburg.de (134.91.141.1) port 21 (#0)
< 220 (vsFTPd 2.0.3)
> USER anonymous
< 331 Please specify the password.
> PASS ftp@example.com
< 230 Login successful.
> PWD
< 257 "/"
* Entry path is '/'
> CWD pub
* ftp_perform ends with SECONDARY: 0
< 250 Directory successfully changed.
> CWD source
< 250 Directory successfully changed.
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||42885|)
*   Trying 134.91.141.1:42885...
* Connecting to 134.91.141.1 (134.91.141.1) port 42885
* Connected to ftp.thp.uni-duisburg.de (134.91.141.1) port 21 (#0)
> TYPE I
< 200 Switching to Binary mode.
> SIZE pstree-2.39.tar.gz
< 213 12929
> RETR pstree-2.39.tar.gz
< 150 Opening BINARY mode data connection for pstree-2.39.tar.gz (12929 bytes).
* Maxdownload = -1
* Getting file with size: 12929
{ [2896 bytes data]
* Remembering we are in dir "pub/source/"
< 226 File send OK.
* Connection #0 to host ftp.thp.uni-duisburg.de left intact

@bagder
Copy link
Member Author

bagder commented May 26, 2020

Execellent, thanks for verifying this!

@bagder bagder closed this in 67d2802 May 26, 2020
@bagder bagder deleted the bagder/mac-resolve-ipnum-doh branch May 26, 2020 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
name lookup DNS and related tech
Development

Successfully merging this pull request may close these issues.

macOS: FTP + DoH fails with '(15) Could not DOH-resolve: {IPv4-address}'
2 participants