[Lldb-commits] [PATCH] D31823: Update LLDB Host to support IPv6 over TCP

Chris Bieneman via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 10 11:52:41 PDT 2017


beanz created this revision.
Herald added a subscriber: emaste.

This patch adds IPv6 support to LLDB/Host's TCP socket implementation. Supporting IPv6 involved a few significant changes to the implementation of the socket layers, and I have performed some significant code cleanup along the way.

This patch changes the Socket constructors for all types of sockets to not create sockets until first use. This is required for IPv6 support because the socket type will vary based on the address you are connecting to. This also has the benefit of removing code that could have errors from the Socket subclass constructors (which seems like a win to me).

The patch also slightly changes the API and behaviors of the Listen/Accept pattern. Previously both Listen and Accept calls took an address specified as a string. Now only listen does. This change was made because the Listen call can result in opening more than one socket. In order to support listening for both IPv4 and IPv6 connections we need to open one AF_INET socket and one AF_INET6 socket. During the listen call we construct a map of file descriptors to addrin structures which represent the allowable incoming connection address. This map removes the need for taking an address into the Accept call.

This does have a change in functionality. Previously you could Listen for connections based on one address, and Accept connections from a different address. This is no longer supported. I could not find anywhere in LLDB where we actually used the APIs in that way. The new API does still support AnyAddr for allowing incoming connections from any address.

The Listen implementation is implemented using kqueue on FreeBSD and Darwin, WSAPoll on Windows and poll(2) everywhere else.


https://reviews.llvm.org/D31823

Files:
  include/lldb/Host/Socket.h
  include/lldb/Host/common/TCPSocket.h
  include/lldb/Host/common/UDPSocket.h
  include/lldb/Host/freebsd/Config.h
  include/lldb/Host/linux/AbstractSocket.h
  include/lldb/Host/macosx/Config.h
  include/lldb/Host/posix/DomainSocket.h
  source/Host/common/Socket.cpp
  source/Host/common/TCPSocket.cpp
  source/Host/common/UDPSocket.cpp
  source/Host/linux/AbstractSocket.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Host/posix/DomainSocket.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  tools/lldb-server/Acceptor.cpp
  unittests/Host/SocketTest.cpp
  unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31823.94551.patch
Type: text/x-patch
Size: 35317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170410/be9b71e3/attachment-0001.bin>


More information about the lldb-commits mailing list