summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/RNBSocket.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-03-23 00:44:22 +0000
committerJason Molenda <jmolenda@apple.com>2013-03-23 00:44:22 +0000
commit45461571e77e7dd9c476dd4e40e24fdcfc63918b (patch)
treecdb5b1221beb74441dad7535454645304c16c4a0 /lldb/tools/debugserver/source/RNBSocket.cpp
parent130df4b0a42524854388520d9aa2cc210c1f0e7f (diff)
downloadbcm5719-llvm-45461571e77e7dd9c476dd4e40e24fdcfc63918b.tar.gz
bcm5719-llvm-45461571e77e7dd9c476dd4e40e24fdcfc63918b.zip
Change debugserver to open the socket it listens
to in INADDR_LOOPBACK mode by default ("localhost only") instead of INADDR_ANY ("accept connections from any system"). Add a new command line argument to debugserver, --open-connection or -H which will enable the previous behavior. It would be used if you were doing two-system debugging, with lldb running on one system and debugserver running on the other. But it is a less common workflow and should not be the default. <rdar://problem/12583284> llvm-svn: 177790
Diffstat (limited to 'lldb/tools/debugserver/source/RNBSocket.cpp')
-rw-r--r--lldb/tools/debugserver/source/RNBSocket.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lldb/tools/debugserver/source/RNBSocket.cpp b/lldb/tools/debugserver/source/RNBSocket.cpp
index e6c669c0ab1..495c890ed27 100644
--- a/lldb/tools/debugserver/source/RNBSocket.cpp
+++ b/lldb/tools/debugserver/source/RNBSocket.cpp
@@ -31,7 +31,7 @@
This function blocks while waiting for that connection. */
rnb_err_t
-RNBSocket::Listen (in_port_t port, PortBoundCallback callback, const void *callback_baton)
+RNBSocket::Listen (in_port_t port, PortBoundCallback callback, const void *callback_baton, bool localhost_only)
{
//DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s called", (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
// Disconnect without saving errno
@@ -56,7 +56,14 @@ RNBSocket::Listen (in_port_t port, PortBoundCallback callback, const void *callb
sa.sin_len = sizeof sa;
sa.sin_family = AF_INET;
sa.sin_port = htons (port);
- sa.sin_addr.s_addr = htonl (INADDR_ANY);
+ if (localhost_only)
+ {
+ sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ }
+ else
+ {
+ sa.sin_addr.s_addr = htonl (INADDR_ANY);
+ }
int error = ::bind (listen_fd, (struct sockaddr *) &sa, sizeof(sa));
if (error == -1)
OpenPOWER on IntegriCloud