Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 32389 - apache2 incorrectly assumes ipv6 when conf says Listen 80
Summary: apache2 incorrectly assumes ipv6 when conf says Listen 80
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords:
: 32449 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-31 07:10 UTC by Daath
Modified: 2004-04-05 18:03 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix for bsd-related ipv6 error (httpd-2.0.48-bsd-ipv6-fix.diff,865 bytes, patch)
2003-12-10 10:17 UTC, Lindsay Haisley
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daath 2003-10-31 07:10:43 UTC
Updated to net-www/apache-2.0.48 with emerge -u world, ran etc-update - and
tried to start the server - it failed with: "Protocol not available: make_sock:
for address [::]:80, apr_socket_opt_set: (IPV6_V6ONLY)"
After examining my make.conf and various conf files I found that the error was
with /etc/apache2/conf/apache2.conf

TO RESOLVE: The line in apache.conf "Listen 80" makes apache think that it
should use ipv6 - change it to "Listen 0.0.0.0:80" and it starts as it should.

Reproducible: Always
Steps to Reproduce:

Actual Results:  
Failed with: Protocol not available: make_sock: for address [::]:80,
apr_socket_opt_set: (IPV6_V6ONLY)

Expected Results:  
Apache2 should start

Portage 2.0.49-r15 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r8, 2.4.20-gentoo-r5)
=================================================================
System uname: 2.4.20-gentoo-r5 i686 Pentium II (Deschutes)
Gentoo Base System version 1.4.3.11
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium2 -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/share/config /usr/kde/2/share/config
/usr/kde/3/share/config /var/bind /usr/X11R6/lib/X11/xkb /var/qmail/control
/var/qmail/alias"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=pentium2 -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox ccache autoaddcvs"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/ http://ftp.gentoo.skynet.be/
http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="oss foomaticdb mad xmms tcltk esd x86 -3dnow -apm -arts avi berkdb crypt
cups curl encode firebird gd gdbm gif gpm gtk imap imlib java jpeg kde gnome
-libg++ libwww mcal -mikmod maildir -mbox mmx motif mpeg mysql ncurses nls
oggvorbis opengl pam pdflib png python perl qt -quicktime readline -sdl slang
-spell ssl svga tcpd truetype X xml xml2 -xv zlib"
Comment 1 Donny Davies (RETIRED) gentoo-dev 2003-10-31 07:54:03 UTC
Will get to this.
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2003-11-01 05:30:55 UTC
*** Bug 32449 has been marked as a duplicate of this bug. ***
Comment 3 Marcus J. van Dijk, Jr. 2003-11-01 11:07:32 UTC
seemant could you reassign this bug please?

This seems to be a configuration file change. It has its effects on /etc/apache2/conf/apache2.conf
and for those who have installed ssl as well, it also affects /etc/apache2/conf/modules/40_mod_ssl.conf.

Listen 80 should indeed be Listen 0.0.0.0:80. in the second file, changes
are somewhat similar: Listen 0.0.0.0:443.
Comment 4 Donny Davies (RETIRED) gentoo-dev 2003-11-01 12:20:14 UTC
Mark, I will get to it.
Comment 5 Christian Rubbert 2003-11-02 02:55:34 UTC
Just a note, this doesn't even work when you have IPv6 network-wise enabled
and in use.
Comment 6 Donny Davies (RETIRED) gentoo-dev 2003-11-04 10:16:05 UTC
Christian, could you just clarify that last comment for me please.

Are you saying the proposed "fix" is good or bad?
Comment 7 Christian Rubbert 2003-11-09 05:53:52 UTC
I was trying to say that this error occurs when the machine is IPv6 enabled
& connected.

The fix "works", you just cannot connect via IPv6 per default then.
Comment 8 Lindsay Haisley 2003-11-11 23:21:33 UTC
This is correct.  If I have a box fully IPv6 enabled w. a global IPv6 address apache2 won't run if the IPv6 address is spec'd in the config file.

# apache2 -V
Server version: Apache/2.0.48
Server built:   Nov 11 2003 22:12:30
Server's Module Magic Number: 20020903:4
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/sbin/suexec2"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/conf/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/conf/apache2.conf"

It looks like IPv6 is built into apache2.  Other services on the box, such as sshd, run properly with IPv6, however if I put the local IPv6 address in the apache config file by adding 

Listen [3ffe:bc0:1d5:1::16]:80

to the config file, I get the following when I try to start apache:

[Wed Nov 12 01:19:34 2003] [crit] (92)Protocol not available: make_sock: for address [3ffe:bc0:1d5:1::16]:80, apr_socket_opt_set: (IPV6_V6ONLY)
no listening sockets available, shutting down

It looks as if adding an explicit IPv4 address to the Listen directive is only a band-aid over an IPv6 problem.
Comment 9 Philipp Kern 2003-11-20 10:12:00 UTC
The "fix" is indeed no good solution.
I wanted to use apache2 because of the IPv6-support included, which apache1 does not have.
I hope this gets fixed ASAP.
Comment 10 Philipp Kern 2003-12-05 10:01:28 UTC
Is there anything done about this bug?
Comment 11 Lindsay Haisley 2003-12-08 21:12:45 UTC
For what it's worth, this seems to be an upstream problem that crept in between 
2.0.43 and 2.0.44. It's been noted by a few people in the debian-apache list.
See, for instance <http://lists.debian.org/debian-apache/2003/debian-apache-200311/msg00109.html>.

Here's a patch to listen.c for the apache source, as per this post, and it eliminates the error.  I'll leave integrating it into gentoo for others.

--- listen.c.orig       2003-12-08 23:03:52.000000000 -0600
+++ listen.c    2003-12-08 23:03:52.000000000 -0600
@@ -117,19 +117,6 @@
         return stat;
     }
 
-#if APR_HAVE_IPV6
-    if (server->bind_addr->family == APR_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
 
     /*
      * To send data over high bandwidth-delay connections at full
Comment 12 Lindsay Haisley 2003-12-10 10:17:02 UTC
Created attachment 21978 [details, diff]
Fix for bsd-related ipv6 error

As per
<http://lists.debian.org/debian-apache/2003/debian-apache-200311/msg00109.html>,

here is a fix for the apache 2.0.48 problem with Gentoo.

# cd /usr/portage/net-www/apache
# cp apache-2.0.48-r1.ebuild apache-2.0.48-r2.ebuild

Add the following line to apache-2.0.48-r2.ebuild right under the line in
src_unpack(): "patch -p1 <${FILESDIR}/apache-2.0.48-gentoo.diff || die"

patch -p1 <${FILESDIR}/httpd-2.0.48-bsd-ipv6-fix.diff || die


Copy the attached patch to files/httpd-2.0.48-bsd-ipv6-fix.diff

# ebuild apache-2.0.48-r2.ebuild digest

# emerge -u apache

All should be well....

This should do until someone from Gentoo makes the fix official.
Comment 13 Scott Carr 2004-01-21 13:28:53 UTC
To confirm:  The patch fixed the issue on my system.  450 Mhz Celeron.  Setting up 0.0.0.0:[port] as the Listen did not work for me.
Comment 14 Chuck Short (RETIRED) gentoo-dev 2004-04-05 18:03:44 UTC
Patch applied. You shouldnt need the listen 0.0.0.0:80 for ipv6. Tested here works properly.

Regards,
chuck