You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by hiroyuki hanai <ha...@imgsrc.co.jp> on 2002/11/22 12:16:48 UTC

Re: cvs commit: httpd-2.0/server listen.c

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
-----------------------------------------------------------------------------

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...