summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/tcpip/stack/stack.go2
-rw-r--r--test/syscalls/linux/socket_ip_unbound_netlink.cc2
2 files changed, 2 insertions, 2 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
diff --git a/test/syscalls/linux/socket_ip_unbound_netlink.cc b/test/syscalls/linux/socket_ip_unbound_netlink.cc
index 6036bfcaf..7fb1c0faf 100644
--- a/test/syscalls/linux/socket_ip_unbound_netlink.cc
+++ b/test/syscalls/linux/socket_ip_unbound_netlink.cc
@@ -92,7 +92,7 @@ TEST_P(IPv4UnboundSocketTest, ConnectToBadLocalAddress_NoRandomSave) {
auto sock = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
EXPECT_THAT(connect(sock->get(), reinterpret_cast<sockaddr*>(&addr.addr),
addr.addr_len),
- SyscallFailsWithErrno(EADDRNOTAVAIL));
+ SyscallFailsWithErrno(ENETUNREACH));
}
INSTANTIATE_TEST_SUITE_P(IPUnboundSockets, IPv4UnboundSocketTest,