[Lldb-commits] [PATCH] D133393: [test] Use localhost in place of 127.0.0.1 to run in ipv6-only environments.

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 7 16:58:13 PDT 2022


rupprecht added a comment.

In D133393#3773793 <https://reviews.llvm.org/D133393#3773793>, @labath wrote:

> I believe the reasons are still relevant. Basically the problem is that listening on `localhost:x` creates two sockets (one for 127.0.0.1, one for ::1), and there's no way to guarantee that we'll be able to grab the same port for both (one could be taken by some other application). Our listening code will succeed if it opens at least one socket, but then if we again try to connect using the `localhost` name, we may end up connecting to the wrong thing. I think the correct fix is to take the address (ip+port) that we've *actually* started listening on, and then pass *that* as the argument to the connect command, but I'm not sure if our current Socket APIs allow you to get that information.

There's `listen_socket.GetLocalIPAddress()`, but that returns an empty string here.

Anyway, I just changed to use the `HostSupportsIPv4()/HostSupportsIPv6()` helper methods and pick an appropriate scheme. PTAL.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133393/new/

https://reviews.llvm.org/D133393



More information about the lldb-commits mailing list