https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ec92100bcaaf01fe3d82…
commit 0ec92100bcaaf01fe3d824eeae20835c75d16e59
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Nov 24 22:25:32 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Nov 24 22:26:06 2018 +0100
[TCPIP] Properly display local information for established connections
---
drivers/network/tcpip/tcpip/ninfo.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/network/tcpip/tcpip/ninfo.c b/drivers/network/tcpip/tcpip/ninfo.c
index 06eddd4baf..74d5b86266 100644
--- a/drivers/network/tcpip/tcpip/ninfo.c
+++ b/drivers/network/tcpip/tcpip/ninfo.c
@@ -190,8 +190,6 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
- TcpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
- TcpRow.dwLocalPort = AddrFile->Port;
TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
if (Extended)
{
@@ -209,6 +207,8 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
EndPoint = AddrFile->Listener->AddressFile;
TcpRow.dwState = MIB_TCP_STATE_LISTEN;
+ TcpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
+ TcpRow.dwLocalPort = AddrFile->Port;
TcpRow.dwRemoteAddr = EndPoint->Address.Address.IPv4Address;
TcpRow.dwRemotePort = EndPoint->Port;
}
@@ -217,17 +217,26 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE
AddrFile,
{
TA_IP_ADDRESS EndPoint;
- Status = TCPGetSockAddress(AddrFile->Connection,
(PTRANSPORT_ADDRESS)&EndPoint, TRUE);
+ Status = TCPGetSockAddress(AddrFile->Connection,
(PTRANSPORT_ADDRESS)&EndPoint, FALSE);
if (NT_SUCCESS(Status))
{
ASSERT(EndPoint.TAAddressCount >= 1);
ASSERT(EndPoint.Address[0].AddressLength == TDI_ADDRESS_LENGTH_IP);
- TcpRow.dwRemoteAddr = EndPoint.Address[0].Address[0].in_addr;
- TcpRow.dwRemotePort = ntohs(EndPoint.Address[0].Address[0].sin_port);
+ TcpRow.dwLocalAddr = EndPoint.Address[0].Address[0].in_addr;
+ TcpRow.dwLocalPort = ntohs(EndPoint.Address[0].Address[0].sin_port);
+
+ Status = TCPGetSockAddress(AddrFile->Connection,
(PTRANSPORT_ADDRESS)&EndPoint, TRUE);
+ if (NT_SUCCESS(Status))
+ {
+ ASSERT(EndPoint.TAAddressCount >= 1);
+ ASSERT(EndPoint.Address[0].AddressLength == TDI_ADDRESS_LENGTH_IP);
+ TcpRow.dwRemoteAddr = EndPoint.Address[0].Address[0].in_addr;
+ TcpRow.dwRemotePort = ntohs(EndPoint.Address[0].Address[0].sin_port);
+
+ Status = TCPGetSocketStatus(AddrFile->Connection,
&TcpRow.dwState);
+ ASSERT(NT_SUCCESS(Status));
+ }
}
-
- Status = TCPGetSocketStatus(AddrFile->Connection, &TcpRow.dwState);
- ASSERT(NT_SUCCESS(Status));
}
else
{