]> git.ipfire.org Git - thirdparty/glibc.git/commit
resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]
authorSergey Kolosov <skolosov@redhat.com>
Fri, 10 Oct 2025 15:15:27 +0000 (17:15 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 10 Oct 2025 15:15:27 +0000 (17:15 +0200)
commit8ca2fe7e96c0ccf04d32d7002d7a6d9edcb9f8ee
tree657719c9cc4e1b1496ca0363f05f88d521945d9b
parent7a47a51e8ded0bfb3ce2dec2f71d8ba1b9adbe36
resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]

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.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
resolv/Makefile
resolv/tst-getaddrinfo-eai-again-timeout.c [new file with mode: 0644]
resolv/tst-getaddrinfo-eai-again.c [new file with mode: 0644]