diff options
author | Andrei Vagin <avagin@google.com> | 2020-11-09 13:55:28 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-09 13:57:51 -0800 |
commit | 2fcca60a7bf084a28e878941d9dcb47e11268cbd (patch) | |
tree | 8a19c7739341a3bc894cae933c5534052fd4552e /pkg/tcpip/stack | |
parent | c59bdd18d521ebb3c8dedf03a6adfa56dd6245c7 (diff) |
net: connect to the ipv4 localhost returns ENETUNREACH if the address isn't set
cl/340002915 modified the code to return EADDRNOTAVAIL if connect
is called for a localhost address which isn't set.
But actually, Linux returns EADDRNOTAVAIL for ipv6 addresses and ENETUNREACH
for ipv4 addresses.
Updates #4735
PiperOrigin-RevId: 341479129
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r-- | pkg/tcpip/stack/stack.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go index a23fb97ff..0fe157128 100644 --- a/pkg/tcpip/stack/stack.go +++ b/pkg/tcpip/stack/stack.go @@ -1418,7 +1418,7 @@ func (s *Stack) FindRoute(id tcpip.NICID, localAddr, remoteAddr tcpip.Address, n if needRoute { return Route{}, tcpip.ErrNoRoute } - if isLoopback { + if header.IsV6LoopbackAddress(remoteAddr) { return Route{}, tcpip.ErrBadLocalAddress } return Route{}, tcpip.ErrNetworkUnreachable |