--- /dev/null
+#!/bin/sh
+
+MTU=1440
+VPN=./ulvpn.exe
+MOREP=/home/mazet/code/morep/morep_valid.exe
+
+ip addr list | grep 10\.1\.0\. || { ip link add eth0 type dummy && ip addr add dev eth0 10.1.0.1/24; }
+DEV=lo
+
+rm -f in.log out.log
+
+{
+ while true; do
+ echo "SLEEP 100\nR0839 MSG=0" | \
+ $MOREP -v 4 \
+ -r $DEV://00:00:00:00:00:00/0839 \
+ -t $DEV://00:00:00:00:00:00/0829 \
+ -l out.log | \
+ awk '{print "CM R->B [rx]:", $0}';
+ grep 54:45:53:54 out.log || break
+ done;
+
+ $MOREP -v 4 \
+ -r $DEV://00:00:00:00:00:00/0819 \
+ -t $DEV://00:00:00:00:00:00/0809 \
+ encrypted_data.eth | \
+ awk '{print "CM R->B [tx]:", $0}';
+
+ while true; do
+ echo "SLEEP 100\nR0819 MSG=2" | \
+ $MOREP -v 4 \
+ -r $DEV://00:00:00:00:00:00/0819 \
+ -t $DEV://00:00:00:00:00:00/0809 \
+ -l in.log | \
+ awk '{print "CM B->R [rx]:", $0}';
+ grep 54:45:53:54 in.log || break
+ done;
+
+ $MOREP -v 4 \
+ -r $DEV://00:00:00:00:00:00/0839 \
+ -t $DEV://00:00:00:00:00:00/0829 \
+ clear_data.eth | \
+ awk '{print "CM B->R [tx]:", $0}';
+} &
+pid=$!
+
+{ sleep 1; echo "TEST: This is a very long text" | nc -uq0 10.2.1.1 3000; } &
+
+$VPN \
+#gdb $VPN --args $VPN \
+ -v 5 -V 4 \
+ -d tun://tun0:$MTU \
+ -l tun://10.2.0.1 -r tun://10.2.1.0 \
+ -t udp://10.1.0.1:1234 -u udp://10.1.0.1:1234 \
+ -x $DEV://00:00:00:00:00:00/0809 $DEV://00:00:00:00:00:00/0819 \
+ -y $DEV://00:00:00:00:00:00/0829 $DEV://00:00:00:00:00:00/0839
+
+kill -9 $pid
+ip addr del dev eth0 10.1.0.1/24 && ip link del eth0 type dummy || echo no need to remove eth0
+
+diff out.log clear_data.eth && echo clear data ok
+diff in.log encrypted_data.eth && echo encrypted data ok