[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Regression in svnserve: IPv6 causes IPv4 not to work [was: Branching for 1.3.]

From: Sigfred Hĺversen <bsdlist_at_mumak.com>
Date: 2005-09-22 11:23:18 CEST

Julian Foad wrote:
[snip]
>> What I suggest is that svnserve listen on IPv4 by default, but an --ipv6
>> option gives the user the behaviour svnserve currently has.
>
>
> Well, that might be a solution if no automatic solution can be implemented.

Jim Morris noted this on OpenBSD in May for Subversion 1.2.0:

http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=100686

My attached patch differs from his that users must explicitely
enable IPv6 if they want svnserve to listen on an IPv6 socket. It passes
the svncheck and svncheck6 (using --ipv6) on OpenBSD/i386 -current.

Existing IPv6 users of svnserve have to add --ipv6 as option to
svnserve, so for them this patch is a regression.

> Sigfred, I cannot understand what you mean to say in the whole message
> that I quote below here. Could you say it in a different way?

Various platforms has different level of support for IPv6, as may be
seen in posts to dev@. A fix for one OS may very well result in
broken code on another OS.

It has been suggested it may be an apr issue, or the way apr is used.
As far as I know, the approved version is still 0.95.5, but the package
maintainers are likely to use already installed apr/apr-util instead
of the one in the subversion tarball. The version of installed apr will
differ from OS to OS.

I want to avoid creating new issues by making a fix to svnserve that
depends on which version of apr is used, or just happens to work on my OS
of choice.

My patch seems safe in this regard.

/Sigfred

Index: subversion/svnserve/main.c
===================================================================
--- subversion/svnserve/main.c (revision 16192)
+++ subversion/svnserve/main.c (working copy)
@@ -96,6 +96,7 @@
 #define SVNSERVE_OPT_FOREGROUND 258
 #define SVNSERVE_OPT_TUNNEL_USER 259
 #define SVNSERVE_OPT_VERSION 260
+#define SVNSERVE_OPT_IPV6 261
 
 static const apr_getopt_option_t svnserve__options[] =
   {
@@ -119,6 +120,7 @@
     {"threads", 'T', 0, N_("use threads instead of fork")},
 #endif
     {"listen-once", 'X', 0, N_("listen once (useful for debugging)")},
+ {"ipv6", SVNSERVE_OPT_IPV6, 0, N_("use IPv6")},
     {0, 0, 0, 0}
   };
 
@@ -257,6 +259,7 @@
   const char *host = NULL;
   int family = APR_INET;
   int mode_opt_count = 0;
+ svn_boolean_t use_ipv6 = FALSE;
 
   /* Initialize the app. */
   if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS)
@@ -368,6 +371,10 @@
         case 'T':
           handling_mode = connection_mode_thread;
           break;
+
+ case SVNSERVE_OPT_IPV6:
+ use_ipv6 = TRUE;
+ break;
         }
     }
   if (os->ind != argc)
@@ -407,18 +414,21 @@
      create IPV6 sockets. */
 
 #if APR_HAVE_IPV6
+if (use_ipv6)
+ {
 #ifdef MAX_SECS_TO_LINGER
- /* ### old APR interface */
- status = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, pool);
+ /* ### 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,
+ status = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, APR_PROTO_TCP,
                              pool);
 #endif
- if (status == 0)
- {
- apr_socket_close(sock);
- family = APR_UNSPEC;
- }
+ if (status == 0)
+ {
+ apr_socket_close(sock);
+ family = APR_UNSPEC;
+ }
+ }
 #endif
   
   status = apr_sockaddr_info_get(&sa, host, family, port, 0, pool);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 22 11:24:17 2005

This is an archived mail posted to the Subversion Dev mailing list.