From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: Re: [PATCH 2/7] Separately locate external interfaces for IPv4 and IPv6 Date: Mon, 01 Aug 2022 12:23:49 +0200 Message-ID: <20220801122344.055473b6@elisabeth> In-Reply-To: <20220722053118.1067459-3-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0666310754181427006==" --===============0666310754181427006== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, 22 Jul 2022 15:31:13 +1000 David Gibson wrote: > Now that the back end allows passt/pasta to use different external > interfaces for IPv4 and IPv6, use that to do the right thing in the case > that the host has IPv4 and IPv6 connectivity via different interfaces. > If the user hasn't explicitly chosen an interface, separately search for > a suitable external interface for each protocol. >=20 > As a bonus, this substantially simplifies the external interface probe. It > also eliminates a subtle confusing case where in some circumstances we > would pick the first interface in interface index order, and sometimes in > order of routes returned from netlink. On some network configurations that > could cause tests to fail, because the logic in the tests was subtly > different (it always used route order). >=20 > Signed-off-by: David Gibson > --- > conf.c | 19 +++++++++-- > netlink.c | 79 ++++--------------------------------------- > netlink.h | 2 +- > test/dhcp/passt | 3 +- > test/dhcp/pasta | 3 +- > test/ndp/passt | 4 +-- > test/two_guests/basic | 3 +- > 7 files changed, 33 insertions(+), 80 deletions(-) >=20 > [...] > > diff --git a/test/dhcp/passt b/test/dhcp/passt > index f45227a..11e0eb3 100644 > --- a/test/dhcp/passt > +++ b/test/dhcp/passt > @@ -17,6 +17,7 @@ htools ip jq sed tr head > test Interface name > gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type =3D=3D "ethe= r").ifname' > hout HOST_IFNAME ip -j -4 route show|jq -rM '[.[] | select(.dst =3D=3D "de= fault").dev] | .[0]' > +hout HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst =3D=3D "d= efault").dev] | .[0]' > check [ -n "__IFNAME__" ] > =20 > test DHCP: address > @@ -49,7 +50,7 @@ check [ "__SEARCH__" =3D "__HOST_SEARCH__" ] > test DHCPv6: address > guest /sbin/dhclient -6 __IFNAME__ > gout ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__IFNAM= E__").addr_info[] | select(.prefixlen =3D=3D 128).local' > -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__= HOST_IFNAME__").addr_info[] | select(.scope =3D=3D "global").local' > +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__= HOST_IFNAME6__").addr_info[] | select(.scope =3D=3D "global").local' > check [ "__ADDR6__" =3D "__HOST_ADDR6__" ] > =20 > test DHCPv6: route This, > [...] >=20 > diff --git a/test/two_guests/basic b/test/two_guests/basic > index f7c016d..e226178 100644 > --- a/test/two_guests/basic > +++ b/test/two_guests/basic > @@ -19,6 +19,7 @@ test Interface names > g1out IFNAME1 ip -j link show | jq -rM '.[] | select(.link_type =3D=3D "et= her").ifname' > g2out IFNAME2 ip -j link show | jq -rM '.[] | select(.link_type =3D=3D "et= her").ifname' > hout HOST_IFNAME ip -j -4 route show|jq -rM '[.[] | select(.dst =3D=3D "de= fault").dev] | .[0]' > +hout HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst =3D=3D "d= efault").dev] | .[0]' > check [ -n "__IFNAME1__" ] > check [ -n "__IFNAME2__" ] > =20 > @@ -40,7 +41,7 @@ guest1 /sbin/dhclient -6 __IFNAME1__ > guest2 /sbin/dhclient -6 __IFNAME2__ > g1out ADDR1_6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__IF= NAME1__").addr_info[] | select(.prefixlen =3D=3D 128).local' > g2out ADDR2_6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__IF= NAME2__").addr_info[] | select(.prefixlen =3D=3D 128).local' > -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__= HOST_IFNAME__").addr_info[] | select(.scope =3D=3D "global").local' > +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname =3D=3D "__= HOST_IFNAME6__").addr_info[] | select(.scope =3D=3D "global").local' > check [ "__ADDR1_6__" =3D "__HOST_ADDR6__" ] > check [ "__ADDR2_6__" =3D "__HOST_ADDR6__" ] > =20 and this are based on patch 17/18 from your previous series ("tests: Correct determination of host interface name in tests"). I went ahead and applied that patch (which I skipped previously) before this one, anyway it makes sense now. --=20 Stefano --===============0666310754181427006==--