Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129335

DNS lookup on Apple platforms doesn't go through system machinery

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.8.1, 6.9.0 FF
    • 6.8
    • Network: DNS
    • None
    • iOS/tvOS/watchOS, macOS
    • 252bd7c67 (dev), 10fea78bd (dev), 40986460e (dev), 41768db30 (dev), fb69c5a35 (6.8), 5ce4677f2 (6.8), ea871ee2e (6.8), c2df419ed (6.8)

      QDnsLookup doesn't seem to plumb to the DNS machinery on macOS/iOS, but is instead implemented via the unix APIs. 

      This means we're missing out on /etc/hosts lookup and Bonjour/mDNS, and don't reflect the complete DNS setup on Apple systems.

      As an example, 

      ❯ dscacheutil -q host -a name localhost.
      name: localhost
      ipv6_address: ::1name: localhost
      ip_address: 127.0.0.1 

      dscacheutil uses the system DNS machinery.

      ❯ nslookup localhost.
      Server:        1.1.1.1
      Address:    1.1.1.1#53** server can't find localhost: NXDOMAIN 
      ❯ dig localhost.; <<>> DiG 9.10.6 <<>> localhost.
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 45886
      ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 1232
      ;; QUESTION SECTION:
      ;localhost.            IN    A;; AUTHORITY SECTION:
      .            85342    IN    SOA    a.root-servers.net. nstld.verisign-grs.com. 2024092500 1800 900 604800 86400;; Query time: 7 msec
      ;; SERVER: 1.1.1.1#53(1.1.1.1)
      ;; WHEN: Wed Sep 25 16:47:48 CEST 2024
      ;; MSG SIZE  rcvd: 113 

      While nslookup (and dig) does not.

      For Qt, the tst_QDnsLookup::lookupLocalhost() test fails in a similar way, unless the upstream DNS server happens to resolve "localhost."

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            tpochep Timur Pocheptsov
            vestbo Tor Arne Vestbø
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: