diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-08-25 19:32:30 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-08-25 19:32:30 +0000 |
commit | a5aef212047c1910e8fd4365972badb27267c35b (patch) | |
tree | 06295736789ef16ec1abb2ab0b61717b45030a17 | |
parent | a86e2f422c84636fad81d3d00d340c88159118b9 (diff) |
Add tests where the IP address family has been chosen by -4 or -6
command line switch and udp4:// or udp6:// loghost prefix.
-rw-r--r-- | regress/usr.sbin/syslogd/args-localhost-only4.pl | 20 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-localhost-only6.pl | 20 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-localhost-proto-udp4.pl | 21 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-localhost-proto-udp6.pl | 20 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-only4.pl | 33 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-only6.pl | 33 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-invalid.pl | 23 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp.pl | 24 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp4-host6.pl | 23 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp4-only6.pl | 24 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp4.pl | 24 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp6-host4.pl | 23 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp6-only4.pl | 24 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-proto-udp6.pl | 24 |
14 files changed, 336 insertions, 0 deletions
diff --git a/regress/usr.sbin/syslogd/args-localhost-only4.pl b/regress/usr.sbin/syslogd/args-localhost-only4.pl new file mode 100644 index 00000000000..e350ac8d595 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-localhost-only4.pl @@ -0,0 +1,20 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd -4 passes it via IPv4 UDP to localhost. +# The server receives the message on its UDP socket. +# Check that localhost gets resolved to the 127.0.0.1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@localhost.:$connectport', + options => ["-4"], + }, + server => { + listen => { domain => AF_INET, addr => "127.0.0.1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-localhost-only6.pl b/regress/usr.sbin/syslogd/args-localhost-only6.pl new file mode 100644 index 00000000000..c6b3e2cca5c --- /dev/null +++ b/regress/usr.sbin/syslogd/args-localhost-only6.pl @@ -0,0 +1,20 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd -6 passes it via IPv6 UDP to localhost. +# The server receives the message on its UDP socket. +# Check that localhost gets resolved to the ::1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@localhost.:$connectport', + options => ["-6"], + }, + server => { + listen => { domain => AF_INET6, addr => "::1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-localhost-proto-udp4.pl b/regress/usr.sbin/syslogd/args-localhost-proto-udp4.pl new file mode 100644 index 00000000000..820cad18f63 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-localhost-proto-udp4.pl @@ -0,0 +1,21 @@ +# 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 explicit IPv4 UDP to localhost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that localhost gets resolved to the 127.0.0.1 address. + + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp4://localhost.:$connectport', + }, + server => { + listen => { domain => AF_INET, addr => "127.0.0.1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-localhost-proto-udp6.pl b/regress/usr.sbin/syslogd/args-localhost-proto-udp6.pl new file mode 100644 index 00000000000..7b00b59669f --- /dev/null +++ b/regress/usr.sbin/syslogd/args-localhost-proto-udp6.pl @@ -0,0 +1,20 @@ +# 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 explicit IPv6 UDP to localhost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that localhost gets resolved to the ::1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp6://localhost.:$connectport', + }, + server => { + listen => { domain => AF_INET6, addr => "::1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-only4.pl b/regress/usr.sbin/syslogd/args-only4.pl new file mode 100644 index 00000000000..a22eb4afe90 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-only4.pl @@ -0,0 +1,33 @@ +# The client writes a message to a localhost IPv4 UDP socket. +# The syslogd writes it into a file and through a pipe. +# The syslogd -4 passes it via IPv4 UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that the syslogd has no IPv6 socket in fstat output. + +use strict; +use warnings; + +our %args = ( + client => { + connect => { domain => AF_INET, addr => "127.0.0.1", port => 514 }, + }, + syslogd => { + fstat => 1, + loghost => '@127.0.0.1:$connectport', + options => ["-4nu"], + }, + server => { + listen => { domain => AF_INET, addr => "127.0.0.1" }, + }, + file => { + loggrep => qr/ 127.0.0.1 /. get_log(), + }, + fstat => { + loggrep => { + qr/ internet6 / => 0, + }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-only6.pl b/regress/usr.sbin/syslogd/args-only6.pl new file mode 100644 index 00000000000..019bcb1cdb0 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-only6.pl @@ -0,0 +1,33 @@ +# The client writes a message to a localhost IPv6 UDP socket. +# The syslogd writes it into a file and through a pipe. +# The syslogd -6 passes it via IPv6 UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that the syslogd has no IPv4 socket in fstat output. + +use strict; +use warnings; + +our %args = ( + client => { + connect => { domain => AF_INET6, addr => "::1", port => 514 }, + }, + syslogd => { + fstat => 1, + loghost => '@[::1]:$connectport', + options => ["-6nu"], + }, + server => { + listen => { domain => AF_INET6, addr => "::1" }, + }, + file => { + loggrep => qr/ ::1 /. get_log(), + }, + fstat => { + loggrep => { + qr/ internet / => 0, + }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-invalid.pl b/regress/usr.sbin/syslogd/args-proto-invalid.pl new file mode 100644 index 00000000000..9394660aa22 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-invalid.pl @@ -0,0 +1,23 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd does not pass it via invalid IPv4 UDP to the loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that the syslogd logs the error. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@invalid://127.0.0.1', + loggrep => { + qr/syslogd: bad protocol "\@invalid:\/\/127.0.0.1"/ => 2, # XXX 2? + get_log() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp.pl b/regress/usr.sbin/syslogd/args-proto-udp.pl new file mode 100644 index 00000000000..3ff58d9af32 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp.pl @@ -0,0 +1,24 @@ +# 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 explicit UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that syslogd log contains the 127.0.0.1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp://127.0.0.1:$connectport', + loggrep => { + qr/Logging to FORW \@udp:\/\/127.0.0.1:\d+/ => 5, + get_log() => 1, + }, + }, + server => { + listen => { domain => AF_INET, addr => "127.0.0.1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl new file mode 100644 index 00000000000..e741fbd43b8 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl @@ -0,0 +1,23 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd does not pass it via IPv4 UDP to the IPv6 loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that the syslogd logs the error. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp4://[::1]', + loggrep => { + qr/syslogd: bad hostname "\@udp4:\/\/\[::1\]"/ => 2, # XXX 2? + get_log() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl new file mode 100644 index 00000000000..15235527117 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl @@ -0,0 +1,24 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd -6 does not pass it via IPv4 UDP to the loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that the syslogd logs the error. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp4://127.0.0.1', + loggrep => { + qr/syslogd: no udp4 "\@udp4:\/\/127.0.0.1/ => 2, # XXX 2? + get_log() => 1, + }, + options => ["-6"], + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp4.pl b/regress/usr.sbin/syslogd/args-proto-udp4.pl new file mode 100644 index 00000000000..52a72e3062a --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp4.pl @@ -0,0 +1,24 @@ +# 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 explicit IPv4 UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that syslogd log contains the 127.0.0.1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp4://127.0.0.1:$connectport', + loggrep => { + qr/Logging to FORW \@udp4:\/\/127.0.0.1:\d+/ => 5, + get_log() => 1, + }, + }, + server => { + listen => { domain => AF_INET, addr => "127.0.0.1" }, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl new file mode 100644 index 00000000000..4fadf1af834 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl @@ -0,0 +1,23 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd does not pass it via IPv6 UDP to the IPv4 loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that the syslogd logs the error. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp6://127.0.0.1', + loggrep => { + qr/syslogd: bad hostname "\@udp6:\/\/127.0.0.1"/ => 2, # XXX 2? + get_log() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl new file mode 100644 index 00000000000..630807d4020 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl @@ -0,0 +1,24 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd -4 does not pass it via IPv6 UDP to the loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that the syslogd logs the error. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp6://[::1]', + loggrep => { + qr/syslogd: no udp6 "\@udp6:\/\/\[::1\]/ => 2, # XXX 2? + get_log() => 1, + }, + options => ["-4"], + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp6.pl b/regress/usr.sbin/syslogd/args-proto-udp6.pl new file mode 100644 index 00000000000..6d609dd4521 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-proto-udp6.pl @@ -0,0 +1,24 @@ +# 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 explicit IPv6 UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that syslogd log contains the ::1 address. + +use strict; +use warnings; + +our %args = ( + syslogd => { + loghost => '@udp6://[::1]:$connectport', + loggrep => { + qr/Logging to FORW \@udp6:\/\/\[::1\]:\d+/ => 5, + get_log() => 1, + }, + }, + server => { + listen => { domain => AF_INET6, addr => "::1" }, + }, +); + +1; |