sosplice(9) should provide EPROTONOSUPPORT error while we are splicing
sockets with different domains but there is not test for this case. Diff
below adds test for the case while we are thying to splice inet and unix
sockets. We can's splice unix sockets so there is no reason to test the
case for splicing unix and inet sockets.

Index: regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
===================================================================
RCS file: regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
diff -N regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regress/sys/kern/sosplice/error/args-inet-unix-EPROTONOSUPPORT.pl   16 Jun 
2020 09:24:20 -0000
@@ -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";
+    },
+);

Reply via email to