xref: /openbsd-src/regress/usr.sbin/syslogd/args-client-tcp-octet-badframe.pl (revision eab741e3b0cbbdb0d4d4b1e7943dcd2f1b8323e1)
1# The syslogd listens on 127.0.0.1 TCP socket.
2# The client writes octet counting messages with invalid framing.
3# The syslogd writes it into a file and through a pipe.
4# The syslogd passes it via UDP to the loghost.
5# The server receives the message on its UDP socket.
6# Find the message in file, syslogd, server log.
7# Check that an invalid octet counting is handled as non transparent framing.
8
9use strict;
10use warnings;
11use Socket;
12
13our %args = (
14    client => {
15	connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1",
16	    port => 514 },
17	func => sub {
18	    my $self = shift;
19	    local $| = 1;
20	    print "000002 ab\n";
21	    print STDERR "<<< 000002 ab\n";
22	    print "2bc\n";
23	    print STDERR "<<< 00002bc\n";
24	    write_log($self);
25	},
26    },
27    syslogd => {
28	options => ["-T", "127.0.0.1:514"],
29	loggrep => {
30	    qr/non transparent framing, use \d+ bytes/ => 3,
31	    qr/octet counting/ => 0,
32	},
33    },
34    file => {
35	loggrep => {
36	    qr/localhost 000002 ab$/ => 1,
37	    qr/localhost 2bc$/ => 1,
38	    get_testgrep() => 1,
39	},
40    },
41);
42
431;
44