diff options
author | Greg Clayton <gclayton@apple.com> | 2014-01-10 00:31:10 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-01-10 00:31:10 +0000 |
commit | 99e384c85f2581bfb1ca6510bbeb3edd0d1b3d5b (patch) | |
tree | a2f8dcbbbc888bf67041c264700fbf3ab147d8b4 /lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp | |
parent | 85dac69ba114f0e8d38d5c5eac31ae5e94f01a0a (diff) | |
download | bcm5719-llvm-99e384c85f2581bfb1ca6510bbeb3edd0d1b3d5b.tar.gz bcm5719-llvm-99e384c85f2581bfb1ca6510bbeb3edd0d1b3d5b.zip |
Fixed an issue with the byte order of ports in KDP packets.
I previously fixed a bug in the SocketAddress class where SocketAddress::GetPort() wasn't using ntohs() on the port number in the structures.
After fixing this, it broke places where we weren't using ntohs() and htons() correctly.
<rdar://problem/15767514>
llvm-svn: 198902
Diffstat (limited to 'lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index 5f919405498..d10da0338c9 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -409,8 +409,8 @@ CommunicationKDP::SendRequestConnect (uint16_t reply_port, MakeRequestPacketHeader (command, request_packet, command_length); // Always send connect ports as little endian request_packet.SetByteOrder (eByteOrderLittle); - request_packet.PutHex16 (reply_port); - request_packet.PutHex16 (exc_port); + request_packet.PutHex16 (htons(reply_port)); + request_packet.PutHex16 (htons(exc_port)); request_packet.SetByteOrder (m_byte_order); request_packet.PutCString (greeting); DataExtractor reply_packet; @@ -438,7 +438,7 @@ CommunicationKDP::SendRequestReattach (uint16_t reply_port) MakeRequestPacketHeader (command, request_packet, command_length); // Always send connect ports as little endian request_packet.SetByteOrder (eByteOrderLittle); - request_packet.PutHex16(reply_port); + request_packet.PutHex16(htons(reply_port)); request_packet.SetByteOrder (m_byte_order); DataExtractor reply_packet; if (SendRequestAndGetReply (command, request_packet, reply_packet)) @@ -1035,8 +1035,8 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet) { case KDP_CONNECT: { - const uint16_t reply_port = packet.GetU16 (&offset); - const uint16_t exc_port = packet.GetU16 (&offset); + const uint16_t reply_port = ntohs(packet.GetU16 (&offset)); + const uint16_t exc_port = ntohs(packet.GetU16 (&offset)); s.Printf(" (reply_port = %u, exc_port = %u, greeting = \"%s\")", reply_port, exc_port, packet.GetCStr(&offset)); } break; @@ -1214,7 +1214,7 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet) case KDP_REATTACH: { - const uint16_t reply_port = packet.GetU16 (&offset); + const uint16_t reply_port = ntohs(packet.GetU16 (&offset)); s.Printf(" (reply_port = %u)", reply_port); } break; |