blob: f9fb6f51c678c4051241812ef2afb330f98a1ee0 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/bash
# add 2016-11-22 by Jan Gerhards, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
template(name="outfmt" type="string" string="%msg%\n")
template(name="filename" type="string" string="'$RSYSLOG_DYNNAME'.%syslogtag%.log")
module(load="../plugins/mmanon/.libs/mmanon")
module(load="../plugins/imtcp/.libs/imtcp")
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="testing")
ruleset(name="testing") {
action(type="mmanon" ipv4.mode="random-consistent" ipv4.bits="32")
action(type="omfile" dynafile="filename" template="outfmt")
}'
echo 'Since this test tests randomization, there is a theoretical possibility of it failing even if rsyslog works correctly. Therefore, if the test unexpectedly fails try restarting it.'
startup
tcpflood -m1 -M "\"<129>Mar 10 01:00:00 172.20.245.8 file1 1.1.1.8
<129>Mar 10 01:00:00 172.20.245.8 file2 0.0.0.0
<129>Mar 10 01:00:00 172.20.245.8 file3 0.0.0.0
<129>Mar 10 01:00:00 172.20.245.8 file4 172.0.234.255
<129>Mar 10 01:00:00 172.20.245.8 file5 172.1.234.255
<129>Mar 10 01:00:00 172.20.245.8 file6 1.1.1.8
<129>Mar 10 01:00:00 172.20.245.8 file7 111.1.1.8.
<129>Mar 10 01:00:00 172.20.245.8 file8 1.1.1.8\""
shutdown_when_empty
wait_shutdown
echo ' 1.1.1.8' | cmp - ${RSYSLOG_DYNNAME}.file1.log >/dev/null
if [ ! $? -eq 1 ]; then
echo "invalidly equal ip-address generated, ${RSYSLOG_DYNNAME}.file1.log is:"
cat ${RSYSLOG_DYNNAME}.file1.log
error_exit 1
fi;
echo ' 0.0.0.0' | cmp - ${RSYSLOG_DYNNAME}.file2.log >/dev/null
if [ ! $? -eq 1 ]; then
echo "invalidly equal ip-address generated, ${RSYSLOG_DYNNAME}.file2.log is:"
cat ${RSYSLOG_DYNNAME}.file2.log
error_exit 1
fi;
echo ' 172.0.234.255' | cmp - ${RSYSLOG_DYNNAME}.file4.log >/dev/null
if [ ! $? -eq 1 ]; then
echo "invalidly equal ip-address generated, ${RSYSLOG_DYNNAME}.file4.log is:"
cat ${RSYSLOG_DYNNAME}.file4.log
error_exit 1
fi;
echo ' 111.1.1.8.' | cmp - ${RSYSLOG_DYNNAME}.file7.log >/dev/null
if [ ! $? -eq 1 ]; then
echo "invalidly equal ip-address generated, ${RSYSLOG_DYNNAME}.file7.log is:"
cat ${RSYSLOG_DYNNAME}.file7.log
error_exit 1
fi;
cmp ${RSYSLOG_DYNNAME}.file1.log ${RSYSLOG_DYNNAME}.file6.log >/dev/null
if [ ! $? -eq 0 ]; then
echo "invalidly unequal ip-addresses generated, ${RSYSLOG_DYNNAME}.file1.log and ${RSYSLOG_DYNNAME}.file6.log are:"
cat ${RSYSLOG_DYNNAME}.file1.log
cat ${RSYSLOG_DYNNAME}.file6.log
error_exit 1
fi;
cmp ${RSYSLOG_DYNNAME}.file6.log ${RSYSLOG_DYNNAME}.file8.log >/dev/null
if [ ! $? -eq 0 ]; then
echo "invalidly unequal ip-addresses generated, ${RSYSLOG_DYNNAME}.file6.log and ${RSYSLOG_DYNNAME}.file8.log are:"
cat ${RSYSLOG_DYNNAME}.file6.log
cat ${RSYSLOG_DYNNAME}.file8.log
error_exit 1
fi;
cmp ${RSYSLOG_DYNNAME}.file2.log ${RSYSLOG_DYNNAME}.file3.log >/dev/null
if [ ! $? -eq 0 ]; then
echo "invalidly unequal ip-addresses generated, ${RSYSLOG_DYNNAME}.file2.log and ${RSYSLOG_DYNNAME}.file3.log are:"
cat ${RSYSLOG_DYNNAME}.file2.log
cat ${RSYSLOG_DYNNAME}.file3.log
error_exit 1
fi;
cmp ${RSYSLOG_DYNNAME}.file4.log ${RSYSLOG_DYNNAME}.file5.log >/dev/null
if [ ! $? -eq 1 ]; then
echo "invalidly equal ip-addresses generated, ${RSYSLOG_DYNNAME}.file4.log and ${RSYSLOG_DYNNAME}.file5.log are:"
cat ${RSYSLOG_DYNNAME}.file4.log
cat ${RSYSLOG_DYNNAME}.file5.log
error_exit 1
fi;
rm -f ${RSYSLOG_DYNNAME}.*.log
exit_test
|