Skip to content

Commit e774642

Browse files
andrurogerzcompnerd
authored andcommitted
explicitly map host name of * to 0.0.0.0 for compatibility
On Fedora 40, `getaddrinfo()` resolves host name * to 0.0.0.0. However, on Android it does not, which leads to a number of lldb tests failling when run against a ds2 server. This change makes explicitly remaps the name prior to calling `getaddrinfo()` to ensure the most compatibility. This change matches the behavior of lldb-server, which was added (back) in llvm/llvm-project@f57453a to address similar test failures.
1 parent bc2f990 commit e774642

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ static std::unique_ptr<Socket> CreateSocket(std::string const &arg,
179179
// to strip the square brackets around the host part.
180180
if (addrString[0] == '[' && addrString[splitPos - 1] == ']') {
181181
host = addrString.substr(1, splitPos - 2);
182+
} else if (splitPos == 1 && addrString[0] == '*') {
183+
// Allow caller to specify a host name of * to listen on all available
184+
// network interfaces. On some, but not all platforms, getaddrinfo()
185+
// resolves * to 0.0.0.0 already. Explicitly making this substitution
186+
// ensures the most compatibility.
187+
host = "0.0.0.0";
182188
} else {
183189
host = addrString.substr(0, splitPos);
184190
}

0 commit comments

Comments
 (0)