From: bluhm Date: Wed, 22 Dec 2021 11:50:28 +0000 (+0000) Subject: Replace deprecated IO::Socket::INET6 with IO::Socket::IP. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b65dd5ea430c42ff24718ec08d7042e7d6a36029;p=openbsd Replace deprecated IO::Socket::INET6 with IO::Socket::IP. --- diff --git a/regress/usr.sbin/relayd/Client.pm b/regress/usr.sbin/relayd/Client.pm index bb1097a9df4..4edf4cb5bbe 100644 --- a/regress/usr.sbin/relayd/Client.pm +++ b/regress/usr.sbin/relayd/Client.pm @@ -1,6 +1,6 @@ -# $OpenBSD: Client.pm,v 1.13 2020/11/07 16:02:19 bluhm Exp $ +# $OpenBSD: Client.pm,v 1.14 2021/12/22 11:50:28 bluhm Exp $ -# Copyright (c) 2010-2015 Alexander Bluhm +# Copyright (c) 2010-2021 Alexander Bluhm # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -22,8 +22,7 @@ use parent 'Proc'; use Carp; use Socket qw(:DEFAULT IPPROTO_TCP TCP_NODELAY); use Socket6; -use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP; use IO::Socket::SSL; sub new { @@ -50,10 +49,12 @@ sub child { delete $self->{cs}; $SSL_ERROR = ""; - my $iosocket = $self->{ssl} ? "IO::Socket::SSL" : "IO::Socket::INET6"; + my $iosocket = $self->{ssl} ? "IO::Socket::SSL" : "IO::Socket::IP"; my $cs = $iosocket->new( Proto => "tcp", Domain => $self->{connectdomain}, + # IO::Socket::IP calls the domain family + Family => $self->{connectdomain}, PeerAddr => $self->{connectaddr}, PeerPort => $self->{connectport}, SSL_verify_mode => SSL_VERIFY_NONE, diff --git a/regress/usr.sbin/relayd/LICENSE b/regress/usr.sbin/relayd/LICENSE index 150992ad397..78d7a52f6fb 100644 --- a/regress/usr.sbin/relayd/LICENSE +++ b/regress/usr.sbin/relayd/LICENSE @@ -1,4 +1,4 @@ -# Copyright (c) 2010-2017 Alexander Bluhm +# Copyright (c) 2010-2021 Alexander Bluhm # Copyright (c) 2014 Reyk Floeter # # Permission to use, copy, modify, and distribute this software for any diff --git a/regress/usr.sbin/relayd/Makefile b/regress/usr.sbin/relayd/Makefile index 978e4a92e52..f017c07332a 100644 --- a/regress/usr.sbin/relayd/Makefile +++ b/regress/usr.sbin/relayd/Makefile @@ -1,7 +1,6 @@ -# $OpenBSD: Makefile,v 1.19 2021/12/02 17:10:53 kn Exp $ +# $OpenBSD: Makefile,v 1.20 2021/12/22 11:50:28 bluhm Exp $ # The following ports must be installed for the regression tests: -# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets # p5-Socket6 Perl defines relating to AF_INET6 sockets # p5-IO-Socket-SSL perl interface to SSL sockets # @@ -9,14 +8,13 @@ # are missing print a warning and skip the tests, but do not fail. PERL_REQUIRE != perl -Mstrict -Mwarnings -e ' \ - eval { require IO::Socket::INET6 } or print $@; \ eval { require Socket6 } or print $@; \ eval { require IO::Socket::SSL } or print $@; \ ' .if ! empty (PERL_REQUIRE) regress: @echo "${PERL_REQUIRE}" - @echo 'run "pkg_add p5-IO-Socket-INET6 p5-Socket6 p5-Socket-SSL"' + @echo 'run "pkg_add p5-Socket6 p5-Socket-SSL"' @echo SKIPPED .endif diff --git a/regress/usr.sbin/relayd/Server.pm b/regress/usr.sbin/relayd/Server.pm index df5a87959ff..8f1d4f3ce88 100644 --- a/regress/usr.sbin/relayd/Server.pm +++ b/regress/usr.sbin/relayd/Server.pm @@ -1,6 +1,6 @@ -# $OpenBSD: Server.pm,v 1.14 2020/11/07 16:02:20 bluhm Exp $ +# $OpenBSD: Server.pm,v 1.15 2021/12/22 11:50:28 bluhm Exp $ -# Copyright (c) 2010-2015 Alexander Bluhm +# Copyright (c) 2010-2021 Alexander Bluhm # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -23,8 +23,7 @@ use Carp; use Config; use Socket qw(:DEFAULT IPPROTO_TCP TCP_NODELAY); use Socket6; -use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP; use IO::Socket::SSL; sub new { @@ -36,11 +35,13 @@ sub new { $self->{listendomain} or croak "$class listen domain not given"; $SSL_ERROR = ""; - my $iosocket = $self->{ssl} ? "IO::Socket::SSL" : "IO::Socket::INET6"; + my $iosocket = $self->{ssl} ? "IO::Socket::SSL" : "IO::Socket::IP"; my $ls = $iosocket->new( Proto => "tcp", ReuseAddr => 1, Domain => $self->{listendomain}, + # IO::Socket::IP calls the domain family + Family => $self->{listendomain}, $self->{listenaddr} ? (LocalAddr => $self->{listenaddr}) : (), $self->{listenport} ? (LocalPort => $self->{listenport}) : (), SSL_server => 1, diff --git a/regress/usr.sbin/relayd/funcs.pl b/regress/usr.sbin/relayd/funcs.pl index b7e4985ec21..fcb49ffd635 100644 --- a/regress/usr.sbin/relayd/funcs.pl +++ b/regress/usr.sbin/relayd/funcs.pl @@ -1,6 +1,6 @@ -# $OpenBSD: funcs.pl,v 1.24 2021/03/24 21:03:06 benno Exp $ +# $OpenBSD: funcs.pl,v 1.25 2021/12/22 11:50:28 bluhm Exp $ -# Copyright (c) 2010-2017 Alexander Bluhm +# Copyright (c) 2010-2021 Alexander Bluhm # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -23,7 +23,7 @@ use Digest::MD5; use Socket; use Socket6; use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP; sub find_ports { my %args = @_; @@ -33,9 +33,9 @@ sub find_ports { my @sockets = (1..$num); foreach my $s (@sockets) { - $s = IO::Socket::INET6->new( + $s = IO::Socket::IP->new( Proto => "tcp", - Domain => $domain, + Family => $domain, $addr ? (LocalAddr => $addr) : (), ) or die "find_ports: create and bind socket failed: $!"; }