public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob cd686e0c8d9059228f1a8f71fa9418ca9ccbd50b 2184 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
# SPDX-License-Identifier: GPL-2.0-or-later
#
# PASST - Plug A Simple Socket Transport
#  for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
#  for network namespace/tap device mode
#
# test/migrate/bidirectional - Check migration with messages in both directions
#
# Copyright (c) 2025 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>

g1tools	ip jq dhclient socat cat
htools	ip jq

test	Interface name
g1out	IFNAME1 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] | .[0]'
hout	HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]'
check	[ -n "__IFNAME1__" ]

test	DHCP: address
guest1	ip link set dev __IFNAME1__ up
guest1	/sbin/dhclient -4 __IFNAME1__
g1out	ADDR1 ip -j -4 addr show|jq -rM '.[] | select(.ifname == "__IFNAME1__").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__" ]

test	TCP/IPv4: guest1/guest2 > host, host > guest1/guest2
g1out	GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'

hostb	socat -u TCP4-LISTEN:10006 OPEN:msg,create,trunc
guest1b	socat -u TCP4-LISTEN:10001 OPEN:msg,create,trunc
sleep	1

guest1b	socat -u UNIX-RECV:proxy.sock,null-eof TCP4:169.254.1.1:10006
hostb	socat -u UNIX-RECV:__STATESETUP__/proxy.sock,null-eof TCP4:__ADDR1__:10001
sleep	1
guest1	printf "Hello from guest 1" | socat -u STDIN UNIX:proxy.sock
host	printf "Dear guest 1," | socat -u STDIN UNIX:__STATESETUP__/proxy.sock
sleep	1

mon	echo "migrate tcp:0:20005" | socat -u STDIN UNIX:__STATESETUP__/qemu_1_mon.sock

sleep	1
guest2	printf " and from guest 2" | socat -u STDIN UNIX:proxy.sock,shut-null
host	printf " you are now guest 2" | socat -u STDIN UNIX:__STATESETUP__/proxy.sock,shut-null

hostw
# FIXME: guest2w doesn't work here because shell jobs are (also) from guest #1,
# use sleep 1 for the moment
sleep	1

hout	MSG cat msg
check	[ "__MSG__" = "Hello from guest 1 and from guest 2" ]

g2out	MSG cat msg
check	[ "__MSG__" = "Dear guest 1, you are now guest 2" ]

debug log:

solving cd686e0c ...
retrying cd686e0c as cd686e0
found cd686e0 in https://archives.passt.top/passt-dev/20250207010724.3121569-10-sbrivio@redhat.com/

applying [1/1] https://archives.passt.top/passt-dev/20250207010724.3121569-10-sbrivio@redhat.com/
diff --git a/test/migrate/bidirectional b/test/migrate/bidirectional
new file mode 100644
index 0000000..cd686e0

Checking patch test/migrate/bidirectional...
Applied patch test/migrate/bidirectional cleanly.

index at:
100644 cd686e0c8d9059228f1a8f71fa9418ca9ccbd50b	test/migrate/bidirectional

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).