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.18-324-g894f3f1


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  894f3f1049135dcbeaab8f18690973663ef3147c (commit)
      from  b85545a67110b236676aec8000f52d8385465660 (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=894f3f1049135dcbeaab8f18690973663ef3147c

commit 894f3f1049135dcbeaab8f18690973663ef3147c
Author: Allan McRae <allan@archlinux.org>
Date:   Fri Oct 25 14:25:38 2013 +1000

    Fix incorrect getaddrinfo assertion trigger
    
    [BZ #9954]
    
    With the following /etc/hosts:
    127.0.0.1       www.my-domain.es
    127.0.1.1       www.my-domain.es
    192.168.0.1     www.my-domain.es
    
    Using getaddrinfo() on www.my-domain.es, trigger the following assertion:
    ../sysdeps/posix/getaddrinfo.c:1473: rfc3484_sort: Assertion
    `src->results[i].native == -1 || src->results[i].native == a1_native' failed.
    
    This is due to two different bugs:
    - In rfc3484_sort() rule 7, src->results[i].native is assigned even if
    src->results[i].index is -1, meaning that no interface is associated.
    - In getaddrinfo() the source IP address used with the lo interface needs a
    special case, as it can be any IP within 127.X.Y.Z.

diff --git a/ChangeLog b/ChangeLog
index aa01fa7..85cc5da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-10-25  Aurelien Jarno  <aurelien@aurel32.net>
+
+	[BZ #9954]
+	* sysdeps/posix/getaddrinfo.c (rfc3484_sort): do not assign native
+	result if the result has no associated interface.
+	* sysdeps/posix/getaddrinfo.c (getaddrinfo): correctly detect
+	interface for all 127.X.Y.Z addresses.
+
 2013-10-24  Chris Leonard  <cjl@sugarlabs.org>
 
 	* locale/iso-639.def: Add Ligurian (lij)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 0f4b885..e6ce4cf 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1666,13 +1666,13 @@ rfc3484_sort (const void *p1, const void *p2, void *arg)
 
 	      /* Fill in the results in all the records.  */
 	      for (int i = 0; i < src->nresults; ++i)
-		if (src->results[i].index == a1_index)
+		if (a1_index != -1 && src->results[i].index == a1_index)
 		  {
 		    assert (src->results[i].native == -1
 			    || src->results[i].native == a1_native);
 		    src->results[i].native = a1_native;
 		  }
-		else if (src->results[i].index == a2_index)
+		else if (a2_index != -1 && src->results[i].index == a2_index)
 		  {
 		    assert (src->results[i].native == -1
 			    || src->results[i].native == a2_native);
@@ -2532,7 +2532,14 @@ getaddrinfo (const char *name, const char *service,
 			  tmp.addr[0] = 0;
 			  tmp.addr[1] = 0;
 			  tmp.addr[2] = htonl (0xffff);
-			  tmp.addr[3] = sinp->sin_addr.s_addr;
+			  /* Special case for lo interface, the source address
+			     being possibly different than the interface
+			     address. */
+			  if ((ntohl(sinp->sin_addr.s_addr) & 0xff000000)
+			      == 0x7f000000)
+			    tmp.addr[3] = htonl(0x7f000001);
+			  else
+			    tmp.addr[3] = sinp->sin_addr.s_addr;
 			}
 		      else
 			{

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

Summary of changes:
 ChangeLog                   |    8 ++++++++
 sysdeps/posix/getaddrinfo.c |   13 ++++++++++---
 2 files changed, 18 insertions(+), 3 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]