diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-07-22 15:31:13 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-07-30 21:57:50 +0200 |
commit | 06abfcf6d95762976d37aa5721c16802c649efd4 (patch) | |
tree | 38b2b7936c0a107015706dd3feadc2021edab13a /test/dhcp | |
parent | 3eaf9f532021326a47f70046b05854d8b1819825 (diff) | |
download | passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar.gz passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar.bz2 passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar.lz passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar.xz passt-06abfcf6d95762976d37aa5721c16802c649efd4.tar.zst passt-06abfcf6d95762976d37aa5721c16802c649efd4.zip |
Separately locate external interfaces for IPv4 and IPv6
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.
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).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/dhcp')
-rw-r--r-- | test/dhcp/passt | 3 | ||||
-rw-r--r-- | test/dhcp/pasta | 3 |
2 files changed, 4 insertions, 2 deletions
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 == "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 "__IFNAME__" ] test DHCP: address @@ -49,7 +50,7 @@ check [ "__SEARCH__" = "__HOST_SEARCH__" ] test DHCPv6: address guest /sbin/dhclient -6 __IFNAME__ 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' +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope == "global").local' check [ "__ADDR6__" = "__HOST_ADDR6__" ] test DHCPv6: route diff --git a/test/dhcp/pasta b/test/dhcp/pasta index 65b1d42..076ec8d 100644 --- a/test/dhcp/pasta +++ b/test/dhcp/pasta @@ -35,8 +35,9 @@ check [ __MTU__ = 65520 ] test DHCPv6: address ns /sbin/dhclient -6 --no-pid __IFNAME__ +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' -hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global").local' +hout HOST_ADDR6 ip -j -6 addr show|jq -rM '.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope == "global").local' check [ __ADDR6__ = __HOST_ADDR6__ ] test DHCPv6: route |