ok(run(test([@ssltest, "-bio_pair", "-server_auth", "-client_auth", "-app_verify", @CA, @extra])),
'test sslv2/sslv3 with both client and server authentication via BIO pair and app verify');
- ok(run(test([@ssltest, "-ipv4", @extra])),
- 'test TLS via IPv4');
- ok(run(test([@ssltest, "-ipv6", @extra])),
- 'test TLS via IPv6');
-
- }
+ SKIP: {
+ skip "No IPv4 available on this machine", 1
+ unless have_IPv4();
+ ok(run(test([@ssltest, "-ipv4", @extra])),
+ 'test TLS via IPv4');
+ }
+
+ SKIP: {
+ skip "No IPv6 available on this machine", 1
+ unless have_IPv6();
+ ok(run(test([@ssltest, "-ipv6", @extra])),
+ 'test TLS via IPv6');
+ }
+ }
};
subtest "Testing ciphersuites" => sub {
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.1";
@ISA = qw(Exporter);
-@EXPORT = qw(alldisabled anydisabled disabled config available_protocols);
+@EXPORT = qw(alldisabled anydisabled disabled config available_protocols
+ have_IPv4 have_IPv6);
=head1 NAME
config("fips");
+ have_IPv4();
+ have_IPv6();
+
=head1 DESCRIPTION
This module provides utility functions for the testing framework.
Returns an item from the %config hash in \$TOP/configdata.pm.
+=item B<have_IPv4>
+=item B<have_IPv6>
+
+Return true if IPv4 / IPv6 is possible to use on the current system.
+
=back
=cut
return $config{$_[0]};
}
+# IPv4 / IPv6 checker
+my $have_IPv4 = -1;
+my $have_IPv6 = 1;
+my $IP_factory;
+sub check_IP {
+ my $listenaddress = shift;
+
+ eval {
+ require IO::Socket::IP;
+ my $s = IO::Socket::IP->new(
+ LocalAddr => $listenaddress,
+ LocalPort => 0,
+ Listen=>1,
+ );
+ $s or die "\n";
+ $s->close();
+ };
+ if ($@ eq "") {
+ return 1;
+ }
+
+ eval {
+ require IO::Socket::INET6;
+ my $s = IO::Socket::INET6->new(
+ LocalAddr => $listenaddress,
+ LocalPort => 0,
+ Listen=>1,
+ );
+ $s or die "\n";
+ $s->close();
+ };
+ if ($@ eq "") {
+ return 1;
+ }
+
+ eval {
+ require IO::Socket::INET;
+ my $s = IO::Socket::INET->new(
+ LocalAddr => $listenaddress,
+ LocalPort => 0,
+ Listen=>1,
+ );
+ $s or die "\n";
+ $s->close();
+ };
+ if ($@ eq "") {
+ return 1;
+ }
+
+ return 0;
+}
+
+sub have_IPv4 {
+ if ($have_IPv4 < 0) {
+ $have_IPv4 = check_IP("127.0.0.1");
+ }
+ return $have_IPv4;
+}
+
+sub have_IPv6 {
+ if ($have_IPv6 < 0) {
+ $have_IPv6 = check_IP("::1");
+ }
+ return $have_IPv6;
+}
+
+
=head1 SEE ALSO
L<OpenSSL::Test>