add a test with pseudo CM
authorLaurent Mazet <mazet@softndesign.org>
Sun, 8 Jun 2025 21:36:31 +0000 (23:36 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Sun, 8 Jun 2025 21:36:31 +0000 (23:36 +0200)
clear_data.eth [new file with mode: 0644]
encrypted_data.eth [new file with mode: 0644]
test.sh [new file with mode: 0755]

diff --git a/clear_data.eth b/clear_data.eth
new file mode 100644 (file)
index 0000000..5767e34
--- /dev/null
@@ -0,0 +1 @@
+T0829 MSG=0 DATA=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:45:00:00:2f:91:d7:40:00:40:11:93:e1:0a:02:00:01:0a:02:01:01:8e:bb:0b:b8:00:1b:53:3b:54:68:69:73:20:69:73:20:61:20:6c:6f:6e:67:20:54:45:53:0a:01
diff --git a/encrypted_data.eth b/encrypted_data.eth
new file mode 100644 (file)
index 0000000..0427538
--- /dev/null
@@ -0,0 +1 @@
+T0809 MSG=1 DATA=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:45:00:00:2f:91:d7:40:00:40:11:93:e1:0a:02:00:01:0a:02:01:01:8e:bb:0b:b8:00:1b:53:3b:54:68:69:73:20:69:73:20:61:20:6c:6f:6e:67:20:54:45:53:0a:01:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
diff --git a/test.sh b/test.sh
new file mode 100755 (executable)
index 0000000..90498ed
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,62 @@
+#!/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