Skip to content

Commit

Permalink
Swap bytes for tcp port number (case 1165578)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnityAlex committed Aug 1, 2019
1 parent 0295d49 commit d8025cb
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,6 @@ class Win32IPGlobalProperties : IPGlobalProperties
public const int AF_INET = 2;
public const int AF_INET6 = 23;

// FIXME: it might be getting wrong table. I'm getting
// different results from .NET 2.0.
unsafe void FillTcpTable (out List<Win32_MIB_TCPROW> tab4, out List<Win32_MIB_TCP6ROW> tab6)
{
tab4 = new List<Win32_MIB_TCPROW> ();
Expand Down Expand Up @@ -651,16 +649,16 @@ class Win32_MIB_TCPROW
{
public TcpState State;
public uint LocalAddr;
public int LocalPort;
public uint LocalPort;
public uint RemoteAddr;
public int RemotePort;
public uint RemotePort;

public IPEndPoint LocalEndPoint {
get { return new IPEndPoint (LocalAddr, LocalPort); }
get { return new IPEndPoint (LocalAddr, ntohs((ushort)LocalPort)); }
}

public IPEndPoint RemoteEndPoint {
get { return new IPEndPoint (RemoteAddr, RemotePort); }
get { return new IPEndPoint (RemoteAddr, ntohs((ushort)RemotePort)); }
}

public TcpConnectionInformation TcpInfo {
Expand All @@ -674,17 +672,17 @@ class Win32_MIB_TCP6ROW
public TcpState State;
public Win32_IN6_ADDR LocalAddr;
public uint LocalScopeId;
public int LocalPort;
public uint LocalPort;
public Win32_IN6_ADDR RemoteAddr;
public uint RemoteScopeId;
public int RemotePort;
public uint RemotePort;

public IPEndPoint LocalEndPoint {
get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }
get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), ntohs((ushort)LocalPort)); }
}

public IPEndPoint RemoteEndPoint {
get { return new IPEndPoint (new IPAddress (RemoteAddr.Bytes, RemoteScopeId), RemotePort); }
get { return new IPEndPoint (new IPAddress (RemoteAddr.Bytes, RemoteScopeId), ntohs((ushort)RemotePort)); }
}

public TcpConnectionInformation TcpInfo {
Expand All @@ -708,10 +706,10 @@ class Win32_MIB_UDP6ROW
{
public Win32_IN6_ADDR LocalAddr;
public uint LocalScopeId;
public int LocalPort;
public uint LocalPort;

public IPEndPoint LocalEndPoint {
get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), LocalPort); }
get { return new IPEndPoint (new IPAddress (LocalAddr.Bytes, LocalScopeId), ntohs((ushort)LocalPort)); }
}
}
}
Expand Down

0 comments on commit d8025cb

Please sign in to comment.