1# The client writes messages to localhost IPv4 and IPv6 UDP socket.
2# The syslogd does not receive them as it is started without -u.
3# Keep the sockets open by pretending to write to them.
4# Check that client does send the message, but it is not in the file.
5# Check with fstat that both *:514 sockets are bound.
6# Check that there is no recvfrom localhost in syslogd ktrace.
7
8use strict;
9use warnings;
10use Socket;
11
12our %args = (
13    client => {
14	connectaddr => "none",
15	redo => [
16	    { connect => {
17		domain => AF_INET,
18		addr   => "127.0.0.1",
19		proto  => "udp",
20		port   => "514",
21	    }},
22	    { connect => {
23		domain => AF_INET,
24		addr   => "127.0.0.1",
25		proto  => "udp",
26		port   => "514",
27	    }},
28	    { connect => {
29		domain => AF_INET6,
30		addr   => "::1",
31		proto  => "udp",
32		port   => "514",
33	    }},
34	],
35	func => sub { redo_connect(shift, sub {
36	    my $self = shift;
37	    write_message($self, "client addr: ". $self->{connectaddr});
38	})},
39	loggrep => {
40	    qr/client addr:/ => 4,
41	    get_testgrep() => 1,
42	}
43    },
44    syslogd => {
45	options => [],
46	loghost => "/dev/null",
47	conf =>
48	    "*.*\t\@udp4://0.0.0.0:0\n".
49	    "*.*\t\@udp6://[::]:0\n",
50	fstat => {
51	    qr/^_syslogd syslogd .* internet6? dgram udp \*:514$/ => 2,
52	},
53	ktrace => {
54	    qr/STRU  struct sockaddr .* 127\.0\.0\.1/ => 0,
55	    qr/STRU  struct sockaddr .* \[::1\]/ => 0,
56	},
57    },
58    server => {
59	noserver => 1,
60    },
61    file => {
62	loggrep => {
63	    qr/client addr: none/ => 1,
64	    qr/client addr:/ => 1,
65	    get_testgrep() => 1,
66	}
67    },
68);
69
701;
71