From 13cfb2087f500dc4b1d574c42f1d5f7f0e1e0246 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 24 Jul 2026 14:33:52 +1000 Subject: [PATCH] MDEV-39169 Replace deprecated network functions in resolveip (testfix) Check there is a ipv4 mapped address. --- mysql-test/include/check_ipv4_mapped.inc | 5 +++++ mysql-test/main/resolveip.test | 1 + mysql-test/suite.pm | 12 ++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 mysql-test/include/check_ipv4_mapped.inc diff --git a/mysql-test/include/check_ipv4_mapped.inc b/mysql-test/include/check_ipv4_mapped.inc new file mode 100644 index 0000000000000..00084f9617755 --- /dev/null +++ b/mysql-test/include/check_ipv4_mapped.inc @@ -0,0 +1,5 @@ +# Check if IPv6 IPv4 mapped is available. +# +# The real check is done in the suite.pm +# (it has to be done *before* mariadbd is started) +# diff --git a/mysql-test/main/resolveip.test b/mysql-test/main/resolveip.test index 874ffefbc28b6..f407913a2fa91 100644 --- a/mysql-test/main/resolveip.test +++ b/mysql-test/main/resolveip.test @@ -1,5 +1,6 @@ --source include/not_windows.inc --source include/check_ipv6.inc +--source include/check_ipv4_mapped.inc # Reverse DNS tests (getnameinfo with NI_NAMEREQD) require: # - /etc/hosts entries for 127.0.0.1 and ::1 (or working DNS PTR records) diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index b31728ba30d8e..d016466b056bf 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -64,6 +64,18 @@ sub skip_combinations { } $skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok(); + sub ipv4_mapped_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 <5.14 + eval { bind $sock, sockaddr_in6($::baseport, Socket::inet_pton(Socket::AF_INET6, + '::ffff:127.0.0.1')) }; + return $@ eq "" && $! eq "" + } + $skip{'include/check_ipv4_mapped.inc'} = 'No IPv6 -> IPv4 mapped address' + unless ipv4_mapped_ok(); + # SSL is complicated my $ssl_lib= $::mysqld_variables{'version-ssl-library'}; my $openssl_ver= $ssl_lib =~ /OpenSSL (\S+)/ ? $1 : "";