From fdc5aacd3979868848c8e039e61fb66e3c53262f Mon Sep 17 00:00:00 2001 From: bluhm Date: Thu, 12 Oct 2023 22:41:29 +0000 Subject: [PATCH] Test retry after DNS lookup failure. --- .../usr.sbin/syslogd/args-dns-tcp-retry.pl | 26 +++++++++++++++++++ .../usr.sbin/syslogd/args-dns-tls-retry.pl | 26 +++++++++++++++++++ .../usr.sbin/syslogd/args-dns-udp-retry.pl | 26 +++++++++++++++++++ .../usr.sbin/syslogd/args-proto-udp4-host6.pl | 2 +- .../usr.sbin/syslogd/args-proto-udp6-host4.pl | 2 +- 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 regress/usr.sbin/syslogd/args-dns-tcp-retry.pl create mode 100644 regress/usr.sbin/syslogd/args-dns-tls-retry.pl create mode 100644 regress/usr.sbin/syslogd/args-dns-udp-retry.pl diff --git a/regress/usr.sbin/syslogd/args-dns-tcp-retry.pl b/regress/usr.sbin/syslogd/args-dns-tcp-retry.pl new file mode 100644 index 00000000000..232854e6c47 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-dns-tcp-retry.pl @@ -0,0 +1,26 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd fails to to do DNS lookup of TCP loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that syslogd log contains dns failures and retry. + +use strict; +use warnings; +use Socket; + +our %args = ( + syslogd => { + loghost => '@tcp://noexist.invalid.:514', + loggrep => { + qr/bad hostname "\@tcp:\/\/noexist.invalid.:514"/ => '>=2', + qr/Logging to FORWTCP \@tcp:\/\/noexist.invalid.:514/ => '>=4', + qr/retry loghost "\@tcp:\/\/noexist.invalid.:514" wait 1/ => 1, + get_testgrep() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-dns-tls-retry.pl b/regress/usr.sbin/syslogd/args-dns-tls-retry.pl new file mode 100644 index 00000000000..8e604abb490 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-dns-tls-retry.pl @@ -0,0 +1,26 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd fails to to do DNS lookup of TLS loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that syslogd log contains dns failures and retry. + +use strict; +use warnings; +use Socket; + +our %args = ( + syslogd => { + loghost => '@tls://noexist.invalid.:6514', + loggrep => { + qr/bad hostname "\@tls:\/\/noexist.invalid.:6514"/ => '>=2', + qr/Logging to FORWTLS \@tls:\/\/noexist.invalid.:6514/ => '>=4', + qr/retry loghost "\@tls:\/\/noexist.invalid.:6514" wait 1/ => 1, + get_testgrep() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-dns-udp-retry.pl b/regress/usr.sbin/syslogd/args-dns-udp-retry.pl new file mode 100644 index 00000000000..2d9119cfabf --- /dev/null +++ b/regress/usr.sbin/syslogd/args-dns-udp-retry.pl @@ -0,0 +1,26 @@ +# The client writes a message to Sys::Syslog native method. +# The syslogd writes it into a file and through a pipe. +# The syslogd fails to to do DNS lookup of UDP loghost. +# Find the message in client, file, pipe, syslogd log. +# Check that syslogd log contains dns failures and retry. + +use strict; +use warnings; +use Socket; + +our %args = ( + syslogd => { + loghost => '@udp://noexist.invalid.:514', + loggrep => { + qr/bad hostname "\@udp:\/\/noexist.invalid.:514"/ => '>=2', + qr/Logging to FORWUDP \@udp:\/\/noexist.invalid.:514/ => '>=4', + qr/retry loghost "\@udp:\/\/noexist.invalid.:514" wait 1/ => 1, + get_testgrep() => 1, + }, + }, + server => { + noserver => 1, + }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl index 37f6a072b6d..7ebbb7b0d06 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl @@ -11,7 +11,7 @@ our %args = ( syslogd => { loghost => '@udp4://[::1]', loggrep => { - qr/syslogd\[\d+\]: bad hostname "\@udp4:\/\/\[::1\]"/ => 1, + qr/syslogd\[\d+\]: bad hostname "\@udp4:\/\/\[::1\]"/ => '>=1', get_testgrep() => 1, }, }, diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl index aff56c9f9f6..bd2b873862d 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl @@ -11,7 +11,7 @@ our %args = ( syslogd => { loghost => '@udp6://127.0.0.1', loggrep => { - qr/syslogd\[\d+\]: bad hostname "\@udp6:\/\/127.0.0.1"/ => 1, + qr/syslogd\[\d+\]: bad hostname "\@udp6:\/\/127.0.0.1"/ => '>=1', get_testgrep() => 1, }, }, -- 2.20.1