mgorny created this revision. mgorny added reviewers: tamird, vitalybuka. Herald added a subscriber: dberris. mgorny requested review of this revision.
Fix passing the port and IP address with the wrong endianness in get_sock_peer_name() that causes the connect() to fail inside without an outgoing network interface (it's trying to connect to 1.0.0.127 instead of 127.0.0.1). https://reviews.llvm.org/D119461 Files: compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp Index: compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp =================================================================== --- compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp +++ compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp @@ -17,10 +17,10 @@ const sockaddr_in sin = { .sin_family = AF_INET, - .sin_port = 1234, + .sin_port = htons(1234), .sin_addr = { - .s_addr = INADDR_LOOPBACK, + .s_addr = htonl(INADDR_LOOPBACK), }, }; assert(connect(fd, reinterpret_cast<const sockaddr *>(&sin), sizeof(sin)) ==
Index: compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp =================================================================== --- compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp +++ compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp @@ -17,10 +17,10 @@ const sockaddr_in sin = { .sin_family = AF_INET, - .sin_port = 1234, + .sin_port = htons(1234), .sin_addr = { - .s_addr = INADDR_LOOPBACK, + .s_addr = htonl(INADDR_LOOPBACK), }, }; assert(connect(fd, reinterpret_cast<const sockaddr *>(&sin), sizeof(sin)) ==
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits