[PATCH] resolv: Add test for getaddrinfo returning EAI_AGAIN on DNS failure

Florian Weimer fweimer@redhat.com
Wed Sep 17 09:23:37 GMT 2025


* Sergey Kolosov:

> Test for BZ #16849. This test verifies that getaddrinfo correctly
> returns the EAI_AGAIN error code when DNS queries fail due to a network
> failure. The test queries with AF_INET, AF_INET6, AF_UNSPEC address
> families and expects getaddrinfo to return EAI_AGAIN in each case.

Note that this test simulates a network failure by responding with a
zero-length packet.

You could create another test variant that calls

  resolv_response_drop (b);

to suppress sending a response.  This will result in timeouts, so the
test will likely run quite slowly.  But it's closer to how network
errors might manifest.

Looks like we currently do not have timeout tests like this, only tests
for unexpected timeouts.  If the timeout testing results in large
delays, we can reduce the timeouts or server counts to make it more
manageable.

Thanks,
Florian



More information about the Libc-alpha mailing list