summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvs <mvs@cvs.openbsd.org>2020-06-18 11:44:47 +0000
committermvs <mvs@cvs.openbsd.org>2020-06-18 11:44:47 +0000
commitd225d117bfd8a211c956804888dba1ed8f974857 (patch)
treef3144c24761cc38955b7918f82ef9d2288172e11
parent6aaaf89598b54b18163127c67f76058b578da293 (diff)
Add test that splicing inet and unix sockets. This test should be aborted
with EPROTONOSUPPORT. ok mpi@
-rw-r--r--regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl b/regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
new file mode 100644
index 00000000000..56806b933f1
--- /dev/null
+++ b/regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
@@ -0,0 +1,24 @@
+# test EPROTONOSUPPORT for splicing inet and unix sockets
+
+use strict;
+use warnings;
+use IO::Socket;
+use BSD::Socket::Splice "SO_SPLICE";
+use IO::Socket::UNIX;
+
+our %args = (
+ errno => 'EPROTONOSUPPORT',
+ func => sub {
+ my $s = IO::Socket::INET->new(
+ Proto => "udp",
+ LocalAddr => "127.0.0.1",
+ ) or die "socket bind failed: $!";
+
+ my $ss = IO::Socket::UNIX->new(
+ Type => SOCK_STREAM,
+ ) or die "socket splice failed: $!";
+
+ $s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $ss->fileno()))
+ and die "splice inet and unix sockets succeeded";
+ },
+);