TUN-6011: Remove docker networks from ICMP Proxy test

This commit is contained in:
João "Pisco" Fernandes 2023-06-26 12:33:43 +01:00 committed by Jean Khawand
parent b0ce64a1c6
commit a929dcca45
1 changed files with 4 additions and 3 deletions

View File

@ -390,15 +390,16 @@ func getLocalIPs(t *testing.T, ipv4 bool) []netip.Addr {
require.NoError(t, err) require.NoError(t, err)
localIPs := []netip.Addr{} localIPs := []netip.Addr{}
for _, i := range interfaces { for _, i := range interfaces {
// Skip TUN devices // Skip TUN devices, and Docker Networks
if strings.Contains(i.Name, "tun") { if strings.Contains(i.Name, "tun") || strings.Contains(i.Name, "docker") || strings.HasPrefix(i.Name, "br-") {
continue continue
} }
addrs, err := i.Addrs() addrs, err := i.Addrs()
require.NoError(t, err) require.NoError(t, err)
for _, addr := range addrs { for _, addr := range addrs {
if ipnet, ok := addr.(*net.IPNet); ok && (ipnet.IP.IsPrivate() || ipnet.IP.IsLoopback()) { if ipnet, ok := addr.(*net.IPNet); ok && (ipnet.IP.IsPrivate() || ipnet.IP.IsLoopback()) {
if (ipv4 && ipnet.IP.To4() != nil) || (!ipv4 && ipnet.IP.To4() == nil) { // TODO DEVTOOLS-12514: We only run the IPv6 against the loopback interface due to issues on the CI runners.
if (ipv4 && ipnet.IP.To4() != nil) || (!ipv4 && ipnet.IP.To4() == nil && ipnet.IP.IsLoopback()) {
localIPs = append(localIPs, netip.MustParseAddr(ipnet.IP.String())) localIPs = append(localIPs, netip.MustParseAddr(ipnet.IP.String()))
} }
} }