summaryrefslogtreecommitdiffstats
path: root/regress
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2020-05-25 10:59:18 +0000
committerbluhm <bluhm@openbsd.org>2020-05-25 10:59:18 +0000
commitc951295a056ac5d81e1128f828978ad408e27498 (patch)
tree42ccbf14d7eae2cc7e8e4ce296e56af8850d468f /regress
parentWhen DNS lookup of an UDP loghost failed, syslogd(8) did close the (diff)
downloadwireguard-openbsd-c951295a056ac5d81e1128f828978ad408e27498.tar.xz
wireguard-openbsd-c951295a056ac5d81e1128f828978ad408e27498.zip
Test that syslogd closes the UDP sockets only if not configured to
send UDP packets.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/syslogd/args-socket-udp-close.pl25
-rw-r--r--regress/usr.sbin/syslogd/args-socket-udp-keep.pl27
2 files changed, 52 insertions, 0 deletions
diff --git a/regress/usr.sbin/syslogd/args-socket-udp-close.pl b/regress/usr.sbin/syslogd/args-socket-udp-close.pl
new file mode 100644
index 00000000000..292f52cd192
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-socket-udp-close.pl
@@ -0,0 +1,25 @@
+# The client writes a message to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via IPv4 TCP to an explicit loghost.
+# The server receives the message on its TCP socket.
+# Find the message in client, file, pipe, syslogd, server log.
+# Check that the syslogd has closed UDP sockets in fstat output.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ syslogd => {
+ loghost => '@tcp://127.0.0.1:$connectport',
+ fstat => {
+ qr/ internet dgram udp \*:514$/ => 0,
+ qr/ internet6 dgram udp \*:514$/ => 0,
+ },
+ },
+ server => {
+ listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-socket-udp-keep.pl b/regress/usr.sbin/syslogd/args-socket-udp-keep.pl
new file mode 100644
index 00000000000..2e3759328e3
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-socket-udp-keep.pl
@@ -0,0 +1,27 @@
+# The client writes a message to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via IPv4 TCP to an explicit loghost.
+# The server receives the message on its TCP socket.
+# Find the message in client, file, pipe, syslogd, server log.
+# Syslogd should send to a non existing UDP host, DNS lookup fails.
+# Check that the syslogd keeps UDP sockets in fstat output.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ syslogd => {
+ loghost => '@tcp://127.0.0.1:$connectport',
+ conf => "*.*\t\@udp6://nonexist.example.com\n",
+ fstat => {
+ qr/ internet dgram udp \*:514$/ => 0,
+ qr/ internet6 dgram udp \*:514$/ => 1,
+ },
+ },
+ server => {
+ listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" },
+ },
+);
+
+1;