From 3da1b0064a6f730492340797c211d5fcd0a795bc Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 24 Jul 2024 12:06:47 +0200 Subject: resolv: Do not wait for non-existing second DNS response after error (bug 30081) In single-request mode, there is no second response after an error because the second query has not been sent yet. Waiting for it introduces an unnecessary timeout. Reviewed-by: DJ Delorie (cherry picked from commit af625987d619388a100b153520d3ee308bda9889) --- resolv/tst-resolv-short-response.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'resolv/tst-resolv-short-response.c') diff --git a/resolv/tst-resolv-short-response.c b/resolv/tst-resolv-short-response.c index cf1e39876f..be354ae1c7 100644 --- a/resolv/tst-resolv-short-response.c +++ b/resolv/tst-resolv-short-response.c @@ -81,6 +81,18 @@ check_one (void) check_hostent ("www.example", gethostbyname2 ("www.example", AF_INET6), "name: www.example\n" "address: 2001:db8::1\n"); + static const struct addrinfo hints = + { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *ai; + int ret = getaddrinfo ("www.example", "80", &hints, &ai); + check_addrinfo ("www.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 2001:db8::1 80\n"); + if (ret == 0) + freeaddrinfo (ai); } } -- cgit 1.4.1