summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/args-length-udp.pl
blob: 9a5d60208abde2636b49b45f6c5a6fea2fbf24ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# The client writes long messages to UDP socket.
# The syslogd writes it into a file and through a pipe.
# The syslogd passes it via 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 lines in server have 1180 bytes line length.
# Check that lines in file have 8192 bytes message length after the header.

use strict;
use warnings;
use Socket;

our %args = (
    client => {
	connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 },
	func => sub {
	    my $self = shift;
	    write_lengths($self, 8190..8193,9000);
	    write_log($self);
	},
    },
    syslogd => {
	options => ["-u"],
	loggrep => {
	    get_charlog() => 5,
	},
    },
    server => {
	# >>> <13>Jan 31 00:10:11 0123456789ABC...lmn
	loggrep => {
	    get_charlog() => 5,
	    qr/^>>> .{1180}$/ => 5,
	},
    },
    file => {
	# Jan 31 00:12:39 localhost 0123456789ABC...567
	loggrep => {
	    get_charlog() => 5,
	    qr/^.{25} .{8190}$/ => 1,
	    qr/^.{25} .{8191}$/ => 1,
	    qr/^.{25} .{8192}$/ => 3,
	},
    },
);

1;