apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/network_io/unix sockaddr.c
Date Fri, 21 May 2004 22:10:51 GMT
trawick     2004/05/21 15:10:51

  Modified:    .        Tag: APR_0_9_BRANCH CHANGES configure.in
               build    Tag: APR_0_9_BRANCH apr_network.m4
               network_io/unix Tag: APR_0_9_BRANCH sockaddr.c
  Log:
  backport this from 1.0-dev
  
    Don't assume getnameinfo() can handle IPv4-mapped IPv6 addresses
    on any platforms.
  
  Submitted by: Jeff Trawick, Joe Orton, Colm MacCárthaigh <colm stdlib.net>
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.426.2.20 +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.426.2.19
  retrieving revision 1.426.2.20
  diff -u -r1.426.2.19 -r1.426.2.20
  --- CHANGES	5 May 2004 02:57:41 -0000	1.426.2.19
  +++ CHANGES	21 May 2004 22:10:50 -0000	1.426.2.20
  @@ -1,5 +1,9 @@
   Changes with APR 0.9.5
   
  +  *) Don't assume getnameinfo() can handle IPv4-mapped IPv6 addresses
  +     on any platforms.
  +     [Jeff Trawick, Joe Orton, Colm MacCárthaigh <colm stdlib.net>]
  +
     *) Support setuid, setgid and sticky file permissions bits on Unix.
        [André Malo]
   
  
  
  
  1.535.2.9 +0 -1      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.535.2.8
  retrieving revision 1.535.2.9
  diff -u -r1.535.2.8 -r1.535.2.9
  --- configure.in	16 Apr 2004 17:12:40 -0000	1.535.2.8
  +++ configure.in	21 May 2004 22:10:50 -0000	1.535.2.9
  @@ -1841,7 +1841,6 @@
           if test "x$have_sockaddr_in6" = "x1"; then
               if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
                   if test "x$ac_cv_working_getnameinfo" = "xyes"; then
  -                    APR_CHECK_GETNAMEINFO_IPV4_MAPPED
                       have_ipv6="1"
                       ipv6_result="yes"
                   else
  
  
  
  No                   revision
  No                   revision
  1.23.2.3  +0 -74     apr/build/apr_network.m4
  
  Index: apr_network.m4
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_network.m4,v
  retrieving revision 1.23.2.2
  retrieving revision 1.23.2.3
  diff -u -r1.23.2.2 -r1.23.2.3
  --- apr_network.m4	6 Mar 2004 18:29:20 -0000	1.23.2.2
  +++ apr_network.m4	21 May 2004 22:10:51 -0000	1.23.2.3
  @@ -141,80 +141,6 @@
   ])
   
   dnl
  -dnl check for getnameinfo() that properly resolves IPv4-mapped IPv6 addresses
  -dnl
  -dnl Darwin is known not to map them correctly
  -dnl
  -AC_DEFUN(APR_CHECK_GETNAMEINFO_IPV4_MAPPED,[
  -  AC_CACHE_CHECK(whether getnameinfo resolves IPv4-mapped IPv6 addresses,
  -                 ac_cv_getnameinfo_ipv4_mapped,[
  -  AC_TRY_RUN( [
  -#ifdef HAVE_NETDB_H
  -#include <netdb.h>
  -#endif
  -#ifdef HAVE_STRING_H
  -#include <string.h>
  -#endif
  -#ifdef HAVE_SYS_TYPES_H
  -#include <sys/types.h>
  -#endif
  -#ifdef HAVE_SYS_SOCKET_H
  -#include <sys/socket.h>
  -#endif
  -#ifdef HAVE_NETINET_IN_H
  -#include <netinet/in.h>
  -#endif
  -#ifdef HAVE_ARPA_INET_H
  -#include <arpa/inet.h>
  -#endif
  -
  -void main(void) {
  -    struct sockaddr_in6 sa = {0};
  -    struct in_addr ipv4;
  -#if defined(NI_MAXHOST)
  -    char hbuf[NI_MAXHOST];
  -#else
  -    char hbuf[256];
  -#endif
  -    unsigned int *addr32;
  -    int error;
  -
  -    ipv4.s_addr = inet_addr("127.0.0.1");
  -
  -    sa.sin6_family = AF_INET6;
  -    sa.sin6_port = 0;
  -
  -    addr32 = (unsigned int *)&sa.sin6_addr;
  -    addr32[2] = htonl(0x0000FFFF);
  -    addr32[3] = ipv4.s_addr;
  -
  -#ifdef SIN6_LEN
  -    sa.sin6_len = sizeof(sa);
  -#endif
  -
  -    error = getnameinfo((const struct sockaddr *)&sa, sizeof(sa),
  -                        hbuf, sizeof(hbuf), NULL, 0,
  -                        NI_NAMEREQD);
  -    if (error) {
  -        exit(1);
  -    } else {
  -        exit(0);
  -    }
  -}
  -],[
  -  ac_cv_getnameinfo_ipv4_mapped="yes"
  -],[
  -  ac_cv_getnameinfo_ipv4_mapped="no"
  -],[
  -  ac_cv_getnameinfo_ipv4_mapped="yes"
  -])])
  -if test "$ac_cv_getnameinfo_ipv4_mapped" = "no"; then
  -  AC_DEFINE(GETNAMEINFO_IPV4_MAPPED_FAILS, 1,
  -            [Define if getnameinfo does not map IPv4 address correctly])
  -fi
  -])
  -
  -dnl
   dnl check for presence of  retrans/retry variables in the res_state structure
   dnl
   AC_DEFUN(APR_CHECK_RESOLV_RETRANS,[
  
  
  
  No                   revision
  No                   revision
  1.43.2.5  +3 -4      apr/network_io/unix/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v
  retrieving revision 1.43.2.4
  retrieving revision 1.43.2.5
  diff -u -r1.43.2.4 -r1.43.2.5
  --- sockaddr.c	6 Mar 2004 18:13:11 -0000	1.43.2.4
  +++ sockaddr.c	21 May 2004 22:10:51 -0000	1.43.2.5
  @@ -603,11 +603,10 @@
        * a numeric address string if it fails to resolve the host name;
        * that is *not* what we want here
        *
  -     * Additionally, if we know getnameinfo() doesn't handle IPv4-mapped
  -     * IPv6 addresses correctly, drop down to IPv4 before calling
  -     * getnameinfo().
  +     * For IPv4-mapped IPv6 addresses, drop down to IPv4 before calling
  +     * getnameinfo() to avoid getnameinfo bugs (MacOS X, glibc).
        */
  -#ifdef GETNAMEINFO_IPV4_MAPPED_FAILS
  +#if APR_HAVE_IPV6
       if (sockaddr->family == AF_INET6 &&
           IN6_IS_ADDR_V4MAPPED(&sockaddr->sa.sin6.sin6_addr)) {
           struct apr_sockaddr_t tmpsa;
  
  
  

Mime
View raw message