Package: libc6-dev Version: 2.33-7 Severity: normal Dear Maintainer,
Under certain circumstances, when calling getaddrinfo with hints.ai_family = AF_UNSPEC, the first result is an AF_INET address. When calling it with hints.ai_family = AF_INET, however, it returns 251 (No address associated with hostname). Here is a short program that reproduces the issue: ```c #include <assert.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netdb.h> int main(int argc, char *argv[]) { const char hostname[] = "SomeHostname"; const char service[] = "1433"; struct addrinfo hints, *res; memset(&hints, 0, sizeof(hints)); int ret = getaddrinfo(hostname, service, &hints, &res); assert(ret == 0); assert(res->ai_family == AF_INET); freeaddrinfo(res); hints.ai_family = AF_INET; ret = getaddrinfo(hostname, service, &hints, &res); if (ret != 0) { printf(gai_strerror(ret)); printf("\n"); } else { freeaddrinfo(res); } return ret; } ``` I have only been able to reproduce the bug when all of the following criteria are met: - Running in a Docker container on a Windows host - The hostname is unqualified - The container's /etc/resolv.conf does not include the correct search option to resolve the hostname - The Windows host is set up to resolve unqualified names by applying the correct DNS suffix getaddrinfo() also returns 251 if the AI_ADDRCONFIG flag is set, even though the container has an IPV4 address. The bug is also present in 2.34-0experimental3. Symptoms are superficially similar to #854301, but the container is online and passing AI_ADDRCONFIG returns no result. -- System Information: Debian Release: bookworm/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 5.10.60.1-microsoft-standard-WSL2 (SMP w/12 CPU threads) Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: unable to detect Versions of packages libc6-dev depends on: ii libc-dev-bin 2.33-7 ii libc6 2.33-7 ii libcrypt-dev 1:4.4.27-1.1 ii libnsl-dev 1.3.0-2 ii linux-libc-dev 5.16.12-1 ii rpcsvc-proto 1.4.2-4 libc6-dev recommends no packages. Versions of packages libc6-dev suggests: pn glibc-doc <none> ii manpages-dev 5.10-1 -- no debconf information