Hi, On Tue, Jun 10, 2003 at 02:11:59PM +0800, Philippe M. Chiasson wrote: > On Mon, 2003-06-09 at 16:25, Stas Bekman wrote: > > Philippe M. Chiasson wrote: > > > Dunno where they all went in the past, but as Stas reminded me, I am > > > still holding off on 2 OpenBSD-related patches to make sure Apache-Test > > > generates httpd.conf that will bind on IPv4 addresses. This is important > > > on a platform like OpenBSD where IPv6 is prefered by default and IPv4 > > > mapped addresses are disabled by default. > > > > any chance we can figure out that ipv6 like-ness is needed dynamically, so to > > keep things simple for most other users? Also please test that it doesn't > > break things with apache-1.3 (the simplest good test is to run the > > httpd-test/perl-framework with apache-1.3). > > Hrm, I have looked into it, and the problem is not to figure out if the > system is IPv6 or IPv4 by default, but we also need to check if there is > support for IPv4 mapped addresses. > > At this point, I wasn't able to find a way to figure it out dynamically. > It sure would be nicer if we could just "figure it out"
I have observed (on Linux) a similar problem as Philippe. I'm not
entirely sure if it is the same. Anyways, on many machines, starting the
apache in the test framework fails like this:
setsockopt(42, SOL_IPV6, 26, [0], 4) = -1 ENOPROTOOPT (Protocol not available)
write(2, "[Mon Aug 04 14:03:46 2003] [crit"..., 130[Mon Aug 04 14:03:46 2003] [crit]
(92)Protocol not available: make_sock: for
address [::]:8543, apr_socket_opt_set: (IPV6_V6ONLY)
) = 130
close(42) = 0
write(2, "no listening sockets available, "..., 46no listening sockets available,
shutting down
) = 46
write(2, "Unable to open logs\n\n", 21Unable to open logs
I have come up with the attached test program. I was unable to nail down
the actual difference in machine configuration or kernel
configuration/version that determines whether the SOL_IPV6 socket option
is supported or not. Anyway, the test program works for me.
Now, if I apply Philippes patch on the affected machines, it does not
help in all cases, because on some machine it makes the apache listen on
the IPv6 localhost (netstat shows ::1) while (I think) the test scripts
access the IPv4 localhost. But if I modify the patch to use 127.0.0.1
instead of the $vars->{servername}, it works fine. Modified patch
attached.
Peter
--
Thought is limitation. Free your mind.
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
int main(void)
{
int listenfd;
int on = 0;
listenfd = socket(AF_INET6, SOCK_STREAM, 0);
/* hardcode IPV6_V6ONLY as 26 since it's not declared on most machines */
if (setsockopt(listenfd, SOL_IPV6, 26, (void *)&on, sizeof(int)) == -1) {
perror("setsockopt");
return errno;
}
return 0;
}
diff -uNr mod_perl-1.99_09_20030807.orig/Apache-Test/lib/Apache/TestConfig.pm
mod_perl-1.99_09_20030807/Apache-Test/lib/Apache/TestConfig.pm
--- mod_perl-1.99_09_20030807.orig/Apache-Test/lib/Apache/TestConfig.pm 2003-08-07
11:51:55.000000000 +0200
+++ mod_perl-1.99_09_20030807/Apache-Test/lib/Apache/TestConfig.pm 2003-08-28
11:22:51.000000000 +0200
@@ -963,7 +963,7 @@
$port);
#extra config that should go *outside* the <VirtualHost ...>
- my @out_config = ([Listen => $port]);
+ my @out_config = ([Listen => '127.0.0.1' . ':' . $port]);
#there are two ways of building a vhost
#first is when we parse test .pm and .c files
@@ -1627,7 +1627,7 @@
__DATA__
-Listen @Port@
+Listen 127.0.0.1:@Port@
ServerRoot "@ServerRoot@"
DocumentRoot "@DocumentRoot@"
diff -uNr mod_perl-1.99_09_20030807.orig/Apache-Test/lib/Apache/TestConfigPerl.pm
mod_perl-1.99_09_20030807/Apache-Test/lib/Apache/TestConfigPerl.pm
--- mod_perl-1.99_09_20030807.orig/Apache-Test/lib/Apache/TestConfigPerl.pm
2003-08-03 23:49:48.000000000 +0200
+++ mod_perl-1.99_09_20030807/Apache-Test/lib/Apache/TestConfigPerl.pm 2003-08-28
11:23:13.000000000 +0200
@@ -191,7 +191,7 @@
sub set_connection_handler {
my($self, $module, $args) = @_;
my $port = $self->new_vhost($module);
- $self->postamble(Listen => $port);
+ $self->postamble(Listen => '127.0.0.1' . ':' . $port);
}
my %add_hook_config = (
diff -uNr mod_perl-1.99_09_20030807.orig/t/response/TestApache/conftree.pm
mod_perl-1.99_09_20030807/t/response/TestApache/conftree.pm
--- mod_perl-1.99_09_20030807.orig/t/response/TestApache/conftree.pm 2003-02-28
17:39:35.000000000 +0100
+++ mod_perl-1.99_09_20030807/t/response/TestApache/conftree.pm 2003-08-28
11:23:56.000000000 +0200
@@ -27,9 +27,9 @@
ok $tree;
- my $port = $tree->lookup('Listen');
+ my $listen = $tree->lookup('Listen');
- ok t_cmp($vars->{port}, $port);
+ ok t_cmp('127.0.0.1' . ':' . $vars->{port}, $listen);
my $documentroot = $tree->lookup('DocumentRoot');
pgp00000.pgp
Description: PGP signature
