Philippe M. Chiasson wrote:
On Mon, 2004-03-29 at 15:43 -0800, Stas Bekman wrote:

Philippe M. Chiasson wrote:

After a bit of poking around different flavors of IPv6 systems, I've
encountered a few situations where Apache::Test ends up configuring
httpd in a way that can't be tested.

This typically only happens on a system that has IPv4-mapped IPv6
addresses disabled, i.e. OpenBSD. If the hostname that is picked
to form the Listen directives happens to have both an IPv4 and an
IPv6 address, i.e localhot on OpenBSD, the server will start but will
only be listening on an IPv6 address.

And since LWP doesn't do requests over IPv6, all tests will fail.

The following patch attempts to do handle all this by doing one of a few
many things.

gozer++


If the server has ipv4-mapped addresses, Listen to *:port, forcing the
use of ipv4-mapped addresses and insuring that the server will be
available over it's ipv4 address.

Otherwise try to use Socket6 to see if the hostname is both v4 and v6
and Listen to *:port as well. Without Socket6 (not part of the Perl
core), just warn the user about possible problems he/she will run into
if the selected hostname happens to be ipv6.

[...]

+        else {
+            if (eval { require Socket6 }) {
+                if (Socket6::gethostbyname2($name, Socket6::AF_INET6())) {
+                    $self->{vars}{listen_addr} = '*';
+                }
+            }
+            else {
+                warning "Socket6 not installed";
+                warning "Test might fail if your hostname: '$name' has an IPv6 
address";

I think we should die here:

error << EOI;
Your system is configured to run both ipv6 and ipv4, but the right interface can't be selected.
Please install the perl CPAN module Socket6 and re-run the last command.
EOI
die "\n";


That's something I considered, but I figured it was better to be gentle
and just warn people that things might not work. I am perfectly fine
with die instead.


and if Socket6 builds everywhere, and including older perls, we should include it in Apache-Test's %PREREQ_PM.


Well, I built it successfully with a combination of 5.8.x and 5.6.x on
linux, freebsd and openbsd. I am not sure if it builds on systems
without ipv4 support though.

OK, so let's keep it warning/out of prereq for now while we polish it.

but please replace s/warning/error/ so it'll more prominent. thanks.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to