From 06abfcf6d95762976d37aa5721c16802c649efd4 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 22 Jul 2022 15:31:13 +1000 Subject: 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 --- test/dhcp/passt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/dhcp/passt') 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 -- cgit v1.2.3