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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# The client writes messages to localhost IPv4 and IPv6 UDP socket.
# The syslogd does not receive them as it is started without -u.
# Keep the sockets open by pretending to write to them.
# Check that client does send the message, but it is not in the file.
# Check with fstat that both *:514 sockets are bound.
# Check that there is no recvfrom localhost in syslogd ktrace.
use strict;
use warnings;
use Socket;
our %args = (
client => {
connectaddr => "none",
redo => [
{ connect => {
domain => AF_INET,
addr => "127.0.0.1",
proto => "udp",
port => "514",
}},
{ connect => {
domain => AF_INET,
addr => "127.0.0.1",
proto => "udp",
port => "514",
}},
{ connect => {
domain => AF_INET6,
addr => "::1",
proto => "udp",
port => "514",
}},
],
func => sub { redo_connect(shift, sub {
my $self = shift;
write_message($self, "client addr: ". $self->{connectaddr});
})},
loggrep => {
qr/client addr:/ => 4,
get_testgrep() => 1,
}
},
syslogd => {
options => [],
loghost => "/dev/null",
conf =>
"*.*\t\@udp4://0.0.0.0:0\n".
"*.*\t\@udp6://[::]:0\n",
fstat => {
qr/^_syslogd syslogd .* internet6? dgram udp \*:514$/ => 2,
},
ktrace => {
qr/127\.0\.0\.1/ => 0,
qr/\[::1\]/ => 0,
},
},
server => {
noserver => 1,
},
file => {
loggrep => {
qr/client addr: none/ => 1,
qr/client addr:/ => 1,
get_testgrep() => 1,
}
},
);
1;
|