about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-11-27 06:31:04 +0000
committerUlrich Drepper <drepper@redhat.com>2008-11-27 06:31:04 +0000
commitbe4607eba89e85e3fd825e97e203f02cc3f31688 (patch)
tree3a02f22c0e7e8d9dfd094cbb28dbe8a5f4990ae5
parentca4dc0fe64c2087b78c52ff9b93ecca669d56164 (diff)
downloadglibc-be4607eba89e85e3fd825e97e203f02cc3f31688.tar.gz
glibc-be4607eba89e85e3fd825e97e203f02cc3f31688.tar.xz
glibc-be4607eba89e85e3fd825e97e203f02cc3f31688.zip
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Only restrict search
	to IPv4 or IPv6 if an interface has been found.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/posix/getaddrinfo.c8
2 files changed, 3 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b0ac9351e..4a6fc004d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2008-11-26  Ulrich Drepper  <drepper@redhat.com>
 
-	* sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has
-	neither IPv4 nor IPv6 addresses defined, don't do anything.
+	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Only restrict search
+	to IPv4 or IPv6 if an interface has been found.
 
 2008-11-26  Roland McGrath  <roland@redhat.com>
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index b52c371c81..72fbdb0f01 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2108,13 +2108,8 @@ getaddrinfo (const char *name, const char *service,
 	{
 	  /* If we haven't seen both IPv4 and IPv6 interfaces we can
 	     narrow down the search.  */
-	  if (! seen_ipv4 || ! seen_ipv6)
+	  if ((! seen_ipv4 || ! seen_ipv6) && (seen_ipv4 || seen_ipv6))
 	    {
-	      if (! seen_ipv4 && ! seen_ipv6)
-		/* Neither IPv4 nor IPv6 interfaces exist, nothing to
-		   return.  */
-		goto err_noname;
-
 	      local_hints = *hints;
 	      local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6;
 	      hints = &local_hints;
@@ -2124,7 +2119,6 @@ getaddrinfo (const char *name, const char *service,
 	       || (hints->ai_family == PF_INET6 && ! seen_ipv6))
 	{
 	  /* We cannot possibly return a valid answer.  */
-	err_noname:
 	  free (in6ai);
 	  return EAI_NONAME;
 	}