From patchwork Mon Jul 30 10:40:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 28680 Received: (qmail 87367 invoked by alias); 30 Jul 2018 10:40:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 87325 invoked by uid 89); 30 Jul 2018 10:40:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=2800, proxy, authority, Domain X-HELO: smtprelay.synopsys.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1532947240; bh=icQ6uy3nSNz1HBY9BX0lY4QfBk6t9XWxG1CpMAZrWx8=; h=From:To:Cc:Subject:Date:From; b=HA9L9H+FS+VV3VCNNXSQYKhxtaJDVXhW1htUn5GkuVILLsLHTDZX4BNutF/2VeAhj O1V9JlzBdOvf44vA5NhceGbHufwIWu6vmFs+aUjkGk/GTeNabpuJOzUogWeV49Cgwc LW43+Wu7gBPv6BK7HS3qUrpjgUEMfITe9yLd8VhWQfhO8UATh9zzbRbByJVUJVQ8oK NtLianhsS9QT6vljK8nKeM19I6Dh8Lq/c+27/+v37yfu8xaT4ZSuUfMiP6qDJ2aAgd HcuFi5XBJ94yjF85xPzFYWAawYfe+/ijbruwh8IBNYIWmJQBomRd3anm7UZD7M/Ick 3mzN/W0w8JdZA== From: Alexey Brodkin To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Alexey Brodkin Subject: [PATCH] posix/tst-getaddrinfo4: Consider EAI_NODATA as an expected result Date: Mon, 30 Jul 2018 13:40:36 +0300 Message-Id: <20180730104036.4016-1-abrodkin@synopsys.com> Some proxy DNS servers might not resolve IPv6 names to addresses. Instead they reply with NOERROR while passing no real data. That combination of NOERROR and EAI_NODATA happen because the DNS server has a recored for requested name (example.net in our case) but that record is not of AAAA type which was requested. That's what Wireshark sees in that case: ---------------------------------->8----------------------------- Domain Name System (response) Transaction ID: 0x6e2e Flags: 0x8180 Standard query response, No error 1... .... .... .... = Response: Message is a response .000 0... .... .... = Opcode: Standard query (0) .... .0.. .... .... = Authoritative: Server is not an authority for domain .... ..0. .... .... = Truncated: Message is not truncated .... ...1 .... .... = Recursion desired: Do query recursively .... .... 1... .... = Recursion available: Server can do recursive queries .... .... .0.. .... = Z: reserved (0) .... .... ..0. .... = Answer authenticated: Answer/authority portion was not authenticated by the server .... .... ...0 .... = Non-authenticated data: Unacceptable .... .... .... 0000 = Reply code: No error (0) Questions: 1 Answer RRs: 0 Authority RRs: 0 Additional RRs: 0 Queries example.net: type AAAA, class IN Name: example.net [Name Length: 11] [Label Count: 2] Type: AAAA (IPv6 Address) (28) Class: IN (0x0001) ---------------------------------->8----------------------------- And that's what we see if Google DNS server (8.8.8.8) is used instead: ---------------------------------->8----------------------------- Domain Name System (response) Transaction ID: 0x3cd4 Flags: 0x8180 Standard query response, No error 1... .... .... .... = Response: Message is a response .000 0... .... .... = Opcode: Standard query (0) .... .0.. .... .... = Authoritative: Server is not an authority for domain .... ..0. .... .... = Truncated: Message is not truncated .... ...1 .... .... = Recursion desired: Do query recursively .... .... 1... .... = Recursion available: Server can do recursive queries .... .... .0.. .... = Z: reserved (0) .... .... ..0. .... = Answer authenticated: Answer/authority portion was not authenticated by the server .... .... ...0 .... = Non-authenticated data: Unacceptable .... .... .... 0000 = Reply code: No error (0) Questions: 1 Answer RRs: 1 Authority RRs: 0 Additional RRs: 0 Queries example.net: type AAAA, class IN Name: example.net [Name Length: 11] [Label Count: 2] Type: AAAA (IPv6 Address) (28) Class: IN (0x0001) Answers example.net: type AAAA, class IN, addr 2606:2800:220:1:248:1893:25c8:1946 ---------------------------------->8----------------------------- --- posix/tst-getaddrinfo4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/posix/tst-getaddrinfo4.c b/posix/tst-getaddrinfo4.c index dc9e423448af..0139dee777a1 100644 --- a/posix/tst-getaddrinfo4.c +++ b/posix/tst-getaddrinfo4.c @@ -39,6 +39,7 @@ try (const char *service, int family, int flags) case 0: case EAI_AGAIN: case EAI_NONAME: + case EAI_NODATA: printf ("SUCCESS getaddrinfo(service=%s, family=%d, flags=%d): %s: %m\n", service ?: "NULL", family, flags, gai_strerror (res)); return 0;