summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/sys/kern/sosplice/funcs.pl119
-rw-r--r--regress/sys/kern/sosplice/tcp/args-inet6-client.pl2
-rw-r--r--regress/sys/kern/sosplice/tcp/args-inet6-server.pl2
-rw-r--r--regress/sys/kern/sosplice/tcp/args-inet6.pl2
-rw-r--r--regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl4
-rw-r--r--regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl4
-rw-r--r--regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl4
-rw-r--r--regress/sys/kern/sosplice/udp/args-idle-timeout.pl14
-rw-r--r--regress/sys/kern/sosplice/udp/args-idle-trickle.pl9
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6-client.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6-server.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-long.pl4
-rw-r--r--regress/sys/kern/sosplice/udp/args-max-multi.pl18
-rw-r--r--regress/sys/kern/sosplice/udp/args-max-nosplit.pl18
-rw-r--r--regress/sys/kern/sosplice/udp/args-max.pl5
-rw-r--r--regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl24
-rw-r--r--regress/sys/kern/sosplice/udp/args-multi.pl3
-rw-r--r--regress/sys/kern/sosplice/udp/args-nospace.pl10
-rw-r--r--regress/sys/kern/sosplice/udp/args-sleep-client.pl21
-rw-r--r--regress/sys/kern/sosplice/udp/args-sleep-relay.pl19
-rw-r--r--regress/sys/kern/sosplice/udp/args-write.pl26
-rw-r--r--regress/sys/kern/sosplice/udp/args-zero.pl13
-rw-r--r--regress/sys/kern/sosplice/udp/direct.pl3
-rw-r--r--regress/sys/kern/sosplice/udp/relay.pl5
-rw-r--r--regress/sys/kern/sosplice/udp/remote.pl5
26 files changed, 289 insertions, 51 deletions
diff --git a/regress/sys/kern/sosplice/funcs.pl b/regress/sys/kern/sosplice/funcs.pl
index d82b7e92970..13b8f2ad3ac 100644
--- a/regress/sys/kern/sosplice/funcs.pl
+++ b/regress/sys/kern/sosplice/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.2 2013/01/04 12:43:52 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.3 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -52,9 +52,8 @@ sub write_stream {
}
}
if ($len) {
- $char = "\n";
- $ctx->add($char);
- print $char
+ $ctx->add("\n");
+ print "\n"
or die ref($self), " print failed: $!";
print STDERR ".\n";
}
@@ -98,9 +97,8 @@ sub write_oob {
}
}
if ($len) {
- $char = "\n";
- $msg .= $char;
- $ctx->add($char);
+ $msg .= "\n";
+ $ctx->add("\n");
send(STDOUT, $msg, 0)
or die ref($self), " send failed: $!";
print STDERR ".\n";
@@ -135,9 +133,8 @@ sub write_datagram {
}
}
if ($l) {
- $char = "\n";
- $ctx->add($char);
- $string .= $char;
+ $ctx->add("\n");
+ $string .= "\n";
}
defined(my $write = syswrite(STDOUT, $string))
or die ref($self), " syswrite number $num failed: $!";
@@ -287,7 +284,7 @@ sub relay_copy_datagram {
select(undef, $win, undef, undef)
or die ref($self), " select write failed: $!";
}
- defined(my $write = syswrite(STDOUT, $buf)) || $!{EMSGSIZE}
+ defined(my $write = syswrite(STDOUT, $buf))
or die ref($self), " syswrite number $num failed: $!";
if (defined($write)) {
$read == $write
@@ -317,7 +314,7 @@ sub relay_copy {
}
}
-sub relay_splice {
+sub relay_splice_stream {
my $self = shift;
my $max = $self->{max};
my $idle = $self->{idle};
@@ -353,7 +350,7 @@ sub relay_splice {
defined($error = geterror(\*STDIN))
or die ref($self), " get error from stdin failed: $!";
- ($! = $error) && ! $!{ETIMEDOUT} && ! $!{EMSGSIZE}
+ ($! = $error) && ! $!{ETIMEDOUT} && ! $!{ERANGE}
and die ref($self), " splice failed: $!";
defined($splicelen = getsplice(\*STDIN))
@@ -384,6 +381,68 @@ sub relay_splice {
print STDERR "LEN: $len\n";
}
+sub relay_splice_datagram {
+ my $self = shift;
+ my $max = $self->{max};
+ my $idle = $self->{idle};
+
+ my $splicemax = $max || 0;
+ setsplice(\*STDIN, \*STDOUT, $splicemax, $idle)
+ or die ref($self), " splice stdin to stdout failed: $!";
+
+ my $rin = '';
+ vec($rin, fileno(STDIN), 1) = 1;
+ select($rin, undef, undef, undef)
+ or die ref($self), " select failed: $!";
+
+ defined(my $error = geterror(\*STDIN))
+ or die ref($self), " get error from stdin failed: $!";
+ ($! = $error) && ! $!{ETIMEDOUT} && ! $!{ERANGE}
+ and die ref($self), " splice failed: $!";
+
+ defined(my $splicelen = getsplice(\*STDIN))
+ or die ref($self), " get splice len from stdin failed: $!";
+ print STDERR "SPLICELEN: $splicelen\n";
+ !$max || $splicelen <= $splicemax
+ or die ref($self), " splice len $splicelen ".
+ "greater than max $splicemax";
+ my $len = $splicelen;
+
+ if ($idle && $error == Errno::ETIMEDOUT) {
+ print STDERR "Timeout\n";
+ }
+ if ($max && $max > $len) {
+ defined(my $read = sysread(STDIN, my $buf, $max - $len))
+ or die ref($self), " sysread stdin max failed: $!";
+ $len += $read;
+ }
+ if ($max && $max == $len) {
+ print STDERR "Max\n";
+ } elsif ($max && $max < $len) {
+ die ref($self), " max $max less than len $len";
+ } elsif ($max && $max > $len && $splicelen) {
+ die ref($self), " max $max greater than len $len";
+ } elsif (!$error) {
+ defined(my $read = sysread(STDIN, my $buf, 2**16))
+ or die ref($self), " sysread stdin failed: $!";
+ $read > 0
+ and die ref($self), " sysread stdin has data: $read";
+ print STDERR "End\n";
+ }
+ print STDERR "LEN: $splicelen\n";
+}
+
+sub relay_splice {
+ my $self = shift;
+ my $protocol = $self->{protocol} || "tcp";
+
+ given ($protocol) {
+ when (/tcp/) { relay_splice_stream($self, @_) }
+ when (/udp/) { relay_splice_datagram($self, @_) }
+ default { die ref($self), " unknown protocol name: $protocol" }
+ }
+}
+
sub relay {
my $self = shift;
my $forward = $self->{forward};
@@ -516,16 +575,27 @@ sub read_oob {
sub read_datagram {
my $self = shift;
- my $num = $self->{num} // 1;
my $max = $self->{max};
+ my $idle = $self->{idle};
my $size = $self->{size} || 2**16;
my $ctx = Digest::MD5->new();
my $len = 0;
my @lengths;
- for (my $i = 0; $i < $num; $i++) {
+ for (my $num = 0;; $num++) {
+ if ($idle) {
+ my $rin = '';
+ vec($rin, fileno(STDIN), 1) = 1;
+ defined(my $n = select($rin, undef, undef, $idle))
+ or die ref($self), " select idle failed: $!";
+ if ($n == 0) {
+ print STDERR "\n";
+ print STDERR "Timeout";
+ last;
+ }
+ }
defined(my $read = sysread(STDIN, my $buf, $size))
- or die ref($self), " sysread number $i failed: $!";
+ or die ref($self), " sysread number $num failed: $!";
$len += $read;
push @lengths, $read;
$ctx->add($buf);
@@ -558,17 +628,24 @@ sub check_logs {
return if $args{nocheck};
- $r->loggrep(qr/^Timeout$/) or die "no relay timeout"
- if $r && $args{relay}{timeout};
- $r->loggrep(qr/^Max$/) or die "no relay max"
- if $r && $args{relay}{max} && $args{len};
-
+ check_relay($c, $r, $s, %args);
check_len($c, $r, $s, %args);
check_lengths($c, $r, $s, %args);
check_md5($c, $r, $s, %args);
check_error($c, $r, $s, %args);
}
+sub check_relay {
+ my ($c, $r, $s, %args) = @_;
+
+ $r->loggrep(qr/^Timeout$/) or die "no relay timeout"
+ if $r && $args{relay}{timeout};
+ $r->loggrep(qr/^Max$/) or die "no relay max"
+ if $r && $args{relay}{max} && $args{len};
+ $r->loggrep(qr/^End$/) or die "no relay end"
+ if $r && $args{relay}{end};
+}
+
sub check_len {
my ($c, $r, $s, %args) = @_;
diff --git a/regress/sys/kern/sosplice/tcp/args-inet6-client.pl b/regress/sys/kern/sosplice/tcp/args-inet6-client.pl
index 0a676835700..c3e22c23528 100644
--- a/regress/sys/kern/sosplice/tcp/args-inet6-client.pl
+++ b/regress/sys/kern/sosplice/tcp/args-inet6-client.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET,
listenaddr => "127.0.0.1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/tcp/args-inet6-server.pl b/regress/sys/kern/sosplice/tcp/args-inet6-server.pl
index 66975ce563a..615e126700e 100644
--- a/regress/sys/kern/sosplice/tcp/args-inet6-server.pl
+++ b/regress/sys/kern/sosplice/tcp/args-inet6-server.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/tcp/args-inet6.pl b/regress/sys/kern/sosplice/tcp/args-inet6.pl
index c84a85f61a4..4ac32c76e6d 100644
--- a/regress/sys/kern/sosplice/tcp/args-inet6.pl
+++ b/regress/sys/kern/sosplice/tcp/args-inet6.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl
index 5f40cf86400..b39c6cfa04a 100644
--- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl
+++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl
@@ -8,7 +8,9 @@ our %args = (
func => sub { sleep 3; write_stream(@_); },
},
relay => {
- func => sub { relay(@_, 61); relay_copy(@_); },
+ func => sub { relay(@_); relay_copy(@_); },
+ max => 197,
+ end => 1,
nocheck => 1,
},
len => 251,
diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl
index 088250d6fb9..7c0a35b3a53 100644
--- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl
+++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl
@@ -5,7 +5,9 @@ use warnings;
our %args = (
relay => {
- func => sub { sleep 3; relay(@_, 61); relay_copy(@_); },
+ func => sub { sleep 3; relay(@_); relay_copy(@_); },
+ max => 197,
+ end => 1,
nocheck => 1,
},
len => 251,
diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl
index fee64499e92..c22659ea0cf 100644
--- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl
+++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl
@@ -5,7 +5,9 @@ use warnings;
our %args = (
relay => {
- func => sub { relay(@_, 61); relay_copy(@_); },
+ func => sub { relay(@_); relay_copy(@_); },
+ max => 197,
+ end => 1,
nocheck => 1,
},
server => {
diff --git a/regress/sys/kern/sosplice/udp/args-idle-timeout.pl b/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
index 5e58a1225e4..cf4c3b74c73 100644
--- a/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
+++ b/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
@@ -1,16 +1,22 @@
-# test idle timeout
+# test idle timeout, must not be too long
use strict;
use warnings;
+my @lengths = (1, 2);
+
our %args = (
client => {
- func => sub { sleep 1; write_datagram(@_); sleep 3; },
+ func => sub { sleep 1; write_datagram(@_); },
+ lengths => \@lengths,
+ sleep => 3,
+ nocheck => 1,
},
relay => {
idle => 2,
timeout => 1,
},
- len => 251,
- md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+ len => 1,
+ lengths => "1",
+ md5 => "68b329da9893e34099c7d8ad5cb9c940",
);
diff --git a/regress/sys/kern/sosplice/udp/args-idle-trickle.pl b/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
index 738c0278f09..c5aad047a69 100644
--- a/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
+++ b/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
@@ -1,10 +1,10 @@
-# test idle timeout
+# test idle timeout, must not be to short
use strict;
use warnings;
use List::Util qw(sum);
-my @lengths = (0, 1, 2, 3, 4, 5);
+my @lengths = (1, 2, 3);
our %args = (
client => {
@@ -15,10 +15,7 @@ our %args = (
idle => 2,
timeout => 1,
},
- server => {
- num => scalar @lengths,
- },
len => sum(@lengths),
lengths => "@lengths",
- md5 => "a5612eb5137e859bf52c515a890241a5",
+ md5 => "868972544a6c4312aa52568c8dfa2366",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6-client.pl b/regress/sys/kern/sosplice/udp/args-inet6-client.pl
index 0a676835700..c3e22c23528 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6-client.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6-client.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET,
listenaddr => "127.0.0.1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6-server.pl b/regress/sys/kern/sosplice/udp/args-inet6-server.pl
index 66975ce563a..615e126700e 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6-server.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6-server.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6.pl b/regress/sys/kern/sosplice/udp/args-inet6.pl
index c84a85f61a4..4ac32c76e6d 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-long.pl b/regress/sys/kern/sosplice/udp/args-long.pl
index 0323385faf9..529dc2b756b 100644
--- a/regress/sys/kern/sosplice/udp/args-long.pl
+++ b/regress/sys/kern/sosplice/udp/args-long.pl
@@ -9,13 +9,13 @@ our %args = (
sndbuf => 2**16,
},
relay => {
- timeout => 10,
+ idle => 6,
size => 2**16,
sndbuf => 2**16,
rcvbuf => 2**16,
},
server => {
- num => 1,
+ idle => 7,
rcvbuf => 2**16,
},
len => 65507,
diff --git a/regress/sys/kern/sosplice/udp/args-max-multi.pl b/regress/sys/kern/sosplice/udp/args-max-multi.pl
new file mode 100644
index 00000000000..a1ea7d14a3b
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-max-multi.pl
@@ -0,0 +1,18 @@
+# test maximum data length with maximum reached with multiple packets in rcvbuf
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ lengths => [ 1, 2, 3 ],
+ nocheck => 1,
+ },
+ relay => {
+ funcs => sub { sleep 3; relay(@_); },
+ max => 4,
+ },
+ len => 3,
+ lengths => "1 2",
+ md5 => "52f58714e430f1fc84346961c240054b",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-max-nosplit.pl b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl
new file mode 100644
index 00000000000..904f2a2ef60
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl
@@ -0,0 +1,18 @@
+# test maximum data length
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ lengths => [ 1, 3, 1 ],
+ func => sub { errignore(@_); write_datagram(@_); },
+ nocheck => 1,
+ },
+ relay => {
+ max => 2,
+ },
+ len => 1,
+ lengths => "1",
+ md5 => "68b329da9893e34099c7d8ad5cb9c940",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-max.pl b/regress/sys/kern/sosplice/udp/args-max.pl
index 8d8beac72de..641cf9bdbfe 100644
--- a/regress/sys/kern/sosplice/udp/args-max.pl
+++ b/regress/sys/kern/sosplice/udp/args-max.pl
@@ -12,10 +12,7 @@ our %args = (
relay => {
max => 4,
},
- server => {
- num => 2,
- },
len => 4,
lengths => "1 3",
- md5 => "07515c3ca1f21779d63135eb5531eca2",
+ md5 => "5df2ad5a8fa778004d06dc070811754c",
);
diff --git a/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl
new file mode 100644
index 00000000000..906019b996d
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl
@@ -0,0 +1,24 @@
+# test with multiple packets, client sleeps before and during send
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (5, 4, 3, 2, 1, 0);
+
+our %args = (
+ client => {
+ func => sub { sleep 3; write_datagram(@_); },
+ lengths => \@lengths,
+ },
+ relay => {
+ idle => 5,
+ func => sub { relay(@_); relay_copy(@_); },
+ max => 9,
+ timeout => 1,
+ nocheck => 1,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "464ddb107046ee0a42f43b202e826b8f",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-multi.pl b/regress/sys/kern/sosplice/udp/args-multi.pl
index b61b812c6aa..df86b81396e 100644
--- a/regress/sys/kern/sosplice/udp/args-multi.pl
+++ b/regress/sys/kern/sosplice/udp/args-multi.pl
@@ -16,10 +16,9 @@ our %args = (
sndbuf => 20000,
},
server => {
- num => scalar @lengths,
rcvbuf => 20000,
},
len => sum(@lengths),
lengths => "@lengths",
- md5 => "f5b58b46c97b566fc8d34080c475d637",
+ md5 => "544464f20384567028998e1a1a4c5b1e",
);
diff --git a/regress/sys/kern/sosplice/udp/args-nospace.pl b/regress/sys/kern/sosplice/udp/args-nospace.pl
index 06d517eb191..d5541affcdd 100644
--- a/regress/sys/kern/sosplice/udp/args-nospace.pl
+++ b/regress/sys/kern/sosplice/udp/args-nospace.pl
@@ -10,14 +10,16 @@ our %args = (
nocheck => 1,
},
relay => {
+ func => sub { sleep 3; errignore(@_); relay(@_); },
+ down => "Message too long",
rcvbuf => 30000,
sndbuf => 10000,
+ nocheck => 1,
},
server => {
- num => 4,
rcvbuf => 30000,
},
- len => 10006,
- lengths => "1 10000 2 3",
- md5 => "90c347b1853f03d6e73aa88c9d12ce55",
+ len => 10003,
+ lengths => "1 10000 2",
+ md5 => "2ec9a4b45a449095245177d2cf51dd24",
);
diff --git a/regress/sys/kern/sosplice/udp/args-sleep-client.pl b/regress/sys/kern/sosplice/udp/args-sleep-client.pl
new file mode 100644
index 00000000000..e9d1cd8b55d
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-sleep-client.pl
@@ -0,0 +1,21 @@
+# test with multiple packets, client sleeps before and during send
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (0, 1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ func => sub { sleep 3; write_datagram(@_); },
+ lengths => \@lengths,
+ sleep => 1,
+ },
+ relay => {
+ idle => 5,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "553af7b8fc0e205ead2562ab61a2ad13",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-sleep-relay.pl b/regress/sys/kern/sosplice/udp/args-sleep-relay.pl
new file mode 100644
index 00000000000..da8d12941a2
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-sleep-relay.pl
@@ -0,0 +1,19 @@
+# test with multiple packets, relay sleeps before processing
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (0, 1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ lengths => \@lengths,
+ },
+ relay => {
+ func => sub { sleep 3; relay(@_); },
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "553af7b8fc0e205ead2562ab61a2ad13",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-write.pl b/regress/sys/kern/sosplice/udp/args-write.pl
new file mode 100644
index 00000000000..bcfe01ae5aa
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-write.pl
@@ -0,0 +1,26 @@
+# test mix write and relay
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ lengths => [ 2, 3, 4 ],
+ nocheck => 1,
+ },
+ relay => {
+ func => sub {
+ write_stream(@_, 1);
+ IO::Handle::flush(\*STDOUT);
+ relay(@_);
+ write_stream(@_, 5);
+ },
+ nocheck => 1,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "1830da3b4358ccedeb49877c2cff8c86",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-zero.pl b/regress/sys/kern/sosplice/udp/args-zero.pl
new file mode 100644
index 00000000000..13975f84cc9
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-zero.pl
@@ -0,0 +1,13 @@
+# test sending zero size udp packet
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ len => 0,
+ },
+ len => 0,
+ lengths => "0",
+ md5 => "d41d8cd98f00b204e9800998ecf8427e",
+);
diff --git a/regress/sys/kern/sosplice/udp/direct.pl b/regress/sys/kern/sosplice/udp/direct.pl
index b07bb64b9ad..f8838375638 100644
--- a/regress/sys/kern/sosplice/udp/direct.pl
+++ b/regress/sys/kern/sosplice/udp/direct.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: direct.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: direct.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -39,6 +39,7 @@ if (@ARGV and -f $ARGV[-1]) {
@ARGV == 0 or usage();
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
%{$args{server}},
protocol => "udp",
diff --git a/regress/sys/kern/sosplice/udp/relay.pl b/regress/sys/kern/sosplice/udp/relay.pl
index 583cffc3085..0c1a9a1037c 100644
--- a/regress/sys/kern/sosplice/udp/relay.pl
+++ b/regress/sys/kern/sosplice/udp/relay.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: relay.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: relay.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -39,6 +39,7 @@ if (@ARGV and -f $ARGV[-1]) {
@ARGV == 1 or usage();
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
listendomain => AF_INET,
listenaddr => "127.0.0.1",
@@ -47,7 +48,7 @@ my $s = Server->new(
);
my $r = Relay->new(
forward => $ARGV[0],
- idle => 5,
+ idle => 3,
func => \&relay,
listendomain => AF_INET,
listenaddr => "127.0.0.1",
diff --git a/regress/sys/kern/sosplice/udp/remote.pl b/regress/sys/kern/sosplice/udp/remote.pl
index cf07bdcbca0..4168797e9d2 100644
--- a/regress/sys/kern/sosplice/udp/remote.pl
+++ b/regress/sys/kern/sosplice/udp/remote.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: remote.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: remote.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -61,7 +61,7 @@ if ($mode eq "relay") {
$r = Relay->new(
forward => $ARGV[0],
logfile => dirname($0)."/remote.log",
- idle => 5,
+ idle => 3,
func => \&relay,
%{$args{relay}},
protocol => "udp",
@@ -91,6 +91,7 @@ if ($mode eq "relay") {
}
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
%{$args{server}},
protocol => "udp",