[PATCH v6] resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]

Florian Weimer fweimer@redhat.com
Wed Oct 8 11:25:16 GMT 2025


* Sergey Kolosov:

> This patch adds two tests that verify correct behavior of getaddrinfo
> when DNS resolution fails with a temporary error. Both tests ensure
> that getaddrinfo returns EAI_AGAIN in cases where no valid address can
> be resolved due to network or resolver failure.
>
> * tst-getaddrinfo-eai-again.c
>   Runs inside the glibc test-container without any DNS server
>   configured. The test performs queries using AF_INET, AF_INET6,
>   and AF_UNSPEC and verifies that getaddrinfo returns EAI_AGAIN
>   when resolution fails.
>
> * tst-getaddrinfo-eai-again-timeout.c
>   Runs outside of the container but uses the resolv_test framework
>   to simulate network failures. The test covers two failure modes:
>   - No response from the server (resolv_response_drop)
>   - Zero-length reply from the server
>   In both cases, getaddrinfo is expected to return EAI_AGAIN.
> ---
> Change since v6:
>   Added comment to suppress trailing backslash in tests-container list.
> ---
>  resolv/Makefile                            |   8 +-
>  resolv/tst-getaddrinfo-eai-again-timeout.c | 122 +++++++++++++++++++++
>  resolv/tst-getaddrinfo-eai-again.c         |  56 ++++++++++
>  3 files changed, 185 insertions(+), 1 deletion(-)
>  create mode 100644 resolv/tst-getaddrinfo-eai-again-timeout.c
>  create mode 100644 resolv/tst-getaddrinfo-eai-again.c

This version still looks okay to me.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list