summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvs <mvs@openbsd.org>2020-06-18 11:44:46 +0000
committermvs <mvs@openbsd.org>2020-06-18 11:44:46 +0000
commit8c7e41e83c80180a9bb0285a59e865311b5a44e7 (patch)
tree4ddb8043ddd7a7bf393db01367e47cd314500eb9
parentThe same simplification can be done a second time: widen the type, (diff)
downloadwireguard-openbsd-8c7e41e83c80180a9bb0285a59e865311b5a44e7.tar.xz
wireguard-openbsd-8c7e41e83c80180a9bb0285a59e865311b5a44e7.zip
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";
+ },
+);