Michael Sweet wrote:
> Sigfred Håversen wrote:
>
>> ...
>> The IPV6_V6ONLY socket option will not solve this on OpenBSD,
>> as may be seen from ip6(4):
>> ...
>> This is due to security concerns:
>
> > ...
>
> Too bad, since on AIX, HP-UX, IRIX, MacOS X, Solaris, and Linux you
> can't bind to [:::] and 0.0.0.0 on the same port - you'll get an
> "address already in use" error...
>
> In any case, adding the --ipv4-only switch will fix things for
> OpenBSD users. To support both IPv4 and IPv6, they'll just have to
> run two copies of svnserve (assuming they don't get the same error
> as on all those other OS's I mentioned...)
>
Attached a patch for the --ipv4-only variant. On OpenBSD
you can run two copies of svnserve, one for IPv4 and one for IPv6.
/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_IPV4_ONLY 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)")},
+ {"ipv4-only", SVNSERVE_OPT_IPV4_ONLY, 0, N_("use IPv4 only")},
{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_ipv4_only = 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_IPV4_ONLY:
+ use_ipv4_only = TRUE;
+ break;
}
}
if (os->ind != argc)
@@ -407,18 +414,21 @@
create IPV6 sockets. */
#if APR_HAVE_IPV6
+if (!use_ipv4_only)
+ {
#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 Fri Sep 23 08:19:07 2005