19f5e6548Sbluhm# The syslogd binds UDP socket on localhost with -4.
29f5e6548Sbluhm# The client writes a message into a localhost IPv4 UDP socket.
39bd5ce22Sbluhm# The syslogd writes it into a file and through a pipe.
49bd5ce22Sbluhm# The syslogd passes it via UDP to the loghost.
59bd5ce22Sbluhm# The server receives the message on its UDP socket.
69bd5ce22Sbluhm# Find the message in client, file, pipe, syslogd, server log.
79bd5ce22Sbluhm# Check that the file log contains the 127.0.0.1 name.
89bd5ce22Sbluhm# Check that fstat contains a only bound IPv4 UDP socket.
99bd5ce22Sbluhm
109bd5ce22Sbluhmuse strict;
119bd5ce22Sbluhmuse warnings;
12*eab741e3Sbluhmuse Socket;
139bd5ce22Sbluhm
149bd5ce22Sbluhmour %args = (
159bd5ce22Sbluhm    client => {
169bd5ce22Sbluhm	connect => { domain => AF_INET, addr => "127.0.0.1", port => 514 },
179bd5ce22Sbluhm    },
189bd5ce22Sbluhm    syslogd => {
199bd5ce22Sbluhm	options => ["-4nU", "localhost"],
209bd5ce22Sbluhm	fstat => {
219bd5ce22Sbluhm	    qr/^root .* internet/ => 0,
229bd5ce22Sbluhm	    qr/^_syslogd .* internet/ => 2,
239bd5ce22Sbluhm	    qr/ internet dgram udp 127.0.0.1:514$/ => 1,
249bd5ce22Sbluhm	    qr/ internet6 dgram udp \[::1\]:514$/ => 0,
259bd5ce22Sbluhm	},
269bd5ce22Sbluhm	loghost => '@127.0.0.1:$connectport',
279bd5ce22Sbluhm    },
289bd5ce22Sbluhm    server => {
299bd5ce22Sbluhm	listen => { domain => AF_INET, addr => "127.0.0.1" },
309bd5ce22Sbluhm    },
319bd5ce22Sbluhm    file => {
32bb7ea376Sbluhm	loggrep => qr/ 127.0.0.1 /. get_testgrep(),
339bd5ce22Sbluhm    },
349bd5ce22Sbluhm);
359bd5ce22Sbluhm
369bd5ce22Sbluhm1;
37