| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # alorbach, 2019-01-16 |
| 3 | # This file is part of the rsyslog project, released under ASL 2.0 |
| 4 | . ${srcdir:=.}/diag.sh init |
| 5 | export NUMMESSAGES=1000 |
| 6 | # uncomment for debugging support: |
| 7 | #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" |
| 8 | export RSYSLOG_DEBUGLOG="log" |
| 9 | generate_conf |
| 10 | export PORT_RCVR="$(get_free_port)" |
| 11 | add_conf ' |
| 12 | module( load="../plugins/imtcp/.libs/imtcp" |
| 13 | StreamDriver.Name="ossl" |
| 14 | StreamDriver.Mode="1" |
| 15 | StreamDriver.AuthMode="anon" ) |
| 16 | # then SENDER sends to this port (not tcpflood!) |
| 17 | input( type="imtcp" port="'$PORT_RCVR'" ) |
| 18 | |
| 19 | $template outfmt,"%msg:F,58:2%\n" |
| 20 | $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! |
| 21 | :msg, contains, "msgnum:" ?dynfile;outfmt |
| 22 | ' |
| 23 | startup |
| 24 | export RSYSLOG_DEBUGLOG="log2" |
| 25 | #valgrind="valgrind" |
| 26 | generate_conf 2 |
| 27 | export TCPFLOOD_PORT="$(get_free_port)" |
| 28 | add_conf ' |
| 29 | # Note: no TLS for the listener, this is for tcpflood! |
| 30 | module( load="../plugins/imtcp/.libs/imtcp") |
| 31 | input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) |
| 32 | |
| 33 | # set up the action |
| 34 | action( type="omfwd" |
| 35 | protocol="tcp" |
| 36 | target="127.0.0.1" |
| 37 | port="'$PORT_RCVR'" |
| 38 | StreamDriver="ossl" |
| 39 | StreamDriverMode="1" |
| 40 | StreamDriverAuthMode="anon" |
| 41 | ) |
| 42 | ' 2 |
| 43 | startup 2 |
| 44 | |
| 45 | # now inject the messages into instance 2. It will connect to instance 1, |
| 46 | # and that instance will record the data. |
| 47 | tcpflood -m$NUMMESSAGES -i1 |
| 48 | wait_file_lines |
| 49 | # shut down sender when everything is sent, receiver continues to run concurrently |
| 50 | shutdown_when_empty 2 |
| 51 | wait_shutdown 2 |
| 52 | # now it is time to stop the receiver as well |
| 53 | shutdown_when_empty |
| 54 | wait_shutdown |
| 55 | |
| 56 | seq_check 1 $NUMMESSAGES |
| 57 | exit_test |