This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.25-690-g9f5a127
- From: fw at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Jul 2017 21:04:22 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.25-690-g9f5a127
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 9f5a1271315b0e7c7828f2d8077ab33dca3ee8bd (commit)
from d5c3fafc4307c9b7a4c7d5cb381fcdbfad340bcc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9f5a1271315b0e7c7828f2d8077ab33dca3ee8bd
commit 9f5a1271315b0e7c7828f2d8077ab33dca3ee8bd
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Jul 6 14:03:39 2017 +0200
resolv: Deal with non-deterministic address order in tst-resolv-basic
diff --git a/ChangeLog b/ChangeLog
index 1c51b3b..0a4d616 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-06 Florian Weimer <fw@deneb.enyo.de>
+
+ * resolv/tst-resolv-basic.c (test_bug_21295): New function.
+ (do_test): Call it.
+
2017-07-06 DJ Delorie <dj@delorie.com>
* config.make.in: Enable experimental malloc option.
diff --git a/resolv/tst-resolv-basic.c b/resolv/tst-resolv-basic.c
index 3dfa165..64eedbb 100644
--- a/resolv/tst-resolv-basic.c
+++ b/resolv/tst-resolv-basic.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <support/check.h>
#include <support/check_nss.h>
+#include <support/format_nss.h>
#include <support/resolv_test.h>
#include <support/support.h>
@@ -204,6 +205,68 @@ check_ai (const char *name, const char *service,
expected);
}
+/* Test for bug 21295: getaddrinfo used to discard address information
+ instead of merging it. */
+static void
+test_bug_21295 (void)
+{
+ /* The address order is unpredictable. There are two factors which
+ contribute to that: The stub resolver does not perform proper
+ response matching for A/AAAA queries (an A response could be
+ associated with an AAAA query and vice versa), and without
+ namespaces, system configuration could affect address
+ ordering. */
+ for (int do_tcp = 0; do_tcp < 2; ++do_tcp)
+ {
+ const struct addrinfo hints =
+ {
+ .ai_family = AF_INET6,
+ .ai_socktype = SOCK_STREAM,
+ .ai_flags = AI_V4MAPPED | AI_ALL,
+ };
+ const char *qname;
+ if (do_tcp)
+ qname = "t.www.example";
+ else
+ qname = "www.example";
+ struct addrinfo *ai = NULL;
+ int ret = getaddrinfo (qname, "80", &hints, &ai);
+ TEST_VERIFY_EXIT (ret == 0);
+
+ const char *expected_a;
+ const char *expected_b;
+ if (do_tcp)
+ {
+ expected_a = "flags: AI_V4MAPPED AI_ALL\n"
+ "address: STREAM/TCP 2001:db8::3 80\n"
+ "address: STREAM/TCP ::ffff:192.0.2.19 80\n";
+ expected_b = "flags: AI_V4MAPPED AI_ALL\n"
+ "address: STREAM/TCP ::ffff:192.0.2.19 80\n"
+ "address: STREAM/TCP 2001:db8::3 80\n";
+ }
+ else
+ {
+ expected_a = "flags: AI_V4MAPPED AI_ALL\n"
+ "address: STREAM/TCP 2001:db8::1 80\n"
+ "address: STREAM/TCP ::ffff:192.0.2.17 80\n";
+ expected_b = "flags: AI_V4MAPPED AI_ALL\n"
+ "address: STREAM/TCP ::ffff:192.0.2.17 80\n"
+ "address: STREAM/TCP 2001:db8::1 80\n";
+ }
+
+ char *actual = support_format_addrinfo (ai, ret);
+ if (!(strcmp (actual, expected_a) == 0
+ || strcmp (actual, expected_b) == 0))
+ {
+ support_record_failure ();
+ printf ("error: %s: unexpected response (TCP: %d):\n%s\n",
+ __func__, do_tcp, actual);
+ }
+ free (actual);
+ freeaddrinfo (ai);
+ }
+}
+
static int
do_test (void)
{
@@ -398,21 +461,7 @@ do_test (void)
check_ai ("t.nxdomain.example", "80", AF_INET6,
"error: Name or service not known\n");
- /* Test for bug 21295. */
- check_ai_hints ("www.example", "80",
- (struct addrinfo) { .ai_family = AF_INET6,
- .ai_socktype = SOCK_STREAM,
- .ai_flags = AI_V4MAPPED | AI_ALL, },
- "flags: AI_V4MAPPED AI_ALL\n"
- "address: STREAM/TCP 2001:db8::1 80\n"
- "address: STREAM/TCP ::ffff:192.0.2.17 80\n");
- check_ai_hints ("t.www.example", "80",
- (struct addrinfo) { .ai_family = AF_INET6,
- .ai_socktype = SOCK_STREAM,
- .ai_flags = AI_V4MAPPED | AI_ALL, },
- "flags: AI_V4MAPPED AI_ALL\n"
- "address: STREAM/TCP 2001:db8::3 80\n"
- "address: STREAM/TCP ::ffff:192.0.2.19 80\n");
+ test_bug_21295 ();
resolv_test_end (aux);
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++
resolv/tst-resolv-basic.c | 79 ++++++++++++++++++++++++++++++++++++--------
2 files changed, 69 insertions(+), 15 deletions(-)
hooks/post-receive
--
GNU C Library master sources