* [PATCH 0/5] More test fixes for Fedora host
@ 2022-06-10 2:32 David Gibson
2022-06-10 2:32 ` [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests David Gibson
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]
Hi Stefano,
Here's another batch of fixes for the passt/pasta tests. With this
lot I'm now able to get the build and pasta tests passing on my Fedora
workstation. The passt and distro tests still fail or crash, I'm
continuing to look at those (it looks like there are some very fragile
behaviours in qrap which means they're not even getting started).
David Gibson (5):
tests: Use more explicit netcat options for distro/fedora tests
Don't abbreviate ip(8) arguments in examples and tests
Tweak dhclient arguments for readability
Use dhclient instead of udhcpc
tests: Use nmap-ncat instead of openbsd netcat for pasta tests
contrib/kata-containers/README.md | 2 +-
doc/demo.sh | 8 ++---
passt.1 | 16 +++------
test/README.md | 2 +-
test/demo/passt | 16 ++++-----
test/demo/pasta | 24 ++++++-------
test/demo/podman | 20 +++++------
test/dhcp/passt | 24 ++++++-------
test/dhcp/pasta | 26 +++++++-------
test/distro/fedora | 14 ++++----
test/distro/ubuntu | 4 +--
test/icmp/passt_in_ns | 4 +--
test/lib/setup | 12 +++----
test/ndp/passt | 12 +++----
test/ndp/pasta | 12 +++----
test/perf/passt_tcp | 8 ++---
test/perf/passt_udp | 8 ++---
test/perf/pasta_tcp | 6 ++--
test/perf/pasta_udp | 6 ++--
test/tcp/passt | 6 ++--
test/tcp/passt_in_ns | 22 ++++++------
test/tcp/pasta | 60 +++++++++++++++----------------
test/two_guests/basic | 26 +++++++-------
test/udp/passt | 6 ++--
test/udp/passt_in_ns | 14 ++++----
test/udp/pasta | 35 +++++++++---------
26 files changed, 193 insertions(+), 200 deletions(-)
--
2.36.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
@ 2022-06-10 2:32 ` David Gibson
2022-06-14 14:10 ` Stefano Brivio
2022-06-10 2:32 ` [PATCH 2/5] Don't abbreviate ip(8) arguments in examples and tests David Gibson
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]
distro/fedora contains two versions of the basic tests, used for different
Fedora versions. One uses explicit listening address for netcat in some
extra places, the other does not. Apparently the older netcat versions
didn't require the explicit addresses. Not supplying addresses doesn't
test anything useful though, just a detail in netcat's behaviour. So,
it's cleaner to just always supply explicit addresses.
In addition, we're explicitly expecting the nmap version of ncat, also
known as "ncat". So, it's more explicit what we're after if we invoke it
via that name rather than "nc", which will go via an /etc/alternatives
link.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
test/distro/fedora | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/distro/fedora b/test/distro/fedora
index f2f8f27..b7f1e3b 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -16,13 +16,13 @@ htools wget virt-edit guestfish head sed cat kill
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
-host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc ::1 9999) &
+host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
-host nc -6 -l -p 9999 > /tmp/ns_msg &
+host ncat -6 -l -p 9999 ::1 > /tmp/ns_msg &
sleep 2
-host echo "from_ns" | nc ::1 10000
+host echo "from_ns" | ncat ::1 10000
sleep 2
host echo
sleep 1
@@ -34,17 +34,17 @@ hout INIT_MSG cat /tmp/init_msg
check [ __INIT_MSG__ = "from_ns" ]
endef
-# Explicit listening address, bracketed paste mode off, needed from Fedora 34
+# Bracketed paste mode off, needed from Fedora 34
def distro_quick_pasta_test_fedora34
host bind 'set enable-bracketed-paste off'
-host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -6 ::1 9999) &
+host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat -6 ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host bind 'set enable-bracketed-paste off'
-host nc -6 -l ::1 9999 > /tmp/ns_msg &
+host ncat -6 -l ::1 9999 > /tmp/ns_msg &
sleep 2
-host echo "from_ns" | nc -6 ::1 10000
+host echo "from_ns" | ncat -6 ::1 10000
sleep 2
host echo
hout NS_MSG cat /tmp/ns_msg
--
@@ -16,13 +16,13 @@ htools wget virt-edit guestfish head sed cat kill
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
-host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc ::1 9999) &
+host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
-host nc -6 -l -p 9999 > /tmp/ns_msg &
+host ncat -6 -l -p 9999 ::1 > /tmp/ns_msg &
sleep 2
-host echo "from_ns" | nc ::1 10000
+host echo "from_ns" | ncat ::1 10000
sleep 2
host echo
sleep 1
@@ -34,17 +34,17 @@ hout INIT_MSG cat /tmp/init_msg
check [ __INIT_MSG__ = "from_ns" ]
endef
-# Explicit listening address, bracketed paste mode off, needed from Fedora 34
+# Bracketed paste mode off, needed from Fedora 34
def distro_quick_pasta_test_fedora34
host bind 'set enable-bracketed-paste off'
-host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -6 ::1 9999) &
+host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat -6 ::1 9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host bind 'set enable-bracketed-paste off'
-host nc -6 -l ::1 9999 > /tmp/ns_msg &
+host ncat -6 -l ::1 9999 > /tmp/ns_msg &
sleep 2
-host echo "from_ns" | nc -6 ::1 10000
+host echo "from_ns" | ncat -6 ::1 10000
sleep 2
host echo
hout NS_MSG cat /tmp/ns_msg
--
2.36.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] Don't abbreviate ip(8) arguments in examples and tests
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
2022-06-10 2:32 ` [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests David Gibson
@ 2022-06-10 2:32 ` David Gibson
2022-06-10 2:32 ` [PATCH 3/5] Tweak dhclient arguments for readability David Gibson
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 36939 bytes --]
ip(8)'s ability to take abbreviated arguments (e.g. "li sh" instead of
"link show") is very handy when using it interactively, but it doesn't make
for very readable scripts and examples when shown that way.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
contrib/kata-containers/README.md | 2 +-
doc/demo.sh | 8 ++++----
test/demo/passt | 10 +++++-----
test/demo/pasta | 6 +++---
test/demo/podman | 20 ++++++++++----------
test/dhcp/passt | 22 +++++++++++-----------
test/dhcp/pasta | 20 ++++++++++----------
test/icmp/passt_in_ns | 4 ++--
test/lib/setup | 4 ++--
test/ndp/passt | 12 ++++++------
test/ndp/pasta | 12 ++++++------
test/perf/passt_tcp | 6 +++---
test/perf/passt_udp | 6 +++---
test/perf/pasta_tcp | 6 +++---
test/perf/pasta_udp | 6 +++---
test/tcp/passt | 6 +++---
test/tcp/passt_in_ns | 22 +++++++++++-----------
test/tcp/pasta | 8 ++++----
test/two_guests/basic | 22 +++++++++++-----------
test/udp/passt | 6 +++---
test/udp/passt_in_ns | 14 +++++++-------
test/udp/pasta | 6 +++---
22 files changed, 114 insertions(+), 114 deletions(-)
diff --git a/contrib/kata-containers/README.md b/contrib/kata-containers/README.md
index 96acd5f..4cc8a70 100644
--- a/contrib/kata-containers/README.md
+++ b/contrib/kata-containers/README.md
@@ -259,7 +259,7 @@ we can now:
### verify that addresses are properly configured
- crictl exec $c ip ad sh
+ crictl exec $c ip addr show
## Enable support for ICMP/ICMPv6 Echo Request
diff --git a/doc/demo.sh b/doc/demo.sh
index 87fad1c..f49110a 100755
--- a/doc/demo.sh
+++ b/doc/demo.sh
@@ -19,9 +19,9 @@ get_token() {
unset IFS
}
-ipv6_dev() { get_token "dev" $(ip -o -6 ro show default | grep via); }
-ipv6_devaddr() { get_token "inet6" $(ip -o -6 ad sh dev "${1}" scope global); }
-ipv6_ll_addr() { get_token "inet6" $(ip -o -6 ad sh dev "${1}" scope link); }
+ipv6_dev() { get_token "dev" $(ip -o -6 route show default | grep via); }
+ipv6_devaddr() { get_token "inet6" $(ip -o -6 addr show dev "${1}" scope global); }
+ipv6_ll_addr() { get_token "inet6" $(ip -o -6 addr show dev "${1}" scope link); }
ipv6_mask() { echo ${1#*/}; }
ipv6_mangle() {
IFS=':'
@@ -93,7 +93,7 @@ if [ -n "${ipv6_addr}" ]; then
ip addr add "${ipv6_addr}" dev "veth_${ns}"
ip route add "${ipv6_passt}" dev "veth_${ns}"
passt_ll="$(ipv6_ll_addr "veth_${ns}")"
- main_ll="$(get_token "link/ether" $(ip -o li sh "veth_${ns}"))"
+ main_ll="$(get_token "link/ether" $(ip -o link show "veth_${ns}"))"
ip neigh add "${passt_ll%%/*}" dev "veth_${ns}" lladdr "${main_ll}"
ip -n "${ns}" route add default via "${passt_ll%%/*}" dev "veth_${ns}"
diff --git a/test/demo/passt b/test/demo/passt
index cf75c9b..d394a08 100644
--- a/test/demo/passt
+++ b/test/demo/passt
@@ -108,13 +108,13 @@ sleep 10
nl
nl
-guest ip li sh
+guest ip link show
sleep 3
say Guest is up. Let's configure IPv4 first...
sleep 2
guest dhclient
sleep 2
-guest ip ad sh
+guest ip addr show
sleep 5
nl
@@ -140,7 +140,7 @@ say Now the other way around... using
nl
say the address of the default gateway.
sleep 2
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
sleep 5
hostb nc -l -p 31337
sleep 2
@@ -168,8 +168,8 @@ host sysctl -w net.ipv4.tcp_rmem="4096 524288 134217728"
host sysctl -w net.ipv4.tcp_wmem="4096 524288 134217728"
host sysctl -w net.ipv4.tcp_timestamps=0
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
nl
nl
info Throughput in Gbps, latency in µs
diff --git a/test/demo/pasta b/test/demo/pasta
index 506d948..8b13b5e 100644
--- a/test/demo/pasta
+++ b/test/demo/pasta
@@ -73,13 +73,13 @@ host q
nl
nl
-ns ip li sh
+ns ip link show
sleep 3
say Let's configure IPv4 first...
sleep 2
ns dhclient
sleep 2
-ns ip ad sh
+ns ip addr show
sleep 5
nl
@@ -119,7 +119,7 @@ sleep 5
nl
say or the address of the default gateway.
sleep 2
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
sleep 5
hostb nc -l -p 31337
sleep 2
diff --git a/test/demo/podman b/test/demo/podman
index 074dd85..3a73784 100644
--- a/test/demo/podman
+++ b/test/demo/podman
@@ -73,13 +73,13 @@ nl
say We can observe some practical differences:
nl
-ns1b ip ad sh
+ns1b ip addr show
sleep 3
say - slirp4netns uses a predefined IPv4 address
hl NS1
sleep 2
-ns2b ip ad sh
+ns2b ip addr show
sleep 3
say ,
nl
@@ -103,7 +103,7 @@ sleep 2
nl
say - same for routes:
-ns1b ip ro sh
+ns1b ip route show
sleep 3
say slirp4netns defines its own
nl
@@ -112,8 +112,8 @@ hl NS1
sleep 2
say , pasta copies it from the host
-ns2b ip ro sh
-ns2b ip -6 ro sh
+ns2b ip route show
+ns2b ip -6 route show
sleep 5
nl
@@ -310,11 +310,11 @@ nl
nl
say Everything is set now, let's start
sleep 2
-hout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-hout ADDR4 ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
-hout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
-hout GW4 ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+hout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+hout ADDR4 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
+hout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
+hout GW4 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
nl
nl
diff --git a/test/dhcp/passt b/test/dhcp/passt
index 85cb264..ca76846 100644
--- a/test/dhcp/passt
+++ b/test/dhcp/passt
@@ -16,23 +16,23 @@ gtools ip jq dhclient sed tr
htools ip jq sed tr head
test Interface name
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-hout HOST_IFNAME ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").dev'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
check [ -n "__IFNAME__" ]
test DHCP: address
guest /sbin/dhclient __IFNAME__
-gout ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
-hout HOST_ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
+gout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
check [ "__ADDR__" = "__HOST_ADDR__" ]
test DHCP: route
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ "__GW__" = "__HOST_GW__" ]
test DHCP: MTU
-gout MTU ip -j li sh | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
+gout MTU ip -j link show | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
check [ __MTU__ = 65520 ]
test DHCP: DNS
@@ -49,13 +49,13 @@ check [ "__SEARCH__" = "__HOST_SEARCH__" ]
test DHCPv6: address
guest /sbin/dhclient -6 __IFNAME__
-gout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local'
-hout HOST_ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
+gout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local'
+hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
check [ "__ADDR6__" = "__HOST_ADDR6__" ]
test DHCPv6: route
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ "__GW6__" = "__HOST_GW6__" ]
# Strip interface specifier: interface names might differ between host and guest
diff --git a/test/dhcp/pasta b/test/dhcp/pasta
index 1e8ecaa..77e9e42 100644
--- a/test/dhcp/pasta
+++ b/test/dhcp/pasta
@@ -16,31 +16,31 @@ nstools ip jq /sbin/udhcpc /sbin/dhclient
htools ip jq
test Interface name
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
check [ -n "__IFNAME__" ]
test DHCP: address
ns /sbin/udhcpc -i __IFNAME__
-nsout ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
-hout HOST_ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+nsout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
check [ __ADDR__ = __HOST_ADDR__ ]
test DHCP: route
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ __GW__ = __HOST_GW__ ]
test DHCP: MTU
-nsout MTU ip -j li sh | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
+nsout MTU ip -j link show | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
check [ __MTU__ = 65520 ]
test DHCPv6: address
ns /sbin/dhclient -6 __IFNAME__
-nsout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local'
-hout HOST_ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
+nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local'
+hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
check [ __ADDR6__ = __HOST_ADDR6__ ]
test DHCPv6: route
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ __GW6__ = __HOST_GW6__ ]
diff --git a/test/icmp/passt_in_ns b/test/icmp/passt_in_ns
index 38a9a4f..e1d9f7b 100644
--- a/test/icmp/passt_in_ns
+++ b/test/icmp/passt_in_ns
@@ -21,13 +21,13 @@ nstools ip jq sleep
gtools ping ip jq
test ICMP echo: guest to ns
-nsout IFNAME_NS ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME_NS ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns ip addr add 192.0.2.1/32 dev __IFNAME_NS__
guest ping -c1 -w1 192.0.2.1
ns ip addr del 192.0.2.1/32 dev __IFNAME_NS__
test ICMPv6 echo: guest to ns
ns ip addr add 2001:db8::1 dev __IFNAME_NS__ && sleep 2 # DAD
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest ping -c1 -w1 2001:db8::1
ns ip addr del 2001:db8::1 dev __IFNAME_NS__
diff --git a/test/lib/setup b/test/lib/setup
index 6139e8f..ffc4171 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -141,7 +141,7 @@ setup_passt_in_ns() {
pane_status GUEST
pane_status NS
- pane_run NS "ip -j li sh | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
+ pane_run NS "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
pane_wait NS
__ifname="$(pane_parse NS)"
pane_run NS "/sbin/udhcpc -i ${__ifname}"
@@ -228,7 +228,7 @@ setup_two_guests() {
pane_run GUEST_1 "nsenter -t ${__ns1_pid} -U -n --preserve-credentials"
pane_run GUEST_2 "nsenter -t ${__ns2_pid} -U -n --preserve-credentials"
- pane_run PASST_1 "ip -j li sh | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
+ pane_run PASST_1 "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
pane_wait PASST_1
__ifname="$(pane_parse PASST_1)"
diff --git a/test/ndp/passt b/test/ndp/passt
index 33e97a3..155ff26 100644
--- a/test/ndp/passt
+++ b/test/ndp/passt
@@ -16,19 +16,19 @@ gtools ip jq sipcalc grep
htools ip jq sipcalc grep cut
test Interface name
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest ip link set dev __IFNAME__ up && sleep 2
-hout HOST_IFNAME ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").dev'
+hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
check [ -n "__IFNAME__" ]
test SLAAC: prefix
-gout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local'
+gout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local'
gout PREFIX6 sipcalc __ADDR6__/64 | grep prefix | cut -d' ' -f4
-hout HOST_ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
+hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4
check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
test SLAAC: route
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ __GW6__ = __HOST_GW6__ ]
diff --git a/test/ndp/pasta b/test/ndp/pasta
index c3eceae..ef9dee7 100644
--- a/test/ndp/pasta
+++ b/test/ndp/pasta
@@ -16,20 +16,20 @@ nstools ip jq sipcalc grep cut
htools ip jq sipcalc grep cut
test Interface name
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns ip link set dev __IFNAME__ up
sleep 2
-hout HOST_IFNAME ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").dev'
+hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
check [ -n "__IFNAME__" ]
test SLAAC: prefix
-nsout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local'
+nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local'
nsout PREFIX6 sipcalc __ADDR6__/64 | grep prefix | cut -d' ' -f4
-hout HOST_ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
+hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4
check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
test SLAAC: route
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-hout HOST_GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+hout HOST_GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
check [ __GW6__ = __HOST_GW6__ ]
diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp
index f13fdfc..5f017db 100644
--- a/test/perf/passt_tcp
+++ b/test/perf/passt_tcp
@@ -35,9 +35,9 @@ ns sysctl -w net.ipv4.tcp_rmem="4096 524288 134217728"
ns sysctl -w net.ipv4.tcp_wmem="4096 524288 134217728"
ns sysctl -w net.ipv4.tcp_timestamps=0
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1
hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l
diff --git a/test/perf/passt_udp b/test/perf/passt_udp
index cc5711b..0515f00 100644
--- a/test/perf/passt_udp
+++ b/test/perf/passt_udp
@@ -28,9 +28,9 @@ guest /sbin/sysctl -w net.core.wmem_max=16777216
guest /sbin/sysctl -w net.core.rmem_default=16777216
guest /sbin/sysctl -w net.core.wmem_default=16777216
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1
hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l
diff --git a/test/perf/pasta_tcp b/test/perf/pasta_tcp
index a330bb4..5ef0f69 100644
--- a/test/perf/pasta_tcp
+++ b/test/perf/pasta_tcp
@@ -170,9 +170,9 @@ te
test pasta: throughput and latency (connections via tap)
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
set THREADS 1
set STREAMS 2
set OPTS -Z -P __STREAMS__ -i1 -t30 -O5 --pacing-timer 100000
diff --git a/test/perf/pasta_udp b/test/perf/pasta_udp
index 8b68b78..114a9bc 100644
--- a/test/perf/pasta_udp
+++ b/test/perf/pasta_udp
@@ -129,9 +129,9 @@ te
test pasta: throughput and latency (traffic via tap)
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
info Throughput in Gbps, latency in µs, one thread at __FREQ__ GHz, __STREAMS__ streams
report pasta tap_udp 1 __FREQ__
diff --git a/test/tcp/passt b/test/tcp/passt
index f31f111..b47a36d 100644
--- a/test/tcp/passt
+++ b/test/tcp/passt
@@ -27,7 +27,7 @@ check [ "__GUEST_MD5_BIG__" = "__HOST_MD5_BIG__" ]
test TCP/IPv4: guest to host: big transfer
hostb nc -4 -l 10003 > __TEMP_BIG__
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest cat test_big.bin | nc -N __GW__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
@@ -62,8 +62,8 @@ check [ "__GUEST_MD5_BIG__" = "__HOST_MD5_BIG__" ]
test TCP/IPv6: guest to host: big transfer
hostb nc -6 -l 10003 > __TEMP_BIG__
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest cat test_big.bin | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
diff --git a/test/tcp/passt_in_ns b/test/tcp/passt_in_ns
index fc4c7f4..4229a3a 100644
--- a/test/tcp/passt_in_ns
+++ b/test/tcp/passt_in_ns
@@ -36,7 +36,7 @@ check [ "__NS_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: guest to host: big transfer
hostb nc -4 -l 10003 > __TEMP_BIG__
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest cat test_big.bin | nc -N __GW__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
@@ -73,8 +73,8 @@ check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: ns to guest (using namespace address): big transfer
guestb nc -4 -l 10001 > test_big.bin
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-nsout ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
ns cat __TEMP_NS_BIG__ | nc -N __ADDR__ 10001
guestw
gout GUEST_MD5_BIG md5sum test_big.bin | cut -d' ' -f1
@@ -100,7 +100,7 @@ check [ "__NS_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv4: guest to host: small transfer
hostb nc -4 -l 10003 > __TEMP_SMALL__
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest cat test_small.bin | nc -N __GW__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
@@ -158,8 +158,8 @@ check [ "__NS_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv6: guest to host: big transfer
hostb nc -6 -l 10003 > __TEMP_BIG__
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest cat test_big.bin | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
@@ -181,7 +181,7 @@ check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv6: ns to host (via tap): big transfer
hostb nc -6 -l 10003 > __TEMP_BIG__
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS_BIG__ | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
@@ -196,7 +196,7 @@ check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv6: ns to guest (using namespace address): big transfer
guestb nc -6 -l 10001 > test_big.bin
-nsout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
ns cat __TEMP_NS_BIG__ | nc -N __ADDR6__ 10001
guestw
gout GUEST_MD5_BIG md5sum test_big.bin | cut -d' ' -f1
@@ -218,8 +218,8 @@ check [ "__NS_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv6: guest to host: small transfer
hostb nc -6 -l 10003 > __TEMP_SMALL__
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest cat test_small.bin | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
@@ -241,7 +241,7 @@ check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv6: ns to host (via tap): small transfer
hostb nc -6 -l 10003 > __TEMP_SMALL__
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS_SMALL__ | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
diff --git a/test/tcp/pasta b/test/tcp/pasta
index 55548e8..2fece32 100644
--- a/test/tcp/pasta
+++ b/test/tcp/pasta
@@ -35,7 +35,7 @@ check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: ns to host (via tap): big transfer
hostb nc -4 -l 10003 > __TEMP_BIG__
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
ns cat __TEMP_NS_BIG__ | nc -N __GW__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
@@ -61,7 +61,7 @@ check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv4: ns to host (via tap): small transfer
hostb nc -4 -l 10003 > __TEMP_SMALL__
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
ns cat __TEMP_NS_SMALL__ | nc -N __GW__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
@@ -85,8 +85,8 @@ nsw
test TCP/IPv6: ns to host (via tap): big transfer
hostb nc -6 -l 10003 > __TEMP_BIG__
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS_BIG__ | nc -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
diff --git a/test/two_guests/basic b/test/two_guests/basic
index 24352c0..09a06da 100644
--- a/test/two_guests/basic
+++ b/test/two_guests/basic
@@ -16,18 +16,18 @@ g2tools ip jq dhclient nc cat
htools ip jq cat md5sum cut
test Interface names
-g1out IFNAME1 ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-g2out IFNAME2 ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-hout HOST_IFNAME ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").dev'
+g1out IFNAME1 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+g2out IFNAME2 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
check [ -n "__IFNAME1__" ]
check [ -n "__IFNAME2__" ]
test DHCP: addresses
guest1 /sbin/dhclient __IFNAME1__
guest2 /sbin/dhclient __IFNAME1__
-g1out ADDR1 ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local'
-g2out ADDR2 ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[0].local'
-hout HOST_ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
+g1out ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local'
+g2out ADDR2 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[0].local'
+hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
check [ "__ADDR1__" = "__HOST_ADDR__" ]
check [ "__ADDR2__" = "__HOST_ADDR__" ]
@@ -36,14 +36,14 @@ test DHCPv6: addresses
sleep 2
guest1 /sbin/dhclient -6 __IFNAME1__
guest2 /sbin/dhclient -6 __IFNAME1__
-g1out ADDR1_6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local'
-g2out ADDR2_6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[] | select(.prefixlen == 128).local'
-hout HOST_ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
+g1out ADDR1_6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local'
+g2out ADDR2_6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[] | select(.prefixlen == 128).local'
+hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[] | select(.scope == "global").local'
check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
check [ "__ADDR2_6__" = "__HOST_ADDR6__" ]
test TCP/IPv4: guest 1 > guest 2
-g1out GW1 ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest2b nc -4 -l 10004 > msg
guest1 echo "Hello_from_guest_1" | nc -N __GW1__ 10004
guest2w
@@ -52,7 +52,7 @@ g2out MSG2 cat msg
check [ "__MSG2__" = "Hello_from_guest_1" ]
test TCP/IPv6: guest 2 > guest 1
-g2out GW2_6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+g2out GW2_6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest1b nc -6 -l 10001 > msg
guest2 echo "Hello_from_guest_2" | nc -N __GW2_6__%__IFNAME2__ 10001
guest1w
diff --git a/test/udp/passt b/test/udp/passt
index 223871f..492fb12 100644
--- a/test/udp/passt
+++ b/test/udp/passt
@@ -29,7 +29,7 @@ check [ "__GUEST_MD5__" = "__HOST_MD5__" ]
test UDP/IPv4: guest to host
host :> __TEMP__
hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest cat test.bin | nc -u -q1 -N __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -46,8 +46,8 @@ check [ "__GUEST_MD5__" = "__HOST_MD5__" ]
test UDP/IPv6: guest to host
host :> __TEMP__
hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest cat test.bin | nc -u -q1 -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
diff --git a/test/udp/passt_in_ns b/test/udp/passt_in_ns
index b9b1a97..71bda04 100644
--- a/test/udp/passt_in_ns
+++ b/test/udp/passt_in_ns
@@ -39,7 +39,7 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv4: guest to host
host :> __TEMP__
hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+gout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
guest cat test.bin | nc -u -q1 -N __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -79,8 +79,8 @@ check [ "__GUEST_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to guest (using namespace address)
guestb (nc -u -q1 -4 -l 10001 & echo $! > nc.pid) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat nc.pid))
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
-nsout ADDR ip -j -4 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
ns cat __TEMP_NS__ | nc -u -q1 -N __ADDR__ 10001
guestw
gout GUEST_MD5 md5sum test.bin | cut -d' ' -f1
@@ -104,8 +104,8 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv6: guest to host
host :> __TEMP__
hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
guest cat test.bin | nc -u -q1 -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -130,7 +130,7 @@ check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv6: ns to host (via tap)
host :> __TEMP__
hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS__ | nc -u -q1 -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -145,7 +145,7 @@ check [ "__GUEST_MD5__" = "__MD5__" ]
test UDP/IPv6: ns to guest (using namespace address)
guestb (nc -u -q1 -6 -l 10001 & echo $! > nc.pid) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat nc.pid))
-nsout ADDR6 ip -j -6 ad sh|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
+nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
ns cat __TEMP_NS__ | nc -u -q1 -N __ADDR6__ 10001
guestw
gout GUEST_MD5 md5sum test.bin | cut -d' ' -f1
diff --git a/test/udp/pasta b/test/udp/pasta
index dd4b72d..c26cea9 100644
--- a/test/udp/pasta
+++ b/test/udp/pasta
@@ -40,7 +40,7 @@ check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (via tap)
host :> __TEMP__
hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
ns cat __TEMP_NS__ | nc -u -q1 -N __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -68,8 +68,8 @@ nsw
test UDP/IPv6: ns to host (via tap)
host :> __TEMP__
hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS__ | nc -u -q1 -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
--
@@ -40,7 +40,7 @@ check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (via tap)
host :> __TEMP__
hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-nsout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
+nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
ns cat __TEMP_NS__ | nc -u -q1 -N __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
@@ -68,8 +68,8 @@ nsw
test UDP/IPv6: ns to host (via tap)
host :> __TEMP__
hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-nsout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway'
-nsout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname'
+nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
+nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
ns cat __TEMP_NS__ | nc -u -q1 -N __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
--
2.36.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] Tweak dhclient arguments for readability
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
2022-06-10 2:32 ` [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests David Gibson
2022-06-10 2:32 ` [PATCH 2/5] Don't abbreviate ip(8) arguments in examples and tests David Gibson
@ 2022-06-10 2:32 ` David Gibson
2022-06-10 2:32 ` [PATCH 4/5] Use dhclient instead of udhcpc David Gibson
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 7476 bytes --]
A number of tests and examples use dhclient in both IPv4 and IPv6 modes.
We use "dhclient -6" for IPv6, but usually just "dhclient" for IPv4. Add
an explicit "-4" argument to make it more clear and explicit.
In addition, when dhclient is run from within pasta it usually won't be
"real" root, and so will not have access to write the default global pid
file. This results in a mostly harmless but irritating error:
Can't create /var/run/dhclient.pid: Permission denied
We can avoid that by using the --no-pid flag to dhclient.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
passt.1 | 4 ++--
test/demo/passt | 6 +++---
test/demo/pasta | 6 +++---
test/dhcp/passt | 2 +-
test/dhcp/pasta | 2 +-
test/distro/ubuntu | 4 ++--
test/lib/setup | 2 +-
test/perf/passt_tcp | 2 +-
test/perf/passt_udp | 2 +-
test/two_guests/basic | 4 ++--
10 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/passt.1 b/passt.1
index d3af916..28704e9 100644
--- a/passt.1
+++ b/passt.1
@@ -484,7 +484,7 @@ udhcpc: started, v1.30.1
udhcpc: sending discover
udhcpc: sending select for 192.168.1.118
udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
-# dhclient -6
+# dhclient -6 --no-pid
# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
@@ -581,7 +581,7 @@ udhcpc: started, v1.30.1
udhcpc: sending discover
udhcpc: sending select for 192.168.1.118
udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
-# dhclient -6
+# dhclient -6 --no-pid
# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
diff --git a/test/demo/passt b/test/demo/passt
index d394a08..ee4e7c2 100644
--- a/test/demo/passt
+++ b/test/demo/passt
@@ -73,9 +73,9 @@ sleep 3
passt cd __TEMPDIR__/passt
passtb ./pasta
sleep 3
-passt /sbin/dhclient
+passt /sbin/dhclient -4 --no-pid
sleep 2
-passt /sbin/dhclient -6
+passt /sbin/dhclient -6 --no-pid
sleep 2
nl
@@ -112,7 +112,7 @@ guest ip link show
sleep 3
say Guest is up. Let's configure IPv4 first...
sleep 2
-guest dhclient
+guest dhclient -4
sleep 2
guest ip addr show
sleep 5
diff --git a/test/demo/pasta b/test/demo/pasta
index 8b13b5e..e2517ed 100644
--- a/test/demo/pasta
+++ b/test/demo/pasta
@@ -77,7 +77,7 @@ ns ip link show
sleep 3
say Let's configure IPv4 first...
sleep 2
-ns dhclient
+ns dhclient -4 --no-pid
sleep 2
ns ip addr show
sleep 5
@@ -87,7 +87,7 @@ say SLAAC is already done, but we can also
nl
say get another address via DHCPv6.
sleep 3
-ns dhclient -6
+ns dhclient -6 --no-pid
sleep 3
nl
@@ -146,7 +146,7 @@ temp TEMP
passtb ./pasta -p __TEMP__.pcap
sleep 2
passt
-passt /sbin/dhclient
+passt /sbin/dhclient -4 --no-pid
sleep 2
hostb tshark -r __TEMP__.pcap
sleep 5
diff --git a/test/dhcp/passt b/test/dhcp/passt
index ca76846..4648821 100644
--- a/test/dhcp/passt
+++ b/test/dhcp/passt
@@ -21,7 +21,7 @@ hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev
check [ -n "__IFNAME__" ]
test DHCP: address
-guest /sbin/dhclient __IFNAME__
+guest /sbin/dhclient -4 __IFNAME__
gout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
check [ "__ADDR__" = "__HOST_ADDR__" ]
diff --git a/test/dhcp/pasta b/test/dhcp/pasta
index 77e9e42..e76454a 100644
--- a/test/dhcp/pasta
+++ b/test/dhcp/pasta
@@ -35,7 +35,7 @@ nsout MTU ip -j link show | jq -rM '.[] | select(.ifname == "__IFNAME__").mtu'
check [ __MTU__ = 65520 ]
test DHCPv6: address
-ns /sbin/dhclient -6 __IFNAME__
+ns /sbin/dhclient -6 --no-pid __IFNAME__
nsout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local'
hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local'
check [ __ADDR6__ = __HOST_ADDR6__ ]
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 3ce156d..c9a2b4d 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -150,7 +150,7 @@ host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
host ./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __IMG__ -net socket,fd=5 -net nic,model=virtio
host PS1='$ '
-host dhclient
+host dhclient -4
# Skip apt-get update here: some updates to xenial-updates around 2022-01-30
# broke dependencies for libc6 and gcc-5 -- note that powerpc is not officially
# supported on this version
@@ -185,7 +185,7 @@ host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nograp
host service systemd-resolved stop
host export DEBIAN_FRONTEND=noninteractive
host apt-get -y remove needrestart snapd
-host dhclient
+host dhclient -4
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
diff --git a/test/lib/setup b/test/lib/setup
index ffc4171..32515bf 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -147,7 +147,7 @@ setup_passt_in_ns() {
pane_run NS "/sbin/udhcpc -i ${__ifname}"
pane_status NS
sleep 2
- pane_run NS "/sbin/dhclient -6 ${__ifname}"
+ pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}"
pane_status NS
__opts=
diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp
index 5f017db..c97178e 100644
--- a/test/perf/passt_tcp
+++ b/test/perf/passt_tcp
@@ -18,7 +18,7 @@ htools bc head sed seq
# In this setup, virtio_net TX queue sometimes hangs, still under investigation
def virtio_net_workaround
-guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient; dhclient -6; sleep 3
+guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient -4; dhclient -6; sleep 3
endef
test passt: throughput and latency
diff --git a/test/perf/passt_udp b/test/perf/passt_udp
index 0515f00..5155099 100644
--- a/test/perf/passt_udp
+++ b/test/perf/passt_udp
@@ -18,7 +18,7 @@ htools bc head sed
# In this setup, virtio_net TX queue sometimes hangs, still under investigation
def virtio_net_workaround
-guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient; dhclient -6; sleep 3
+guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; dhclient -4; dhclient -6; sleep 3
endef
test passt: throughput and latency
diff --git a/test/two_guests/basic b/test/two_guests/basic
index 09a06da..afe104b 100644
--- a/test/two_guests/basic
+++ b/test/two_guests/basic
@@ -23,8 +23,8 @@ check [ -n "__IFNAME1__" ]
check [ -n "__IFNAME2__" ]
test DHCP: addresses
-guest1 /sbin/dhclient __IFNAME1__
-guest2 /sbin/dhclient __IFNAME1__
+guest1 /sbin/dhclient -4 __IFNAME1__
+guest2 /sbin/dhclient -4 __IFNAME1__
g1out ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local'
g2out ADDR2 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[0].local'
hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
--
@@ -23,8 +23,8 @@ check [ -n "__IFNAME1__" ]
check [ -n "__IFNAME2__" ]
test DHCP: addresses
-guest1 /sbin/dhclient __IFNAME1__
-guest2 /sbin/dhclient __IFNAME1__
+guest1 /sbin/dhclient -4 __IFNAME1__
+guest2 /sbin/dhclient -4 __IFNAME1__
g1out ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").addr_info[0].local'
g2out ADDR2 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME2__").addr_info[0].local'
hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME__").addr_info[0].local'
--
2.36.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/5] Use dhclient instead of udhcpc
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
` (2 preceding siblings ...)
2022-06-10 2:32 ` [PATCH 3/5] Tweak dhclient arguments for readability David Gibson
@ 2022-06-10 2:32 ` David Gibson
2022-06-14 1:32 ` Stefano Brivio
2022-06-10 2:32 ` [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests David Gibson
2022-06-14 1:32 ` [PATCH 0/5] More test fixes for Fedora host Stefano Brivio
5 siblings, 1 reply; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 3942 bytes --]
For some reason, the passt/pasta tests and examples use dhclient for
DHCPv6, but in most cases use udhcpc for DHCPv4. Change it to use dhclient
for both DHCPv4 and DHCPv6. This means one less tool we need for testing,
plus dhclient is easily available on Fedora whereas udhcpc is not.
Note that the passt tests still rely on udhcpc indirectly because mbuto
wants to put it into the guest images it generates.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
passt.1 | 12 ++----------
test/README.md | 2 +-
test/dhcp/pasta | 4 ++--
test/lib/setup | 6 +++---
4 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/passt.1 b/passt.1
index 28704e9..3dccc63 100644
--- a/passt.1
+++ b/passt.1
@@ -479,11 +479,7 @@ NDP/DHCPv6:
assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17
router: fe80::62e3:27ff:fe33:2b01
#
-# udhcpc -i eth0
-udhcpc: started, v1.30.1
-udhcpc: sending discover
-udhcpc: sending select for 192.168.1.118
-udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
+# dhclient -4 --no-pid
# dhclient -6 --no-pid
# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
@@ -576,11 +572,7 @@ NDP/DHCPv6:
.fi
.BR " [Back to the original terminal]"
.nf
-# udhcpc -i eth0
-udhcpc: started, v1.30.1
-udhcpc: sending discover
-udhcpc: sending select for 192.168.1.118
-udhcpc: lease of 192.168.1.118 obtained, lease time 4294967295
+# dhclient -4 --no-pid
# dhclient -6 --no-pid
# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
diff --git a/test/README.md b/test/README.md
index 623e6e5..362690c 100644
--- a/test/README.md
+++ b/test/README.md
@@ -29,7 +29,7 @@ on a system, i.e. common utilities such as a shell are not included here.
Example for Debian, and possibly most Debian-based distributions:
build-essential git jq strace iperf3 qemu-system-x86 tmux sipcalc bc
- clang-tidy cppcheck isc-dhcp-common udhcpc psmisc linux-cpupower
+ clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower
netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc
qemu-system-misc qemu-system-x86 valgrind
diff --git a/test/dhcp/pasta b/test/dhcp/pasta
index e76454a..4652d09 100644
--- a/test/dhcp/pasta
+++ b/test/dhcp/pasta
@@ -12,7 +12,7 @@
# Author: Stefano Brivio <sbrivio(a)redhat.com>
onlyfor pasta
-nstools ip jq /sbin/udhcpc /sbin/dhclient
+nstools ip jq /sbin/dhclient
htools ip jq
test Interface name
@@ -20,7 +20,7 @@ nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifnam
check [ -n "__IFNAME__" ]
test DHCP: address
-ns /sbin/udhcpc -i __IFNAME__
+ns /sbin/dhclient -4 --no-pid __IFNAME__
nsout ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
hout HOST_ADDR ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[0].local'
check [ __ADDR__ = __HOST_ADDR__ ]
diff --git a/test/lib/setup b/test/lib/setup
index 32515bf..e57d97c 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -144,7 +144,7 @@ setup_passt_in_ns() {
pane_run NS "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
pane_wait NS
__ifname="$(pane_parse NS)"
- pane_run NS "/sbin/udhcpc -i ${__ifname}"
+ pane_run NS "/sbin/dhclient -4 --no-pid ${__ifname}"
pane_status NS
sleep 2
pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}"
@@ -232,8 +232,8 @@ setup_two_guests() {
pane_wait PASST_1
__ifname="$(pane_parse PASST_1)"
- pane_run GUEST_1 "/sbin/udhcpc -i ${__ifname}"
- pane_run GUEST_2 "/sbin/udhcpc -i ${__ifname}"
+ pane_run GUEST_1 "/sbin/dhclient -4 ${__ifname}"
+ pane_run GUEST_2 "/sbin/dhclient -4 ${__ifname}"
pane_status GUEST_1
pane_status GUEST_2
sleep 2
--
@@ -144,7 +144,7 @@ setup_passt_in_ns() {
pane_run NS "ip -j link show | jq -rM '.[] | select(.link_type == \"ether\").ifname'"
pane_wait NS
__ifname="$(pane_parse NS)"
- pane_run NS "/sbin/udhcpc -i ${__ifname}"
+ pane_run NS "/sbin/dhclient -4 --no-pid ${__ifname}"
pane_status NS
sleep 2
pane_run NS "/sbin/dhclient -6 --no-pid ${__ifname}"
@@ -232,8 +232,8 @@ setup_two_guests() {
pane_wait PASST_1
__ifname="$(pane_parse PASST_1)"
- pane_run GUEST_1 "/sbin/udhcpc -i ${__ifname}"
- pane_run GUEST_2 "/sbin/udhcpc -i ${__ifname}"
+ pane_run GUEST_1 "/sbin/dhclient -4 ${__ifname}"
+ pane_run GUEST_2 "/sbin/dhclient -4 ${__ifname}"
pane_status GUEST_1
pane_status GUEST_2
sleep 2
--
2.36.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
` (3 preceding siblings ...)
2022-06-10 2:32 ` [PATCH 4/5] Use dhclient instead of udhcpc David Gibson
@ 2022-06-10 2:32 ` David Gibson
2022-06-18 7:03 ` Stefano Brivio
2022-06-14 1:32 ` [PATCH 0/5] More test fixes for Fedora host Stefano Brivio
5 siblings, 1 reply; 12+ messages in thread
From: David Gibson @ 2022-06-10 2:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 12001 bytes --]
A number of the testcases use options specific the OpenBSD version of
netcat. That's available in Debian, but not easily available in Fedora.
Switch the pasta tests to using the nmap version of netcat (a.k.a. ncat).
This is easily available in both Debian and Fedora, and appears to be a
bit more modern and maintained as well.
ncat generally requires explicit listen addresses (which is good for
clarity anywhere). Its default options appear to remove the need for the
-N and -q options.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
test/README.md | 2 +-
test/demo/pasta | 12 ++++++------
test/tcp/pasta | 52 ++++++++++++++++++++++++-------------------------
test/udp/pasta | 29 ++++++++++++++-------------
4 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/test/README.md b/test/README.md
index 362690c..201332b 100644
--- a/test/README.md
+++ b/test/README.md
@@ -29,7 +29,7 @@ on a system, i.e. common utilities such as a shell are not included here.
Example for Debian, and possibly most Debian-based distributions:
build-essential git jq strace iperf3 qemu-system-x86 tmux sipcalc bc
- clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower
+ clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower ncat
netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc
qemu-system-misc qemu-system-x86 valgrind
diff --git a/test/demo/pasta b/test/demo/pasta
index e2517ed..de1bdc5 100644
--- a/test/demo/pasta
+++ b/test/demo/pasta
@@ -100,9 +100,9 @@ nl
say pasta detects bound ports and forwards them.
sleep 3
-nsb nc -6 -l -p 31337
+nsb ncat -6 -l ::1 31337
sleep 2
-host echo "Hello from the host" | nc -N ::1 31337
+host echo "Hello from the host" | ncat ::1 31337
sleep 5
nl
@@ -111,9 +111,9 @@ say Now the other way around...
nl
say we can use a loopback address
sleep 2
-hostb nc -l -p 31337
+hostb ncat -l ::1 31337
sleep 2
-ns echo "Hello from the namespace" | nc -N 127.0.0.1 31337
+ns echo "Hello from the namespace" | ncat 127.0.0.1 31337
sleep 5
nl
@@ -121,9 +121,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 nc -l -p 31337
+hostb ncat -l 0.0.0.0 31337
sleep 2
-ns echo "Hello from the namespace" | nc -N __GW__ 31337
+ns echo "Hello from the namespace" | ncat __GW__ 31337
sleep 3
nl
diff --git a/test/tcp/pasta b/test/tcp/pasta
index 2fece32..531da04 100644
--- a/test/tcp/pasta
+++ b/test/tcp/pasta
@@ -12,31 +12,31 @@
# Author: Stefano Brivio <sbrivio(a)redhat.com>
onlyfor pasta
-htools dd nc ip jq cat md5sum cut
-nstools nc ip jq cat md5sum cut
+htools dd ncat ip jq cat md5sum cut
+nstools ncat ip jq cat md5sum cut
test TCP/IPv4: host to ns: big transfer
temp TEMP_BIG
temp TEMP_NS_BIG
-nsb nc -4 -l 10002 > __TEMP_NS_BIG__
+nsb ncat -4 -l 127.0.0.1 10002 > __TEMP_NS_BIG__
host dd if=/dev/urandom bs=1M count=10 > __TEMP_BIG__
-host cat __TEMP_BIG__ | nc -N 127.0.0.1 10002
+host cat __TEMP_BIG__ | ncat 127.0.0.1 10002
nsw
hout MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
nsout NS_MD5_BIG md5sum __TEMP_NS_BIG__ | cut -d' ' -f1
check [ "__NS_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: ns to host (spliced): big transfer
-hostb nc -4 -l 10003 > __TEMP_BIG__
-ns cat __TEMP_NS_BIG__ | nc -N 127.0.0.1 10003
+hostb ncat -4 -l 127.0.0.1 10003 > __TEMP_BIG__
+ns cat __TEMP_NS_BIG__ | ncat 127.0.0.1 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: ns to host (via tap): big transfer
-hostb nc -4 -l 10003 > __TEMP_BIG__
+hostb ncat -4 -l 0.0.0.0 10003 > __TEMP_BIG__
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
-ns cat __TEMP_NS_BIG__ | nc -N __GW__ 10003
+ns cat __TEMP_NS_BIG__ | ncat __GW__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
@@ -44,50 +44,50 @@ check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv4: host to ns: small transfer
temp TEMP_SMALL
temp TEMP_NS_SMALL
-nsb nc -4 -l 10002 > __TEMP_NS_SMALL__
+nsb ncat -4 -l 127.0.0.1 10002 > __TEMP_NS_SMALL__
host dd if=/dev/urandom bs=2k count=1 > __TEMP_SMALL__
-host cat __TEMP_SMALL__ | nc -N 127.0.0.1 10002
+host cat __TEMP_SMALL__ | ncat 127.0.0.1 10002
nsw
hout MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
nsout NS_MD5_SMALL md5sum __TEMP_NS_SMALL__ | cut -d' ' -f1
check [ "__NS_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv4: ns to host (spliced): small transfer
-hostb nc -4 -l 10003 > __TEMP_SMALL__
-ns cat __TEMP_NS_SMALL__ | nc -N 127.0.0.1 10003
+hostb ncat -4 -l 127.0.0.1 10003 > __TEMP_SMALL__
+ns cat __TEMP_NS_SMALL__ | ncat 127.0.0.1 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv4: ns to host (via tap): small transfer
-hostb nc -4 -l 10003 > __TEMP_SMALL__
+hostb ncat -4 -l 0.0.0.0 10003 > __TEMP_SMALL__
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
-ns cat __TEMP_NS_SMALL__ | nc -N __GW__ 10003
+ns cat __TEMP_NS_SMALL__ | ncat __GW__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv6: host to ns: big transfer
-nsb nc -6 -l 10002 > __TEMP_NS_BIG__
-host cat __TEMP_BIG__ | nc -N ::1 10002
+nsb ncat -6 -l ::1 10002 > __TEMP_NS_BIG__
+host cat __TEMP_BIG__ | ncat ::1 10002
nsw
hout MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
nsout NS_MD5_BIG md5sum __TEMP_NS_BIG__ | cut -d' ' -f1
check [ "__NS_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv6: ns to host (spliced): big transfer
-hostb nc -6 -l 10003 > __TEMP_BIG__
-ns cat __TEMP_NS_BIG__ | nc -N ::1 10003
+hostb ncat -6 -l ::1 10003 > __TEMP_BIG__
+ns cat __TEMP_NS_BIG__ | ncat ::1 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
nsw
test TCP/IPv6: ns to host (via tap): big transfer
-hostb nc -6 -l 10003 > __TEMP_BIG__
+hostb ncat -6 -l :: 10003 > __TEMP_BIG__
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
-ns cat __TEMP_NS_BIG__ | nc -N __GW6__%__IFNAME__ 10003
+ns cat __TEMP_NS_BIG__ | ncat __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
@@ -95,24 +95,24 @@ check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
test TCP/IPv6: host to ns: small transfer
temp TEMP_SMALL
temp TEMP_NS_SMALL
-nsb nc -6 -l 10002 > __TEMP_NS_SMALL__
+nsb ncat -6 -l ::1 10002 > __TEMP_NS_SMALL__
host dd if=/dev/urandom bs=2k count=1 > __TEMP_SMALL__
-host cat __TEMP_SMALL__ | nc -N ::1 10002
+host cat __TEMP_SMALL__ | ncat ::1 10002
nsw
hout MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
nsout NS_MD5_SMALL md5sum __TEMP_NS_SMALL__ | cut -d' ' -f1
check [ "__NS_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv6: ns to host (spliced): small transfer
-hostb nc -6 -l 10003 > __TEMP_SMALL__
-ns cat __TEMP_NS_SMALL__ | nc -N ::1 10003
+hostb ncat -6 -l ::1 10003 > __TEMP_SMALL__
+ns cat __TEMP_NS_SMALL__ | ncat ::1 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
test TCP/IPv6: ns to host (via tap): small transfer
-hostb nc -6 -l 10003 > __TEMP_SMALL__
-ns cat __TEMP_NS_SMALL__ | nc -N __GW6__%__IFNAME__ 10003
+hostb ncat -6 -l :: 10003 > __TEMP_SMALL__
+ns cat __TEMP_NS_SMALL__ | ncat __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5_SMALL md5sum __TEMP_SMALL__ | cut -d' ' -f1
check [ "__HOST_MD5_SMALL__" = "__MD5_SMALL__" ]
diff --git a/test/udp/pasta b/test/udp/pasta
index c26cea9..3123c42 100644
--- a/test/udp/pasta
+++ b/test/udp/pasta
@@ -12,17 +12,18 @@
# Author: Stefano Brivio <sbrivio(a)redhat.com>
onlyfor pasta
-nstools nc tee grep cat ip jq md5sum cut
-htools printf dd nc tee grep cat ip jq md5sum cut
+nstools ncat tee grep cat ip jq md5sum cut
+htools printf dd ncat tee grep cat ip jq md5sum cut
test UDP/IPv4: host to ns
temp TEMP
temp TEMP_NS
temp NC_PID
ns :> __TEMP_NS__
-nsb (nc -u -q1 -4 -l 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+nsb (ncat -u -4 -l 127.0.0.1 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
-host cat __TEMP__ | nc -u -q1 -N 127.0.0.1 10002
+
+host cat __TEMP__ | ncat -u 127.0.0.1 10002
nsw
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
@@ -30,26 +31,26 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (recvmmsg/sendmmsg)
host :> __TEMP__
-hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -4 -l 127.0.0.1 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
sleep 1
-ns cat __TEMP_NS__ | nc -u -q1 -N 127.0.0.1 10003
+ns cat __TEMP_NS__ | ncat -u 127.0.0.1 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (via tap)
host :> __TEMP__
-hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -4 -l 0.0.0.0 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
-ns cat __TEMP_NS__ | nc -u -q1 -N __GW__ 10003
+ns cat __TEMP_NS__ | ncat -u __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv6: host to ns
ns :> __TEMP_NS__
-nsb (nc -u -q1 -6 -l 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-host cat __TEMP__ | nc -u -q1 -N ::1 10002
+nsb (ncat -u -6 -l ::1 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+host cat __TEMP__ | ncat -u ::1 10002
nsw
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
@@ -57,9 +58,9 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv6: ns to host (recvmmsg/sendmmsg)
host :> __TEMP__
-hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -6 -l ::1 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
sleep 1
-ns cat __TEMP_NS__ | nc -u -q1 -N ::1 10003
+ns cat __TEMP_NS__ | ncat -u ::1 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
@@ -67,10 +68,10 @@ nsw
test UDP/IPv6: ns to host (via tap)
host :> __TEMP__
-hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -6 -l :: 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
-ns cat __TEMP_NS__ | nc -u -q1 -N __GW6__%__IFNAME__ 10003
+ns cat __TEMP_NS__ | ncat -u __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
--
@@ -12,17 +12,18 @@
# Author: Stefano Brivio <sbrivio(a)redhat.com>
onlyfor pasta
-nstools nc tee grep cat ip jq md5sum cut
-htools printf dd nc tee grep cat ip jq md5sum cut
+nstools ncat tee grep cat ip jq md5sum cut
+htools printf dd ncat tee grep cat ip jq md5sum cut
test UDP/IPv4: host to ns
temp TEMP
temp TEMP_NS
temp NC_PID
ns :> __TEMP_NS__
-nsb (nc -u -q1 -4 -l 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+nsb (ncat -u -4 -l 127.0.0.1 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
-host cat __TEMP__ | nc -u -q1 -N 127.0.0.1 10002
+
+host cat __TEMP__ | ncat -u 127.0.0.1 10002
nsw
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
@@ -30,26 +31,26 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (recvmmsg/sendmmsg)
host :> __TEMP__
-hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -4 -l 127.0.0.1 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
sleep 1
-ns cat __TEMP_NS__ | nc -u -q1 -N 127.0.0.1 10003
+ns cat __TEMP_NS__ | ncat -u 127.0.0.1 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv4: ns to host (via tap)
host :> __TEMP__
-hostb (nc -u -q1 -4 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -4 -l 0.0.0.0 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
-ns cat __TEMP_NS__ | nc -u -q1 -N __GW__ 10003
+ns cat __TEMP_NS__ | ncat -u __GW__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
test UDP/IPv6: host to ns
ns :> __TEMP_NS__
-nsb (nc -u -q1 -6 -l 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
-host cat __TEMP__ | nc -u -q1 -N ::1 10002
+nsb (ncat -u -6 -l ::1 10002 & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+host cat __TEMP__ | ncat -u ::1 10002
nsw
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
@@ -57,9 +58,9 @@ check [ "__NS_MD5__" = "__MD5__" ]
test UDP/IPv6: ns to host (recvmmsg/sendmmsg)
host :> __TEMP__
-hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -6 -l ::1 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
sleep 1
-ns cat __TEMP_NS__ | nc -u -q1 -N ::1 10003
+ns cat __TEMP_NS__ | ncat -u ::1 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
@@ -67,10 +68,10 @@ nsw
test UDP/IPv6: ns to host (via tap)
host :> __TEMP__
-hostb (nc -u -q1 -6 -l 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
+hostb (ncat -u -6 -l :: 10003 & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
-ns cat __TEMP_NS__ | nc -u -q1 -N __GW6__%__IFNAME__ 10003
+ns cat __TEMP_NS__ | ncat -u __GW6__%__IFNAME__ 10003
hostw
hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
check [ "__HOST_MD5__" = "__MD5__" ]
--
2.36.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/5] More test fixes for Fedora host
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
` (4 preceding siblings ...)
2022-06-10 2:32 ` [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests David Gibson
@ 2022-06-14 1:32 ` Stefano Brivio
5 siblings, 0 replies; 12+ messages in thread
From: Stefano Brivio @ 2022-06-14 1:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
Hi David,
On Fri, 10 Jun 2022 12:32:40 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
> Hi Stefano,
>
> Here's another batch of fixes for the passt/pasta tests. With this
> lot I'm now able to get the build and pasta tests passing on my Fedora
> workstation. The passt and distro tests still fail or crash, I'm
> continuing to look at those (it looks like there are some very fragile
> behaviours in qrap which means they're not even getting started).
Thanks a lot! The entire series looks good to me, I'm currently running
the tests with it, I'll apply once they complete.
--
Stefano
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] Use dhclient instead of udhcpc
2022-06-10 2:32 ` [PATCH 4/5] Use dhclient instead of udhcpc David Gibson
@ 2022-06-14 1:32 ` Stefano Brivio
2022-06-14 2:47 ` David Gibson
0 siblings, 1 reply; 12+ messages in thread
From: Stefano Brivio @ 2022-06-14 1:32 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 548 bytes --]
On Fri, 10 Jun 2022 12:32:44 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
> For some reason, the passt/pasta tests and examples use dhclient for
> DHCPv6, but in most cases use udhcpc for DHCPv4.
...the reason was that udhcpc doesn't do DHCPv6, and for DHCP I
started with udhcpc, then wanted to add a bit of diversity (udhcpc in
tests for pasta, dhclient for passt) -- it helped to find some bugs
earlier on.
Given that dhclient is anyway pickier than udhcpc, I think we can
safely stick to the former at this point.
--
Stefano
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] Use dhclient instead of udhcpc
2022-06-14 1:32 ` Stefano Brivio
@ 2022-06-14 2:47 ` David Gibson
0 siblings, 0 replies; 12+ messages in thread
From: David Gibson @ 2022-06-14 2:47 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
On Tue, Jun 14, 2022 at 03:32:59AM +0200, Stefano Brivio wrote:
> On Fri, 10 Jun 2022 12:32:44 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
>
> > For some reason, the passt/pasta tests and examples use dhclient for
> > DHCPv6, but in most cases use udhcpc for DHCPv4.
>
> ...the reason was that udhcpc doesn't do DHCPv6, and for DHCP I
> started with udhcpc,
Yeah, that's kinda what I guessed.
> then wanted to add a bit of diversity (udhcpc in
> tests for pasta, dhclient for passt) -- it helped to find some bugs
> earlier on.
Ah. So I think we could potentially restore that kind of testing, but
move it into tests with specifically constructed guests (or container
images) where we can choose the distro and get udhcpc (or other
clients to test those to. For now, I don't think we want it in the
"base" set of tests though.
> Given that dhclient is anyway pickier than udhcpc, I think we can
> safely stick to the former at this point.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests
2022-06-10 2:32 ` [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests David Gibson
@ 2022-06-14 14:10 ` Stefano Brivio
2022-06-15 0:35 ` David Gibson
0 siblings, 1 reply; 12+ messages in thread
From: Stefano Brivio @ 2022-06-14 14:10 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]
On Fri, 10 Jun 2022 12:32:41 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
> distro/fedora contains two versions of the basic tests, used for different
> Fedora versions. One uses explicit listening address for netcat in some
> extra places, the other does not. Apparently the older netcat versions
> didn't require the explicit addresses. Not supplying addresses doesn't
> test anything useful though, just a detail in netcat's behaviour. So,
> it's cleaner to just always supply explicit addresses.
>
> In addition, we're explicitly expecting the nmap version of ncat, also
> known as "ncat". So, it's more explicit what we're after if we invoke it
> via that name rather than "nc", which will go via an /etc/alternatives
> link.
>
> Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> ---
> test/distro/fedora | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/test/distro/fedora b/test/distro/fedora
> index f2f8f27..b7f1e3b 100644
> --- a/test/distro/fedora
> +++ b/test/distro/fedora
> @@ -16,13 +16,13 @@ htools wget virt-edit guestfish head sed cat kill
>
> # Quick pasta test: send message from init to ns, and from ns to init
> def distro_quick_pasta_test
> -host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc ::1 9999) &
> +host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
This doesn't work:
$ ncat -6 -l -p 9999 ::1 > /tmp/ns_msg &
[1] 21
$ Ncat: bind to ::1:31337: Address already in use. QUITTING.
because with ncat(1) '-p' doesn't specify the listening port -- I see that
you changed this to the right version for tests under 'pasta/', that works
fine. I fixed this up (together with the other occurrences), re-running
tests now, I can merge the fix-up directly.
--
Stefano
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests
2022-06-14 14:10 ` Stefano Brivio
@ 2022-06-15 0:35 ` David Gibson
0 siblings, 0 replies; 12+ messages in thread
From: David Gibson @ 2022-06-15 0:35 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 2424 bytes --]
On Tue, Jun 14, 2022 at 04:10:48PM +0200, Stefano Brivio wrote:
> On Fri, 10 Jun 2022 12:32:41 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
>
> > distro/fedora contains two versions of the basic tests, used for different
> > Fedora versions. One uses explicit listening address for netcat in some
> > extra places, the other does not. Apparently the older netcat versions
> > didn't require the explicit addresses. Not supplying addresses doesn't
> > test anything useful though, just a detail in netcat's behaviour. So,
> > it's cleaner to just always supply explicit addresses.
> >
> > In addition, we're explicitly expecting the nmap version of ncat, also
> > known as "ncat". So, it's more explicit what we're after if we invoke it
> > via that name rather than "nc", which will go via an /etc/alternatives
> > link.
> >
> > Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> > ---
> > test/distro/fedora | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/test/distro/fedora b/test/distro/fedora
> > index f2f8f27..b7f1e3b 100644
> > --- a/test/distro/fedora
> > +++ b/test/distro/fedora
> > @@ -16,13 +16,13 @@ htools wget virt-edit guestfish head sed cat kill
> >
> > # Quick pasta test: send message from init to ns, and from ns to init
> > def distro_quick_pasta_test
> > -host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc ::1 9999) &
> > +host (ncat -6 -l -p 10000 ::1 > /tmp/init_msg; echo "from_init" | ncat ::1 9999) &
>
> This doesn't work:
>
> $ ncat -6 -l -p 9999 ::1 > /tmp/ns_msg &
> [1] 21
> $ Ncat: bind to ::1:31337: Address already in use. QUITTING.
>
> because with ncat(1) '-p' doesn't specify the listening port -- I see that
> you changed this to the right version for tests under 'pasta/', that works
> fine. I fixed this up (together with the other occurrences), re-running
> tests now, I can merge the fix-up directly.
Ah, thanks. I noticed that wrinkle while I was working on this, but
obviously I missed fixing up at least one of the instances, sorry. I
guess it's kind of inevitable given that I don't have the full
testsuite running yet :/.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests
2022-06-10 2:32 ` [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests David Gibson
@ 2022-06-18 7:03 ` Stefano Brivio
0 siblings, 0 replies; 12+ messages in thread
From: Stefano Brivio @ 2022-06-18 7:03 UTC (permalink / raw)
To: passt-dev
[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]
On Fri, 10 Jun 2022 12:32:45 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
> A number of the testcases use options specific the OpenBSD version of
> netcat. That's available in Debian, but not easily available in Fedora.
> Switch the pasta tests to using the nmap version of netcat (a.k.a. ncat).
> This is easily available in both Debian and Fedora, and appears to be a
> bit more modern and maintained as well.
>
> ncat generally requires explicit listen addresses (which is good for
> clarity anywhere). Its default options appear to remove the need for the
> -N and -q options.
>
> Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> ---
> test/README.md | 2 +-
> test/demo/pasta | 12 ++++++------
> test/tcp/pasta | 52 ++++++++++++++++++++++++-------------------------
> test/udp/pasta | 29 ++++++++++++++-------------
> 4 files changed, 48 insertions(+), 47 deletions(-)
>
> diff --git a/test/README.md b/test/README.md
> index 362690c..201332b 100644
> --- a/test/README.md
> +++ b/test/README.md
> @@ -29,7 +29,7 @@ on a system, i.e. common utilities such as a shell are not included here.
> Example for Debian, and possibly most Debian-based distributions:
>
> build-essential git jq strace iperf3 qemu-system-x86 tmux sipcalc bc
> - clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower
> + clang-tidy cppcheck isc-dhcp-common psmisc linux-cpupower ncat
> netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc
> qemu-system-misc qemu-system-x86 valgrind
>
> diff --git a/test/demo/pasta b/test/demo/pasta
> index e2517ed..de1bdc5 100644
> --- a/test/demo/pasta
> +++ b/test/demo/pasta
> @@ -100,9 +100,9 @@ nl
> say pasta detects bound ports and forwards them.
> sleep 3
>
> -nsb nc -6 -l -p 31337
> +nsb ncat -6 -l ::1 31337
> sleep 2
> -host echo "Hello from the host" | nc -N ::1 31337
> +host echo "Hello from the host" | ncat ::1 31337
> sleep 5
>
> nl
> @@ -111,9 +111,9 @@ say Now the other way around...
> nl
> say we can use a loopback address
> sleep 2
> -hostb nc -l -p 31337
> +hostb ncat -l ::1 31337
> sleep 2
> -ns echo "Hello from the namespace" | nc -N 127.0.0.1 31337
> +ns echo "Hello from the namespace" | ncat 127.0.0.1 31337
...changing this to ::1. :)
--
Stefano
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-06-18 7:03 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 2:32 [PATCH 0/5] More test fixes for Fedora host David Gibson
2022-06-10 2:32 ` [PATCH 1/5] tests: Use more explicit netcat options for distro/fedora tests David Gibson
2022-06-14 14:10 ` Stefano Brivio
2022-06-15 0:35 ` David Gibson
2022-06-10 2:32 ` [PATCH 2/5] Don't abbreviate ip(8) arguments in examples and tests David Gibson
2022-06-10 2:32 ` [PATCH 3/5] Tweak dhclient arguments for readability David Gibson
2022-06-10 2:32 ` [PATCH 4/5] Use dhclient instead of udhcpc David Gibson
2022-06-14 1:32 ` Stefano Brivio
2022-06-14 2:47 ` David Gibson
2022-06-10 2:32 ` [PATCH 5/5] tests: Use nmap-ncat instead of openbsd netcat for pasta tests David Gibson
2022-06-18 7:03 ` Stefano Brivio
2022-06-14 1:32 ` [PATCH 0/5] More test fixes for Fedora host Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).