You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2002/11/14 15:17:11 UTC
cvs commit: httpd-2.0/server listen.c
trawick 2002/11/14 06:17:11
Modified: . CHANGES acinclude.m4 configure.in
docs/conf httpd-std.conf.in ssl-std.conf
server listen.c
Log:
Add --[enable|disable]-v4-mapped configure option to control
whether or not Apache expects to handle IPv4 connections
on IPv6 listening sockets. Either setting will work on
systems with the IPV6_V6ONLY socket option. --enable-v4-mapped
must be used on systems that always allow IPv4 connections on
IPv6 listening sockets.
Note: As the ssl config file is not automatically generated and
it is expected to require editing anyway to work, the only
change there was to suggest the required Listen statements
in a comment.
PR: PR 14037 (Bugzilla), PR 7492 (Gnats), various dups of these PRs
Revision Changes Path
1.981 +8 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.980
retrieving revision 1.981
diff -u -r1.980 -r1.981
--- CHANGES 14 Nov 2002 02:04:00 -0000 1.980
+++ CHANGES 14 Nov 2002 14:17:03 -0000 1.981
@@ -1,5 +1,13 @@
Changes with Apache 2.0.44
+ *) Add --[enable|disable]-v4-mapped configure option to control
+ whether or not Apache expects to handle IPv4 connections
+ on IPv6 listening sockets. Either setting will work on
+ systems with the IPV6_V6ONLY socket option. --enable-v4-mapped
+ must be used on systems that always allow IPv4 connections on
+ IPv6 listening sockets. PR 14037 (Bugzilla), PR 7492 (Gnats)
+ [Jeff Trawick]
+
*) This fixes a problem where the underlying cache code
indicated that there was one more element on the cache
than there actually was. This happened since element 0
1.133 +2 -0 httpd-2.0/acinclude.m4
Index: acinclude.m4
===================================================================
RCS file: /home/cvs/httpd-2.0/acinclude.m4,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- acinclude.m4 19 Sep 2002 05:43:16 -0000 1.132
+++ acinclude.m4 14 Nov 2002 14:17:03 -0000 1.133
@@ -78,6 +78,8 @@
APACHE_SUBST(MODULE_DIRS)
APACHE_SUBST(MODULE_CLEANDIRS)
APACHE_SUBST(PORT)
+ APACHE_SUBST(nonssl_listen_stmt_1)
+ APACHE_SUBST(nonssl_listen_stmt_2)
APACHE_SUBST(CORE_IMPLIB_FILE)
APACHE_SUBST(CORE_IMPLIB)
APACHE_SUBST(SH_LIBS)
1.232 +36 -0 httpd-2.0/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/httpd-2.0/configure.in,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -r1.231 -r1.232
--- configure.in 19 Sep 2002 05:43:16 -0000 1.231
+++ configure.in 14 Nov 2002 14:17:03 -0000 1.232
@@ -324,6 +324,42 @@
[if test "$withval" = "yes"; then AC_MSG_ERROR('option --with-port requires a value (the TCP port number)'); else PORT="$withval"; fi],
[PORT=80])
+dnl ## See if APR has IPv6 support
+ap_old_cppflags=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS -I$APR_SOURCE_DIR/include -I$abs_builddir/srclib/apr/include"
+AC_TRY_COMPILE([#include <apr.h>], [
+#if !APR_HAVE_IPV6
+#error APR does not have IPv6 support
+#endif], apr_have_ipv6=yes, apr_have_ipv6=no)
+CPPFLAGS=$ap_old_cppflags
+
+AC_ARG_ENABLE(v4-mapped,APACHE_HELP_STRING(--enable-v4-mapped,Allow IPv6 sockets to handle IPv4 connections),
+[
+ v4mapped=$enableval
+],
+[
+ case $host in
+ *freebsd5*|*netbsd*|*openbsd*)
+ v4mapped=no
+ ;;
+ *)
+ v4mapped=yes
+ ;;
+esac
+])
+
+if test $v4mapped = "yes" -o $apr_have_ipv6 = "no"; then
+ nonssl_listen_stmt_1=""
+ nonssl_listen_stmt_2="Listen @@Port@@"
+ if test $apr_have_ipv6 = "yes"; then
+ AC_DEFINE(AP_ENABLE_V4_MAPPED, 1,
+ [Allow IPv4 connections on IPv6 listening sockets])
+ fi
+else
+ nonssl_listen_stmt_1="Listen 0.0.0.0:@@Port@@"
+ nonssl_listen_stmt_2="Listen [[::]]:@@Port@@"
+fi
+
AC_ARG_ENABLE(maintainer-mode,APACHE_HELP_STRING(--enable-maintainer-mode,Turn on debugging and compile time warnings),
[
APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
1.27 +2 -1 httpd-2.0/docs/conf/httpd-std.conf.in
Index: httpd-std.conf.in
===================================================================
RCS file: /home/cvs/httpd-2.0/docs/conf/httpd-std.conf.in,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- httpd-std.conf.in 4 Nov 2002 17:19:21 -0000 1.26
+++ httpd-std.conf.in 14 Nov 2002 14:17:11 -0000 1.27
@@ -214,7 +214,8 @@
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
-Listen @@Port@@
+@nonssl_listen_stmt_1@
+@nonssl_listen_stmt_2@
#
# Dynamic Shared Object (DSO) Support
1.10 +3 -0 httpd-2.0/docs/conf/ssl-std.conf
Index: ssl-std.conf
===================================================================
RCS file: /home/cvs/httpd-2.0/docs/conf/ssl-std.conf,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ssl-std.conf 16 May 2002 19:05:24 -0000 1.9
+++ ssl-std.conf 14 Nov 2002 14:17:11 -0000 1.10
@@ -23,6 +23,9 @@
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
+# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
+# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
+#
Listen 443
#
1.83 +19 -0 httpd-2.0/server/listen.c
Index: listen.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/listen.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- listen.c 31 Jul 2002 12:44:55 -0000 1.82
+++ listen.c 14 Nov 2002 14:17:11 -0000 1.83
@@ -88,6 +88,13 @@
{
apr_socket_t *s = server->sd;
int one = 1;
+#if APR_HAVE_IPV6
+#ifdef AP_ENABLE_V4_MAPPED
+ int v6only_setting = 0;
+#else
+ int v6only_setting = 1;
+#endif
+#endif
apr_status_t stat;
#ifndef WIN32
@@ -109,6 +116,18 @@
apr_socket_close(s);
return stat;
}
+
+#if APR_HAVE_IPV6
+ stat = apr_socket_opt_set(s, APR_IPV6_V6ONLY, v6only_setting);
+ if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
+ ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
+ "make_sock: for address %pI, apr_socket_opt_set: "
+ "(IPV6_V6ONLY)",
+ server->bind_addr);
+ apr_socket_close(s);
+ return stat;
+ }
+#endif
/*
* To send data over high bandwidth-delay connections at full
Re: cvs commit: httpd-2.0/server listen.c
Posted by Jeff Trawick <tr...@attglobal.net>.
hiroyuki hanai <ha...@imgsrc.co.jp> writes:
> On 14 Nov 2002 14:17:11 -0000, trawick@apache.org wrote:
>
> > trawick 2002/11/14 06:17:11
> >
> > Modified: . CHANGES acinclude.m4 configure.in
> > docs/conf httpd-std.conf.in ssl-std.conf
> > server listen.c
> > Log:
> > Add --[enable|disable]-v4-mapped configure option to control
> > whether or not Apache expects to handle IPv4 connections
> > on IPv6 listening sockets. Either setting will work on
> > systems with the IPV6_V6ONLY socket option. --enable-v4-mapped
> > must be used on systems that always allow IPv4 connections on
> > IPv6 listening sockets.
>
> after this commit, httpd cannot run with following error;
>
> [Fri Nov 22 20:01:43 2002] [crit] (22)Invalid argument: make_sock: for address 127.0.0.1:80, apr_socket_opt_set: (IPV6_V6ONLY)
> no listening sockets available, shutting down
> Unable to open logs
>
> on my FreeBSD boxes, both -current and -stable with ipv4-mapping
> disabled and enabled respectively.
>
> i think this error occurs because IPV6_V6ONLY option are being set
> on all sockets; even if on the IPv4 sockets.
>
> following is a patch to set IPV6_V6ONLY option on only IPv6 sockets.
> i don't know if this is a correct answer but it solves at least my problem...
Yes, this is so obviously a necessary change (blush).
I had so much trouble with the config-time changes to generate the
right httpd.conf that I guess my brain was fried when coming up with
test variations for the actual code :(
> Regards,
>
> hiro hanai
Thanks so much!
I expect to commit shortly, after which the beatings will resume.
--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...
Re: cvs commit: httpd-2.0/server listen.c
Posted by hiroyuki hanai <ha...@imgsrc.co.jp>.
On 14 Nov 2002 14:17:11 -0000, trawick@apache.org wrote:
> trawick 2002/11/14 06:17:11
>
> Modified: . CHANGES acinclude.m4 configure.in
> docs/conf httpd-std.conf.in ssl-std.conf
> server listen.c
> Log:
> Add --[enable|disable]-v4-mapped configure option to control
> whether or not Apache expects to handle IPv4 connections
> on IPv6 listening sockets. Either setting will work on
> systems with the IPV6_V6ONLY socket option. --enable-v4-mapped
> must be used on systems that always allow IPv4 connections on
> IPv6 listening sockets.
after this commit, httpd cannot run with following error;
[Fri Nov 22 20:01:43 2002] [crit] (22)Invalid argument: make_sock: for address 127.0.0.1:80, apr_socket_opt_set: (IPV6_V6ONLY)
no listening sockets available, shutting down
Unable to open logs
on my FreeBSD boxes, both -current and -stable with ipv4-mapping
disabled and enabled respectively.
i think this error occurs because IPV6_V6ONLY option are being set
on all sockets; even if on the IPv4 sockets.
following is a patch to set IPV6_V6ONLY option on only IPv6 sockets.
i don't know if this is a correct answer but it solves at least my problem...
Regards,
hiro hanai
-----------------------------------------------------------------------------
Index: listen.c
===================================================================
RCS file: /fs/pub/cvs/Apache/httpd-2.0/server/listen.c,v
retrieving revision 1.83
diff -u -r1.83 listen.c
--- listen.c 14 Nov 2002 14:17:11 -0000 1.83
+++ listen.c 22 Nov 2002 09:52:45 -0000
@@ -118,14 +118,16 @@
}
#if APR_HAVE_IPV6
- stat = apr_socket_opt_set(s, APR_IPV6_V6ONLY, v6only_setting);
- if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
+ if (server->bind_addr->family == AF_INET6) {
+ stat = apr_socket_opt_set(s, APR_IPV6_V6ONLY, v6only_setting);
+ if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
"make_sock: for address %pI, apr_socket_opt_set: "
"(IPV6_V6ONLY)",
server->bind_addr);
apr_socket_close(s);
return stat;
+ }
}
#endif
-----------------------------------------------------------------------------