Index: subversion/libsvn_ra_svn/client.c =================================================================== --- subversion/libsvn_ra_svn/client.c (revision 13261) +++ subversion/libsvn_ra_svn/client.c (working copy) @@ -93,15 +93,41 @@ url = p; } } +static int ipv6_supported = APR_HAVE_IPV6; +static int ipv6_checked = 0; static svn_error_t *make_connection(const char *hostname, unsigned short port, apr_socket_t **sock, apr_pool_t *pool) { apr_sockaddr_t *sa; apr_status_t status; - + int family = APR_INET; + apr_socket_t *socket; + +#ifdef APR_HAVE_IPV6 + /* Make sure we support IPV6 before getting ipv6 addresses. */ + if (ipv6_supported && ipv6_checked) + family = APR_UNSPEC; + else if (!ipv6_checked) + { +#ifdef MAX_SECS_TO_LINGER + status = apr_socket_create(&socket, APR_INET6, SOCK_STREAM, pool); +#else + status = apr_socket_create(&socket, APR_INET6, SOCK_STREAM, + APR_PROTO_TCP, pool); +#endif + if (status != 0) + ipv6_supported = 0; + else + { + apr_socket_close (socket); + family = APR_UNSPEC; + } + ipv6_checked = 1; + } +#endif /* Resolve the hostname. */ - status = apr_sockaddr_info_get(&sa, hostname, APR_UNSPEC, port, 0, pool); + status = apr_sockaddr_info_get(&sa, hostname, family, port, 0, pool); if (status) return svn_error_createf(status, NULL, _("Unknown hostname '%s'"), hostname); Index: subversion/svnserve/main.c =================================================================== --- subversion/svnserve/main.c (revision 13261) +++ subversion/svnserve/main.c (working copy) @@ -251,11 +251,15 @@ #if APR_HAS_THREADS apr_threadattr_t *tattr; apr_thread_t *tid; + struct serve_thread_t *thread_data; #endif enum connection_handling_mode handling_mode = CONNECTION_DEFAULT; apr_uint16_t port = SVN_RA_SVN_PORT; const char *host = NULL; + int ipv6_supported = APR_HAVE_IPV6; + int family = APR_INET; + int fd; /* Initialize the app. */ if (svn_cmdline_init2("svn", stderr, TRUE) != EXIT_SUCCESS) @@ -391,8 +395,25 @@ svn_error_clear(serve(conn, ¶ms, pool)); exit(0); } - - status = apr_sockaddr_info_get(&sa, host, APR_UNSPEC, port, 0, pool); + + /* Make sure we have IPV6 support first before giving it UNSPEC. */ +#ifdef APR_HAVE_IPV6 +#ifdef MAX_SECS_TO_LINGER + /* ### old APR interface */ + status = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, pool); +#else + status = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, APR_PROTO_TCP, + pool); +#endif + if (status != 0) + ipv6_supported = 0; + else + apr_socket_close (sock); +#endif + if (ipv6_supported) + family = APR_UNSPEC; + + status = apr_sockaddr_info_get(&sa, host, family, port, 0, pool); if (status) { fprintf(stderr, "Can't get address info: %s\n",