[PATCH] resolv: Run tst-getaddrinfo-eai-again in a network namespace

Frederic Berat fberat@redhat.com
Tue Apr 7 08:44:44 GMT 2026


On Tue, Apr 7, 2026 at 8:48 AM Florian Weimer <fweimer@redhat.com> wrote:

> This ensures that the test does not accidentally use a name server
> running on 127.0.0.1.
>
>
This patch fixes the problem I was seeing on dedicated build systems,
therefore:

LGTM.

Tested-by:  Frédéric Bérat <fberat@redhat.com>
Reviewed-by: Frédéric Bérat <fberat@redhat.com>


> ---
>  resolv/tst-getaddrinfo-eai-again.c                                    | 4
> ++++
>  .../tst-getaddrinfo-eai-again.root/tst-getaddrinfo-eai-again.script   | 2
> ++
>  2 files changed, 6 insertions(+)
>
> diff --git a/resolv/tst-getaddrinfo-eai-again.c
> b/resolv/tst-getaddrinfo-eai-again.c
> index f035d694e8..43505818b6 100644
> --- a/resolv/tst-getaddrinfo-eai-again.c
> +++ b/resolv/tst-getaddrinfo-eai-again.c
> @@ -20,6 +20,7 @@
>
>  #include <netdb.h>
>  #include <support/check.h>
> +#include <support/namespace.h>
>
>  /* Query getaddrinfo with various address families and verify that
>     it returns EAI_AGAIN when DNS resolution fails.  */
> @@ -49,6 +50,9 @@ query_host (const char *host_name)
>  static int
>  do_test (void)
>  {
> +  /* Hide any name server that might be running on 127.0.0.1.  */
> +  support_enter_network_namespace ();
> +
>    query_host ("site.example");
>    return 0;
>  }
> diff --git
> a/resolv/tst-getaddrinfo-eai-again.root/tst-getaddrinfo-eai-again.script
> b/resolv/tst-getaddrinfo-eai-again.root/tst-getaddrinfo-eai-again.script
> new file mode 100644
> index 0000000000..383f92b5b0
> --- /dev/null
> +++
> b/resolv/tst-getaddrinfo-eai-again.root/tst-getaddrinfo-eai-again.script
> @@ -0,0 +1,2 @@
> +# Enable entering a network namespace.
> +su
>
> base-commit: 2ff134eb634098ae62ae1ebc02209c88298f0da2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260407/f7a439aa/attachment.htm>


More information about the Libc-alpha mailing list