]> sourceware.org Git - glibc.git/commitdiff
Avoid __check_pf calls in getaddrinfo unless really needed
authorUlrich Drepper <drepper@gmail.com>
Wed, 22 Jun 2011 19:00:54 +0000 (15:00 -0400)
committerUlrich Drepper <drepper@gmail.com>
Wed, 22 Jun 2011 19:00:54 +0000 (15:00 -0400)
ChangeLog
NEWS
sysdeps/posix/getaddrinfo.c

index 33b7703ee008806cce79a67f577142cb3180334e..ad7303f886d84ae216530864d21f4bea7537a8c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-22  Ulrich Drepper  <drepper@gmail.com>
+
+       [BZ #12907]
+       * sysdeps/posix/getaddrinfo.c (getaddrinfo): Avoid calling __check_pf
+       until it is clear that the information is realy needed.
+       Patch mostly by David Hanisch <david.hanisch@nsn.com>.
+
 2011-06-22  Andreas Schwab  <schwab@redhat.com>
 
        * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix last change.
diff --git a/NEWS b/NEWS
index 9e6832c1675f2b8d1dc7cdfd2446da7b00501180..5a7ffc2f3f0036c80c4165bd2cdf15a470406de0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-6-21
+GNU C Library NEWS -- history of user-visible changes.  2011-6-22
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,7 +9,7 @@ Version 2.15
 
 * The following bugs are resolved with this release:
 
-  12885
+  12885, 12907
 
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.
index 14e9270b1b8133243e331798f3022ef83454de8a..05c883d850f93e24127b56b80a32d01b74c857d4 100644 (file)
@@ -2352,14 +2352,17 @@ getaddrinfo (const char *name, const char *service,
   size_t in6ailen = 0;
   bool seen_ipv4 = false;
   bool seen_ipv6 = false;
-  /* We might need information about what interfaces are available.
-     Also determine whether we have IPv4 or IPv6 interfaces or both.  We
-     cannot cache the results since new interfaces could be added at
-     any time.  */
-  __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+  bool check_pf_called = false;
 
   if (hints->ai_flags & AI_ADDRCONFIG)
     {
+      /* We might need information about what interfaces are available.
+        Also determine whether we have IPv4 or IPv6 interfaces or both.  We
+        cannot cache the results since new interfaces could be added at
+        any time.  */
+      __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+      check_pf_called = true;
+
       /* Now make a decision on what we return, if anything.  */
       if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
        {
@@ -2441,6 +2444,10 @@ getaddrinfo (const char *name, const char *service,
       struct addrinfo *last = NULL;
       char *canonname = NULL;
 
+      /* Now we definitely need the interface information.  */
+      if (! check_pf_called)
+       __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+
       /* If we have information about deprecated and temporary addresses
         sort the array now.  */
       if (in6ai != NULL)
This page took 0.048646 seconds and 5 git commands to generate.