This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.14-34-gc0244a9


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  c0244a9dedce43a4b950d91451b16a7cf5408476 (commit)
       via  c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862 (commit)
      from  b36b153d5deb8fad8490b2544d416b24c9be922d (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://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c0244a9dedce43a4b950d91451b16a7cf5408476

commit c0244a9dedce43a4b950d91451b16a7cf5408476
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Tue Jun 21 17:03:38 2011 -0400

    Fix IPv6-only lookups through getaddrinfo
    
    A recent patch introduced a problem where IPv6 lookups happily returned
    IPv4 addresses.

diff --git a/ChangeLog b/ChangeLog
index 19807a9..abc4894 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-06-21  Ulrich Drepper  <drepper@gmail.com>
 
+	[BZ #12885]
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): When looking up only IPv6
+	addresses using gethostbyname4_r ignore IPv4 addresses.
+
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): After the last change the
 	branch using gethostbyname2 is only for AF_INET.  Optimize accordingly.
 
diff --git a/NEWS b/NEWS
index dd00b7b..9e6832c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-6-15
+GNU C Library NEWS -- history of user-visible changes.  2011-6-21
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -7,6 +7,10 @@ using `glibc' in the "product" field.
 
 Version 2.15
 
+* The following bugs are resolved with this release:
+
+  12885
+
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index d68ac83..3a2737e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -871,16 +871,44 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			}
 		    }
 
-		  no_inet6_data = no_data;
-
 		  if (status == NSS_STATUS_SUCCESS)
 		    {
+		      assert (!no_data);
+		      no_data = 1;
+
 		      if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
 			canon = (*pat)->name;
 
 		      while (*pat != NULL)
-			pat = &((*pat)->next);
+			{
+			  if ((*pat)->family == AF_INET
+			      && req->ai_family == AF_INET6
+			      && (req->ai_flags & AI_V4MAPPED) != 0)
+			    {
+			      uint32_t *pataddr = (*pat)->addr;
+			      (*pat)->family = AF_INET6;
+			      pataddr[3] = pataddr[0];
+			      pataddr[2] = htonl (0xffff);
+			      pataddr[1] = 0;
+			      pataddr[0] = 0;
+			      pat = &((*pat)->next);
+			      no_data = 0;
+			    }
+			  else if ((*pat)->family == AF_UNSPEC
+				   || (*pat)->family == req->ai_family)
+			    {
+			      pat = &((*pat)->next);
+
+			      no_data = 0;
+			      if (req->ai_family == AF_INET6)
+				got_ipv6 = true;
+			    }
+			  else
+			    *pat = ((*pat)->next);
+			}
 		    }
+
+		  no_inet6_data = no_data;
 		}
 	      else
 		{

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862

commit c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Tue Jun 21 13:06:42 2011 -0400

    Minor optimization of getaddrinfo after recent patch

diff --git a/ChangeLog b/ChangeLog
index 270559e..19807a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-06-21  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): After the last change the
+	branch using gethostbyname2 is only for AF_INET.  Optimize accordingly.
+
 	* inet/getnetgrent_r.c: Use DL_CALL_FCT in several places.
 
 2011-06-20  David S. Miller  <davem@davemloft.net>
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 469abe2..d68ac83 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -565,7 +565,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	     IPv6 scope ids. */
 	  if (req->ai_family == AF_INET)
 	    {
-	      int family = req->ai_family;
 	      size_t tmpbuflen = 512;
 	      assert (tmpbuf == NULL);
 	      tmpbuf = alloca_account (tmpbuflen, alloca_used);
@@ -576,7 +575,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	      while (1)
 		{
-		  rc = __gethostbyname2_r (name, family, &th, tmpbuf,
+		  rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
 					   tmpbuflen, &h, &herrno);
 		  if (rc != ERANGE || herrno != NETDB_INTERNAL)
 		    break;
@@ -638,18 +637,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			      (*pat)->scopeid = 0;
 			    }
 			  (*pat)->next = NULL;
-			  (*pat)->family = req->ai_family;
-			  if (family == req->ai_family)
-			    memcpy ((*pat)->addr, h->h_addr_list[i],
-				    h->h_length);
-			  else
-			    {
-			      uint32_t *addr = (uint32_t *) (*pat)->addr;
-			      addr[3] = *(uint32_t *) h->h_addr_list[i];
-			      addr[2] = htonl (0xffff);
-			      addr[1] = 0;
-			      addr[0] = 0;
-			    }
+			  (*pat)->family = AF_INET;
+			  memcpy ((*pat)->addr, h->h_addr_list[i],
+				  h->h_length);
 			  pat = &((*pat)->next);
 			}
 		    }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    7 +++++
 NEWS                        |    6 ++++-
 sysdeps/posix/getaddrinfo.c |   52 +++++++++++++++++++++++++++++--------------
 3 files changed, 47 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]