* [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and tst-nss-files-hosts-multi when there is no IPv6 support
@ 2021-08-10 1:03 Romain GEISSLER
2021-08-11 7:45 ` Siddhesh Poyarekar
0 siblings, 1 reply; 3+ messages in thread
From: Romain GEISSLER @ 2021-08-10 1:03 UTC (permalink / raw)
To: libc-alpha
Hi,
This is an updated version of a patch I posted some years ago already:
https://sourceware.org/pipermail/libc-alpha/2019-July/105107.html
With glibc 2.34, now tst-nss-files-hosts-multi also needs to be updated
as well, as it seems my docker container I use to build/test glibc lacks
proper ipv6 configuration.
I tested this on x86-64.
Cheers,
Romain
From 04f5a832acd7417190d272c10db0c47e55fc3a16 Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@amadeus.com>
Date: Wed, 17 Jul 2019 12:29:21 +0000
Subject: [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and
tst-nss-files-hosts-multi when there is no IPv6 support.
---
nss/tst-nss-files-hosts-long.c | 47 +++++++++++++++++++++++++++------
nss/tst-nss-files-hosts-multi.c | 34 ++++++++++++++++++++++++
2 files changed, 73 insertions(+), 8 deletions(-)
diff --git a/nss/tst-nss-files-hosts-long.c b/nss/tst-nss-files-hosts-long.c
index 00f8bea409e..52f21dc1faf 100644
--- a/nss/tst-nss-files-hosts-long.c
+++ b/nss/tst-nss-files-hosts-long.c
@@ -22,6 +22,31 @@
#include <stdlib.h>
#include <nss.h>
#include <support/check.h>
+#include <ifaddrs.h>
+
+static int
+supports_inet_family(int family)
+{
+ struct ifaddrs *ifaddr, *ifa;
+ int ret = 0;
+
+ if (getifaddrs(&ifaddr) == -1)
+ FAIL_EXIT1("getifaddrs failed");
+
+ for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL)
+ continue;
+
+ if (ifa->ifa_addr->sa_family == family) {
+ ret = 1;
+ break;
+ }
+ }
+
+ freeifaddrs(ifaddr);
+
+ return ret;
+}
static int
do_test (void)
@@ -30,14 +55,20 @@ do_test (void)
/* Run getent to fetch the IPv4 address for host test4.
This forces /etc/hosts to be parsed. */
- ret = system("getent ahostsv4 test4");
- if (ret != 0)
- FAIL_EXIT1("ahostsv4 failed");
-
- /* Likewise for IPv6. */
- ret = system("getent ahostsv6 test6");
- if (ret != 0)
- FAIL_EXIT1("ahostsv6 failed");
+ if (supports_inet_family(AF_INET))
+ {
+ ret = system("getent ahostsv4 test4");
+ if (ret != 0)
+ FAIL_EXIT1("ahostsv4 failed");
+ }
+
+ /* Likewise for IPv6. */
+ if (supports_inet_family(AF_INET6))
+ {
+ ret = system("getent ahostsv6 test6");
+ if (ret != 0)
+ FAIL_EXIT1("ahostsv6 failed");
+ }
exit (0);
}
diff --git a/nss/tst-nss-files-hosts-multi.c b/nss/tst-nss-files-hosts-multi.c
index 87986d95342..8ce6a8c2cec 100644
--- a/nss/tst-nss-files-hosts-multi.c
+++ b/nss/tst-nss-files-hosts-multi.c
@@ -19,6 +19,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <gnu/lib-names.h>
+#include <ifaddrs.h>
#include <netdb.h>
#include <nss.h>
#include <stdbool.h>
@@ -37,6 +38,30 @@
struct support_chroot *chroot_env;
+static int
+supports_inet_family(int family)
+{
+ struct ifaddrs *ifaddr, *ifa;
+ int ret = 0;
+
+ if (getifaddrs(&ifaddr) == -1)
+ FAIL_EXIT1("getifaddrs failed");
+
+ for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL)
+ continue;
+
+ if (ifa->ifa_addr->sa_family == family) {
+ ret = 1;
+ break;
+ }
+ }
+
+ freeifaddrs(ifaddr);
+
+ return ret;
+}
+
static void
prepare (int argc, char **argv)
{
@@ -204,6 +229,15 @@ run_gbhn_gai (struct test_params *params)
if (test_verbose > 0)
printf ("info: %s\n", ctx);
+ if (!supports_inet_family(params->family))
+ {
+ printf("Test %s is not supported, skipping this inet family", ctx);
+ free (ctx);
+
+ return;
+ }
+
+
/* Check gethostbyname, gethostbyname2. */
if (params->family == AF_INET)
{
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and tst-nss-files-hosts-multi when there is no IPv6 support
2021-08-10 1:03 [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and tst-nss-files-hosts-multi when there is no IPv6 support Romain GEISSLER
@ 2021-08-11 7:45 ` Siddhesh Poyarekar
2021-08-11 8:04 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-11 7:45 UTC (permalink / raw)
To: Romain GEISSLER, libc-alpha
On 8/10/21 6:33 AM, Romain GEISSLER via Libc-alpha wrote:
> Hi,
>
> This is an updated version of a patch I posted some years ago already:
> https://sourceware.org/pipermail/libc-alpha/2019-July/105107.html
>
> With glibc 2.34, now tst-nss-files-hosts-multi also needs to be updated
> as well, as it seems my docker container I use to build/test glibc lacks
> proper ipv6 configuration.
>
> I tested this on x86-64.
Looks like it's regressing i686.
https://patchwork.sourceware.org/project/glibc/patch/20210810010331.GA51141@ncerndobedev6097.etv.nce.amadeus.net/
https://www.delorie.com/trybots/32bit/2629/regressions.txt
Siddhesh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and tst-nss-files-hosts-multi when there is no IPv6 support
2021-08-11 7:45 ` Siddhesh Poyarekar
@ 2021-08-11 8:04 ` Florian Weimer
0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2021-08-11 8:04 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: Romain GEISSLER, libc-alpha
* Siddhesh Poyarekar:
> On 8/10/21 6:33 AM, Romain GEISSLER via Libc-alpha wrote:
>> Hi,
>> This is an updated version of a patch I posted some years ago
>> already:
>> https://sourceware.org/pipermail/libc-alpha/2019-July/105107.html
>> With glibc 2.34, now tst-nss-files-hosts-multi also needs to be
>> updated
>> as well, as it seems my docker container I use to build/test glibc lacks
>> proper ipv6 configuration.
>> I tested this on x86-64.
>
> Looks like it's regressing i686.
>
> https://patchwork.sourceware.org/project/glibc/patch/20210810010331.GA51141@ncerndobedev6097.etv.nce.amadeus.net/
> https://www.delorie.com/trybots/32bit/2629/regressions.txt
It's a test timeout:
<https://www.delorie.com/trybots/32bit/2629/misc-tst-bz21269.out>
I expected those happened before.
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-11 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 1:03 [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long and tst-nss-files-hosts-multi when there is no IPv6 support Romain GEISSLER
2021-08-11 7:45 ` Siddhesh Poyarekar
2021-08-11 8:04 ` Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).