apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/network_io/unix sockaddr.c
Date Thu, 17 Jul 2003 14:27:39 GMT
jorton      2003/07/17 07:27:39

  Modified:    network_io/unix sockaddr.c
  Log:
  Use AI_ADDRCONFIG flag by default, where available.
  
  * sockaddr.c (call_resolver): For lookups of AF_UNSPEC addresses, set
  the AI_ADDRCONFIG flag; retry without the flag if getaddrinfo returns
  EAI_BADFLAGS.
  
  Revision  Changes    Path
  1.38      +15 -0     apr/network_io/unix/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -u -r1.37 -r1.38
  --- sockaddr.c	16 Feb 2003 10:10:20 -0000	1.37
  +++ sockaddr.c	17 Jul 2003 14:27:39 -0000	1.38
  @@ -373,7 +373,22 @@
       memset(&hints, 0, sizeof(hints));
       hints.ai_family = family;
       hints.ai_socktype = SOCK_STREAM;
  +#ifdef AI_ADDRCONFIG
  +    if (family == AF_UNSPEC) {
  +        /* By default, only look up addresses using address types for
  +         * which a local interface is configured, i.e. no IPv6 if no
  +         * IPv6 interfaces configured. */
  +        hints.ai_flags = AI_ADDRCONFIG;
  +    }
  +#endif
       error = getaddrinfo(hostname, NULL, &hints, &ai_list);
  +#ifdef AI_ADDRCONFIG
  +    if (error == EAI_BADFLAGS && family == AF_UNSPEC) {
  +        /* Retry with no flags if AI_ADDRCONFIG was rejected. */
  +        hints.ai_flags = 0;
  +        error = getaddrinfo(hostname, NULL, &hints, &ai_list);
  +    }
  +#endif
       if (error) {
   #ifndef WIN32
           if (error == EAI_SYSTEM) {
  
  
  

Mime
View raw message