From 1073f88e29826f275b4d894af83fa9705918d29c Mon Sep 17 00:00:00 2001 From: bluhm Date: Sun, 12 Dec 2021 21:16:53 +0000 Subject: [PATCH] Replace deprecated IO::Socket::INET6 with IO::Socket::IP. --- regress/sys/kern/sosplice/Makefile.inc | 3 +-- regress/sys/net/pf_divert/Client.pm | 17 +++++++++-------- regress/sys/net/pf_divert/Makefile | 6 ++---- regress/sys/net/pf_divert/Packet.pm | 6 +++--- regress/sys/net/pf_divert/Server.pm | 12 +++++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/regress/sys/kern/sosplice/Makefile.inc b/regress/sys/kern/sosplice/Makefile.inc index 70e80024a24..534f9628ffb 100644 --- a/regress/sys/kern/sosplice/Makefile.inc +++ b/regress/sys/kern/sosplice/Makefile.inc @@ -1,8 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.7 2021/12/12 10:56:49 bluhm Exp $ +# $OpenBSD: Makefile.inc,v 1.8 2021/12/12 21:16:53 bluhm Exp $ # The following ports must be installed for the regression tests: # p5-BSD-Socket-Splice perl interface to OpenBSD socket splicing -# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets # p5-Socket6 Perl defines relating to AF_INET6 sockets # # Check wether all required perl packages are installed. If some diff --git a/regress/sys/net/pf_divert/Client.pm b/regress/sys/net/pf_divert/Client.pm index 9f01b3b74fb..16ce78eb510 100644 --- a/regress/sys/net/pf_divert/Client.pm +++ b/regress/sys/net/pf_divert/Client.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Client.pm,v 1.5 2017/12/18 17:01:27 bluhm Exp $ +# $OpenBSD: Client.pm,v 1.6 2021/12/12 21:16:53 bluhm Exp $ # Copyright (c) 2010-2017 Alexander Bluhm # @@ -23,7 +23,7 @@ use Carp; use Socket qw(IPPROTO_TCP TCP_NODELAY); use Socket6; use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP -register; use constant SO_BINDANY => 0x1000; sub new { @@ -53,11 +53,10 @@ sub new { my $cs; if ($self->{bindany}) { - do { local $> = 0; $cs = IO::Socket::INET6->new( + do { local $> = 0; $cs = IO::Socket->new( Type => $self->{socktype}, Proto => $self->{protocol}, Domain => $self->{domain}, - Blocking => ($self->{nonblocking} ? 0 : 1), ) } or die ref($self), " socket connect failed: $!"; do { local $> = 0; $cs->setsockopt(SOL_SOCKET, SO_BINDANY, 1) } or die ref($self), " setsockopt SO_BINDANY failed: $!"; @@ -66,11 +65,10 @@ sub new { $cs->bind($rres[3]) or die ref($self), " bind failed: $!"; } elsif ($self->{bindaddr} || $self->{bindport}) { - do { local $> = 0; $cs = IO::Socket::INET6->new( + do { local $> = 0; $cs = IO::Socket->new( Type => $self->{socktype}, Proto => $self->{protocol}, Domain => $self->{domain}, - Blocking => ($self->{nonblocking} ? 0 : 1), LocalAddr => $self->{bindaddr}, LocalPort => $self->{bindport}, ) } or die ref($self), " socket connect failed: $!"; @@ -93,11 +91,10 @@ sub new { sub child { my $self = shift; - my $cs = $self->{cs} || do { local $> = 0; IO::Socket::INET6->new( + my $cs = $self->{cs} || do { local $> = 0; IO::Socket->new( Type => $self->{socktype}, Proto => $self->{protocol}, Domain => $self->{domain}, - Blocking => ($self->{nonblocking} ? 0 : 1), ) } or die ref($self), " socket connect failed: $!"; if ($self->{oobinline}) { setsockopt($cs, SOL_SOCKET, SO_OOBINLINE, pack('i', 1)) @@ -125,6 +122,10 @@ sub child { print STDERR "connect peer: ",$cs->peerhost()," ",$cs->peerport(),"\n"; $self->{bindaddr} = $cs->sockhost(); $self->{bindport} = $cs->sockport(); + if ($self->{nonblocking}) { + $cs->blocking(0) + or die ref($self), " set non-blocking connect failed: $!"; + } open(STDOUT, '>&', $cs) or die ref($self), " dup STDOUT failed: $!"; diff --git a/regress/sys/net/pf_divert/Makefile b/regress/sys/net/pf_divert/Makefile index 77f8d61aa89..0b892c65e15 100644 --- a/regress/sys/net/pf_divert/Makefile +++ b/regress/sys/net/pf_divert/Makefile @@ -1,14 +1,12 @@ -# $OpenBSD: Makefile,v 1.23 2020/12/17 00:51:12 bluhm Exp $ +# $OpenBSD: Makefile,v 1.24 2021/12/12 21:16:53 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 # # Check wether all required perl packages are installed. If some # 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 $@; \ ' .if ! empty(PERL_REQUIRE) @@ -270,6 +268,6 @@ check-setup: route -n get -inet6 ${FAKE_ADDR6} | grep 'gateway: ${REMOTE_ADDR6}$$' ssh ${REMOTE_SSH} ${SUDO} pfctl -sr | grep '^anchor "regress" all$$' ssh ${REMOTE_SSH} ${SUDO} pfctl -si | grep '^Status: Enabled ' - ssh ${REMOTE_SSH} perl -MIO::Socket::INET6 -MSocket6 -e 1 + ssh ${REMOTE_SSH} perl -MSocket6 -e 1 .include diff --git a/regress/sys/net/pf_divert/Packet.pm b/regress/sys/net/pf_divert/Packet.pm index dd84db8fa78..efea19f4741 100644 --- a/regress/sys/net/pf_divert/Packet.pm +++ b/regress/sys/net/pf_divert/Packet.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Packet.pm,v 1.4 2017/12/18 17:01:27 bluhm Exp $ +# $OpenBSD: Packet.pm,v 1.5 2021/12/12 21:16:53 bluhm Exp $ # Copyright (c) 2010-2017 Alexander Bluhm # @@ -23,7 +23,7 @@ use Carp; use Socket; use Socket6; use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP -register; use constant IPPROTO_DIVERT => 258; @@ -45,7 +45,7 @@ sub new { and die ref($self), " system '@cmd' failed: $?"; } - my $ds = do { local $> = 0; IO::Socket::INET6->new( + my $ds = do { local $> = 0; IO::Socket->new( Type => Socket::SOCK_RAW, Proto => IPPROTO_DIVERT, Domain => $self->{domain}, diff --git a/regress/sys/net/pf_divert/Server.pm b/regress/sys/net/pf_divert/Server.pm index 564f11da221..63395d467ea 100644 --- a/regress/sys/net/pf_divert/Server.pm +++ b/regress/sys/net/pf_divert/Server.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Server.pm,v 1.5 2017/12/18 17:01:27 bluhm Exp $ +# $OpenBSD: Server.pm,v 1.6 2021/12/12 21:16:53 bluhm Exp $ # Copyright (c) 2010-2017 Alexander Bluhm # @@ -23,7 +23,7 @@ use Carp; use Socket qw(IPPROTO_TCP TCP_NODELAY); use Socket6; use IO::Socket; -use IO::Socket::INET6; +use IO::Socket::IP -register; sub new { my $class = shift; @@ -45,7 +45,7 @@ sub new { and die ref($self), " system '@cmd' failed: $?"; } - my $ls = do { local $> = 0; IO::Socket::INET6->new( + my $ls = do { local $> = 0; IO::Socket->new( Type => $self->{socktype}, Proto => $self->{protocol}, ReuseAddr => 1, @@ -100,8 +100,10 @@ sub child { print STDERR "accept peer: ",$as->peerhost()," ", $as->peerport(),"\n"; } - $as->blocking($self->{nonblocking} ? 0 : 1) - or die ref($self), " non-blocking accept failed: $!"; + if ($self->{nonblocking}) { + $as->blocking(0) + or die ref($self), " set non-blocking accept failed: $!"; + } open(STDIN, '<&', $as) or die ref($self), " dup STDIN failed: $!"; -- 2.20.1