Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap bytes for tcp port number (case 1165578) #1212

Merged
merged 1 commit into from
Aug 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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