diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-07-15 15:21:34 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-07-22 19:41:42 +0200 |
commit | 1aaa2bd189cb42a26ee411fd1652e7479d82f005 (patch) | |
tree | 56b8221eccaf1198620485593045dfbc39f41e0c /test/demo | |
parent | 05dc1c65c11c05709ebde73e74d91fd29226ba9c (diff) | |
download | passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.gz passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.bz2 passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.lz passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.xz passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.tar.zst passt-1aaa2bd189cb42a26ee411fd1652e7479d82f005.zip |
tests: Use socat instead of netcat
Commit 41c02e10 ("tests: Use nmap-ncat instead of openbsd netcat for pasta
tests") updated the pasta tests to use the nmap version of ncat instead of
the openbsd version, for greater portability.
For some upcoming changes, however, we'll be wanting to use socat.
"socat" can do everything "ncat" can and more, so let's move all the
tests using host tools (either directly on the host or via mbuto
generated images) to using socat instead.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Fix a typo in port specification, 31337 instead of x31337]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/demo')
-rw-r--r-- | test/demo/passt | 8 | ||||
-rw-r--r-- | test/demo/pasta | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/test/demo/passt b/test/demo/passt index c6c3bcc..59fe144 100644 --- a/test/demo/passt +++ b/test/demo/passt @@ -129,9 +129,9 @@ nl nl say Let's try to communicate between host and guest. sleep 2 -guestb nc -6 -l -p 5201 +guestb socat TCP6-LISTEN:5201 STDIO sleep 2 -host echo "Hello from the host" | nc -N ::1 5201 +host echo "Hello from the host" | socat -u STDIN TCP6:[::1]:5201 sleep 5 nl @@ -142,9 +142,9 @@ say the address of the default gateway. sleep 2 gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway' sleep 5 -hostb nc -l -p 31337 +hostb socat TCP4-LISTEN:31337 STDIO sleep 2 -guest echo "Hello from the guest" | nc -N __GW__ 31337 +guest echo "Hello from the guest" | socat -u STDIN TCP4:__GW__:31337 sleep 3 nl diff --git a/test/demo/pasta b/test/demo/pasta index 342671f..8337c83 100644 --- a/test/demo/pasta +++ b/test/demo/pasta @@ -98,9 +98,9 @@ nl say pasta detects bound ports and forwards them. sleep 3 -nsb ncat -6 -l ::1 31337 +nsb socat TCP6-LISTEN:31337,bind=[::1] STDOUT sleep 2 -host echo "Hello from the host" | ncat ::1 31337 +host echo "Hello from the host" | socat -u STDIN TCP6:[::1]:31337 sleep 5 nl @@ -109,9 +109,9 @@ say Now the other way around... nl say we can use a loopback address sleep 2 -hostb ncat -l ::1 31337 +hostb socat TCP6-LISTEN:31337,bind=[::1] STDIO sleep 2 -ns echo "Hello from the namespace" | ncat ::1 31337 +ns echo "Hello from the namespace" | socat -u STDIN TCP6:[::1]:31337 sleep 5 nl @@ -119,9 +119,9 @@ say or the address of the default gateway. sleep 2 nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway' sleep 5 -hostb ncat -l 0.0.0.0 31337 +hostb socat TCP4-LISTEN:31337 STDIO sleep 2 -ns echo "Hello from the namespace" | ncat __GW__ 31337 +ns echo "Hello from the namespace" | socat -u STDIN TCP4:__GW__:31337 sleep 3 nl |