From: David Gibson <david@gibson.dropbear.id.au>
To: Yumei Huang <yuhuang@redhat.com>
Cc: passt-dev@passt.top, sbrivio@redhat.com
Subject: Re: [PATCH] test: Fix IPv6 address/prefix mismatch error
Date: Wed, 26 Nov 2025 14:52:18 +1100 [thread overview]
Message-ID: <aSZ5cstAk5R40vR7@zatzit> (raw)
In-Reply-To: <20251126032147.27242-1-yuhuang@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 17410 bytes --]
On Wed, Nov 26, 2025 at 11:21:47AM +0800, Yumei Huang wrote:
> For IPv6 addresses within the same scope group, Linux kernel preserves
> insertion order, where the first inserted address appears last. As a
> result, the ordering inside pasta differs from the host, causing a few
> tests to fail when they compare only the first address on each side.
> Fix this by checking that the guest’s first address matches any of the
> host’s addresses.
>
> Link: https://bugs.passt.top/show_bug.cgi?id=175
> Signed-off-by: Yumei Huang <yuhuang@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> test/migrate/basic | 4 ++--
> test/migrate/basic_fin | 4 ++--
> test/migrate/iperf3_bidir6 | 4 ++--
> test/migrate/iperf3_in6 | 4 ++--
> test/migrate/iperf3_many_out6 | 4 ++--
> test/migrate/iperf3_out6 | 4 ++--
> test/migrate/rampstream_in | 4 ++--
> test/migrate/rampstream_out | 4 ++--
> test/passt/dhcp | 4 ++--
> test/passt/ndp | 6 +++---
> test/passt_in_ns/dhcp | 4 ++--
> test/pasta/dhcp | 4 ++--
> test/pasta/ndp | 6 +++---
> test/two_guests/basic | 6 +++---
> 14 files changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/test/migrate/basic b/test/migrate/basic
> index c22fee8..bab2d76 100644
> --- a/test/migrate/basic
> +++ b/test/migrate/basic
> @@ -39,8 +39,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv4: guest1/guest2 > host
> g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/migrate/basic_fin b/test/migrate/basic_fin
> index c35c269..1d92c92 100644
> --- a/test/migrate/basic_fin
> +++ b/test/migrate/basic_fin
> @@ -39,8 +39,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv4: guest1, half-close, guest2 > host
> g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/migrate/iperf3_bidir6 b/test/migrate/iperf3_bidir6
> index 60b2a9b..e95eee8 100644
> --- a/test/migrate/iperf3_bidir6
> +++ b/test/migrate/iperf3_bidir6
> @@ -44,8 +44,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv6 host <-> guest flood, many flows, during migration
>
> diff --git a/test/migrate/iperf3_in6 b/test/migrate/iperf3_in6
> index 9b7f2c6..0e863a4 100644
> --- a/test/migrate/iperf3_in6
> +++ b/test/migrate/iperf3_in6
> @@ -44,8 +44,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv6 host to guest throughput during migration
>
> diff --git a/test/migrate/iperf3_many_out6 b/test/migrate/iperf3_many_out6
> index 9b3095f..179e269 100644
> --- a/test/migrate/iperf3_many_out6
> +++ b/test/migrate/iperf3_many_out6
> @@ -44,8 +44,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv6 guest to host flood, many flows, during migration
>
> diff --git a/test/migrate/iperf3_out6 b/test/migrate/iperf3_out6
> index b94a70c..20e6e95 100644
> --- a/test/migrate/iperf3_out6
> +++ b/test/migrate/iperf3_out6
> @@ -44,8 +44,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv6 guest to host throughput during migration
>
> diff --git a/test/migrate/rampstream_in b/test/migrate/rampstream_in
> index 3c7fd20..5212dfc 100644
> --- a/test/migrate/rampstream_in
> +++ b/test/migrate/rampstream_in
> @@ -40,8 +40,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv4: sequence check, ramps, inbound
> g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/migrate/rampstream_out b/test/migrate/rampstream_out
> index 8cff6d9..897396d 100644
> --- a/test/migrate/rampstream_out
> +++ b/test/migrate/rampstream_out
> @@ -40,8 +40,8 @@ guest1 /sbin/dhclient -6 __IFNAME1__
> # Wait for DAD to complete on the DHCP address
> guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
>
> test TCP/IPv4: sequence check, ramps, outbound
> g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/passt/dhcp b/test/passt/dhcp
> index dc6b880..904faab 100644
> --- a/test/passt/dhcp
> +++ b/test/passt/dhcp
> @@ -61,8 +61,8 @@ guest /sbin/dhclient -6 __IFNAME__
> # Wait for DAD to complete
> guest while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> gout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR6__"
>
> test DHCPv6: route
> gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/passt/ndp b/test/passt/ndp
> index df77cdc..80b72bb 100644
> --- a/test/passt/ndp
> +++ b/test/passt/ndp
> @@ -25,9 +25,9 @@ check [ -n "__IFNAME__" ]
> test SLAAC: prefix
> gout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.protocol == "kernel_ra") | .local + "/" + (.prefixlen | tostring)] | .[0]'
> gout PREFIX6 sipcalc __ADDR6__ | grep prefix | cut -d' ' -f4
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4
> -check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join("/64 ")'
> +hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4 | tr '\n' ' '
> +check echo "__HOST_PREFIX6__" | grep -wq "__PREFIX6__"
>
> test SLAAC: route
> gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/passt_in_ns/dhcp b/test/passt_in_ns/dhcp
> index 0ccb480..9d89049 100644
> --- a/test/passt_in_ns/dhcp
> +++ b/test/passt_in_ns/dhcp
> @@ -55,8 +55,8 @@ guest /sbin/dhclient -6 __IFNAME__
> # Wait for DAD to complete
> guest while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> gout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(",")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR6__"
>
> test DHCPv6: route
> gout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/pasta/dhcp b/test/pasta/dhcp
> index e1c66be..366935f 100644
> --- a/test/pasta/dhcp
> +++ b/test/pasta/dhcp
> @@ -39,8 +39,8 @@ ns /sbin/dhclient -6 --no-pid __IFNAME__
> ns while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> hout HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]'
> nsout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ __ADDR6__ = __HOST_ADDR6__ ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR6__"
>
> test DHCPv6: route
> nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/pasta/ndp b/test/pasta/ndp
> index e482876..1d385c7 100644
> --- a/test/pasta/ndp
> +++ b/test/pasta/ndp
> @@ -24,9 +24,9 @@ ns while ! ip -j -6 addr show dev __IFNAME__ | jq -e '.[].addr_info.[] | select(
> test SLAAC: prefix
> nsout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.protocol == "kernel_ra") | .local + "/" + (.prefixlen | tostring)] | .[0]'
> nsout PREFIX6 sipcalc __ADDR6__ | grep prefix | cut -d' ' -f4
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM ['.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4
> -check [ "__PREFIX6__" = "__HOST_PREFIX6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM ['.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local]| join("/64 ")'
> +hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4 | tr '\n' ' '
> +check echo "__HOST_PREFIX6__" | grep -wq "__PREFIX6__"
>
> test SLAAC: route
> nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
> diff --git a/test/two_guests/basic b/test/two_guests/basic
> index a9625f3..cb48bce 100644
> --- a/test/two_guests/basic
> +++ b/test/two_guests/basic
> @@ -45,9 +45,9 @@ guest1 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1;
> guest2 while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done
> g1out ADDR1_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME1__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> g2out ADDR2_6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME2__").addr_info[] | select(.prefixlen == 128).local] | .[0]'
> -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | .[0]'
> -check [ "__ADDR1_6__" = "__HOST_ADDR6__" ]
> -check [ "__ADDR2_6__" = "__HOST_ADDR6__" ]
> +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope != "host" and .scope != "link" and .deprecated != true).local] | join(" ")'
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR1_6__"
> +check echo "__HOST_ADDR6__" | grep -wq "__ADDR2_6__"
>
> test TCP/IPv4: guest 1 > guest 2
> g1out GW1 ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
> --
> 2.51.1
>
--
David Gibson (he or they) | 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 --]
next prev parent reply other threads:[~2025-11-26 3:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 3:21 Yumei Huang
2025-11-26 3:52 ` David Gibson [this message]
2025-11-27 22:33 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aSZ5cstAk5R40vR7@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
--cc=yuhuang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).