From 70dcb46e98e682b6d0c7c3522ddc0ebf0abb70ec Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 25 Aug 2016 10:21:06 +1000 Subject: MDEV-9185: fix ipv6 detection test in MTR Signed-off-by: Daniel Black --- mysql-test/suite.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mysql-test/suite.pm') diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index ea07af7376c..6991ba5f035 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -56,9 +56,15 @@ sub skip_combinations { sub ipv6_ok() { use Socket; return 0 unless socket my $sock, PF_INET6, SOCK_STREAM, getprotobyname('tcp'); - # eval{}, if there's no Socket::sockaddr_in6 at all, old Perl installation - eval { connect $sock, sockaddr_in6(7, Socket::IN6ADDR_LOOPBACK) }; - return $@ eq ""; + my $ipv6_works = false; + # eval{}, if there's no Socket::sockaddr_in6 at all, old Perl installation <5.14 + eval { + my $addr = sockaddr_in6($baseport, Socket::IN6ADDR_LOOPBACK) or return 0; + die 'bind failed' unless bind $sock, $addr; + close $sock; + $ipv6_works = true; + }; + return $@ eq "" && $ipv6_works; } $skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok(); -- cgit v1.2.1