summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-23 14:35:16 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-23 14:35:16 +0000
commitc9acef3ee3168170dcc57b9fd89f55abab09b0a4 (patch)
tree0ab3e489f8a47535d848afe9c1a014268d711d3e
parentf6cb8d56b9aaa0392d6eb489da45554b1757aa82 (diff)
The TCP socket buffer size for syslogd has changed. Adapt tests
where we count the dropped messages. A different number gets stuck in the kernel buffers now which is not included in the syslogd statistics.
-rw-r--r--regress/usr.sbin/syslogd/Client.pm12
-rw-r--r--regress/usr.sbin/syslogd/Server.pm12
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tcp.pl19
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tls.pl19
-rw-r--r--regress/usr.sbin/syslogd/args-sync-tcp.pl1
9 files changed, 57 insertions, 30 deletions
diff --git a/regress/usr.sbin/syslogd/Client.pm b/regress/usr.sbin/syslogd/Client.pm
index 91db547c232..efca2d85ec7 100644
--- a/regress/usr.sbin/syslogd/Client.pm
+++ b/regress/usr.sbin/syslogd/Client.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Client.pm,v 1.7 2016/09/21 12:01:17 bluhm Exp $
+# $OpenBSD: Client.pm,v 1.8 2016/09/23 14:35:15 bluhm Exp $
# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -76,6 +76,16 @@ sub child {
(SSL_cipher_list => $self->{sslciphers}) : (),
) or die ref($self), " $iosocket socket connect ".
"failed: $!,$SSL_ERROR";
+ if ($self->{sndbuf}) {
+ setsockopt($cs, SOL_SOCKET, SO_SNDBUF,
+ pack('i', $self->{sndbuf})) or die
+ ref($self), " set SO_SNDBUF failed: $!";
+ }
+ if ($self->{rcvbuf}) {
+ setsockopt($cs, SOL_SOCKET, SO_RCVBUF,
+ pack('i', $self->{rcvbuf})) or die
+ ref($self), " set SO_RCVBUF failed: $!";
+ }
print STDERR "connect sock: ",$cs->sockhost()," ",
$cs->sockport(),"\n";
print STDERR "connect peer: ",$cs->peerhost()," ",
diff --git a/regress/usr.sbin/syslogd/Server.pm b/regress/usr.sbin/syslogd/Server.pm
index a044bb691e1..1aaf236d125 100644
--- a/regress/usr.sbin/syslogd/Server.pm
+++ b/regress/usr.sbin/syslogd/Server.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Server.pm,v 1.9 2016/09/21 12:01:17 bluhm Exp $
+# $OpenBSD: Server.pm,v 1.10 2016/09/23 14:35:15 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -61,6 +61,16 @@ sub listen {
$self->{sslversion} ? (SSL_version => $self->{sslversion}) : (),
$self->{sslciphers} ? (SSL_cipher_list => $self->{sslciphers}) : (),
) or die ref($self), " $iosocket socket failed: $!,$SSL_ERROR";
+ if ($self->{sndbuf}) {
+ setsockopt($ls, SOL_SOCKET, SO_SNDBUF,
+ pack('i', $self->{sndbuf}))
+ or die ref($self), " set SO_SNDBUF failed: $!";
+ }
+ if ($self->{rcvbuf}) {
+ setsockopt($ls, SOL_SOCKET, SO_RCVBUF,
+ pack('i', $self->{rcvbuf}))
+ or die ref($self), " set SO_RCVBUF failed: $!";
+ }
if ($self->{listenproto} ne "udp") {
listen($ls, 1)
or die ref($self), " socket listen failed: $!";
diff --git a/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl
index 0b0b1003282..42808c63940 100644
--- a/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl
@@ -33,6 +33,7 @@ our %args = (
},
server => {
listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ rcvbuf => 2**12,
redo => 0,
func => sub { read_between2logs(shift, sub {
my $self = shift;
@@ -55,8 +56,8 @@ our %args = (
get_thirdlog() => 0,
qr/syslogd: start/ => 1,
qr/syslogd: restart/ => 1,
- get_charlog() => '~43',
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ get_charlog() => '~88',
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
file => {
@@ -67,7 +68,7 @@ our %args = (
qr/syslogd: start/ => 1,
qr/syslogd: restart/ => 1,
get_charlog() => 300,
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
);
diff --git a/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl b/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl
index 9be95ba3ae3..4a42e5bcbfe 100644
--- a/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl
@@ -34,6 +34,7 @@ our %args = (
},
server => {
listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
+ rcvbuf => 2**12,
redo => 0,
func => sub { read_between2logs(shift, sub {
my $self = shift;
@@ -56,8 +57,8 @@ our %args = (
get_thirdlog() => 0,
qr/syslogd: start/ => 1,
qr/syslogd: restart/ => 1,
- get_charlog() => '~43',
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ get_charlog() => '~88',
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
file => {
@@ -68,7 +69,7 @@ our %args = (
qr/syslogd: start/ => 1,
qr/syslogd: restart/ => 1,
get_charlog() => 300,
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
);
diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl
index 3b988296997..9df6e5079b6 100644
--- a/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl
@@ -32,6 +32,7 @@ our %args = (
},
server => {
listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ rcvbuf => 2**12,
redo => 0,
func => sub {
my $self = shift;
@@ -49,7 +50,7 @@ our %args = (
get_thirdlog() => 0,
get_testgrep() => 0,
qr/syslogd: start/ => 1,
- get_charlog() => '>=10',
+ get_charlog() => '~88',
},
},
file => {
@@ -60,7 +61,7 @@ our %args = (
get_testgrep() => 0,
qr/syslogd: start/ => 1,
get_charlog() => 300,
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
pipe => { nocheck => 1 },
diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl
index 20b1e9e313d..7a1c4ac703a 100644
--- a/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl
@@ -33,6 +33,7 @@ our %args = (
},
server => {
listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
+ rcvbuf => 2**12,
redo => 0,
func => sub {
my $self = shift;
@@ -50,7 +51,7 @@ our %args = (
get_thirdlog() => 0,
get_testgrep() => 0,
qr/syslogd: start/ => 1,
- get_charlog() => '>=10',
+ get_charlog() => '~88',
},
},
file => {
@@ -61,7 +62,7 @@ our %args = (
get_testgrep() => 0,
qr/syslogd: start/ => 1,
get_charlog() => 300,
- qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1,
+ qr/syslogd: dropped 2[0-2][0-9] messages to remote loghost/ => 1,
},
},
pipe => { nocheck => 1 },
diff --git a/regress/usr.sbin/syslogd/args-dropped-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
index 7ce4536f768..38a8c3668c7 100644
--- a/regress/usr.sbin/syslogd/args-dropped-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
@@ -1,4 +1,4 @@
-# The client writes 300 messages to Sys::Syslog native method.
+# The client writes 400 messages to Sys::Syslog native method.
# The syslogd writes it into a file and through a pipe.
# The syslogd passes it via TCP to the loghost.
# The server blocks the message on its TCP socket.
@@ -6,7 +6,7 @@
# The server receives the message on its TCP socket.
# The client waits until the server as read the first message.
# Find the message in client, file, pipe, syslogd, server log.
-# Check that the 300 messages are in syslogd and file log.
+# Check that the 400 messages are in syslogd and file log.
# Check that the dropped message is in server and file log.
use strict;
@@ -18,7 +18,7 @@ our %args = (
func => sub { write_between2logs(shift, sub {
my $self = shift;
write_message($self, get_secondlog());
- write_lines($self, 300, 1024);
+ write_lines($self, 400, 1024);
write_message($self, get_thirdlog());
${$self->{server}}->loggrep(get_secondlog(), 5)
or die ref($self), " server did not receive second log";
@@ -30,12 +30,13 @@ our %args = (
loghost => '@tcp://localhost:$connectport',
loggrep => {
get_between2loggrep(),
- get_charlog() => 300,
- qr/ \(dropped\)/ => '>=10',
+ get_charlog() => 400,
+ qr/ \(dropped\)/ => '~68',
},
},
server => {
listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ rcvbuf => 2**12,
func => sub {
my $self = shift;
${$self->{syslogd}}->loggrep(get_thirdlog(), 20)
@@ -46,8 +47,8 @@ our %args = (
get_between2loggrep(),
get_secondlog() => 1,
get_thirdlog() => 0,
- get_charlog() => '~287',
- qr/syslogd: dropped 1[0-9] messages to loghost/ => 1,
+ get_charlog() => '~333',
+ qr/syslogd: dropped [67][0-9] messages to loghost/ => 1,
},
},
file => {
@@ -55,8 +56,8 @@ our %args = (
get_between2loggrep(),
get_secondlog() => 1,
get_thirdlog() => 1,
- get_charlog() => 300,
- qr/syslogd: dropped 1[0-9] messages to loghost/ => 1,
+ get_charlog() => 400,
+ qr/syslogd: dropped [67][0-9] messages to loghost/ => 1,
},
},
);
diff --git a/regress/usr.sbin/syslogd/args-dropped-tls.pl b/regress/usr.sbin/syslogd/args-dropped-tls.pl
index 602f2fed270..a0610caf708 100644
--- a/regress/usr.sbin/syslogd/args-dropped-tls.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-tls.pl
@@ -1,4 +1,4 @@
-# The client writes 310 messages to Sys::Syslog native method.
+# The client writes 400 messages to Sys::Syslog native method.
# The syslogd writes it into a file and through a pipe.
# The syslogd passes it via TLS to the loghost.
# The server blocks the message on its TLS socket.
@@ -6,7 +6,7 @@
# The server receives the message on its TLS socket.
# The client waits until the server as read the first message.
# Find the message in client, file, pipe, syslogd, server log.
-# Check that the 310 messages are in syslogd and file log.
+# Check that the 400 messages are in syslogd and file log.
# Check that the dropped message is in server and file log.
use strict;
@@ -18,7 +18,7 @@ our %args = (
func => sub { write_between2logs(shift, sub {
my $self = shift;
write_message($self, get_secondlog());
- write_lines($self, 310, 1024);
+ write_lines($self, 400, 1024);
write_message($self, get_thirdlog());
${$self->{server}}->loggrep(get_secondlog(), 5)
or die ref($self), " server did not receive second log";
@@ -30,8 +30,8 @@ our %args = (
loghost => '@tls://localhost:$connectport',
loggrep => {
get_between2loggrep(),
- get_charlog() => 310,
- qr/ \(dropped\)/ => '>=10',
+ get_charlog() => 400,
+ qr/ \(dropped\)/ => '~68',
qr/SSL3_WRITE_PENDING/ => 0,
},
},
@@ -43,12 +43,13 @@ our %args = (
or die ref($self), " syslogd did not receive third log";
read_log($self);
},
+ rcvbuf => 2**12,
loggrep => {
get_between2loggrep(),
get_secondlog() => 1,
get_thirdlog() => 0,
- get_charlog() => '~287',
- qr/syslogd: dropped [12][0-9] messages to loghost/ => 1,
+ get_charlog() => '~333',
+ qr/syslogd: dropped [67][0-9] messages to loghost/ => 1,
},
},
file => {
@@ -56,8 +57,8 @@ our %args = (
get_between2loggrep(),
get_secondlog() => 1,
get_thirdlog() => 1,
- get_charlog() => 310,
- qr/syslogd: dropped [12][0-9] messages to loghost/ => 1,
+ get_charlog() => 400,
+ qr/syslogd: dropped [67][0-9] messages to loghost/ => 1,
},
},
);
diff --git a/regress/usr.sbin/syslogd/args-sync-tcp.pl b/regress/usr.sbin/syslogd/args-sync-tcp.pl
index f37147a00d5..a2d936dd4f7 100644
--- a/regress/usr.sbin/syslogd/args-sync-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-sync-tcp.pl
@@ -39,6 +39,7 @@ our %args = (
},
server => {
listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" },
+ rcvbuf => 2**12,
redo => 0,
func => sub { read_between2logs(shift, sub {
my $self = shift;