luizpapa / cassia

Automatically exported from code.google.com/p/cassia
0 stars 0 forks source link

IPv6 support #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ITerminalServicesSession.ClientIPAddress should be able to return an IPAddress 
when the underlying WinAPI function returns an IPv6 address.

Given that the IN6_ADDR structure via 
http://msdn.microsoft.com/en-us/library/ff554787%28v=VS.85%29.aspx is just a 
16-byte array, you can see that it's a simple modification. I believe this code 
would be sufficient to support this scenario and it works in my limited test 
case. (source: Impl\TerminalServicesSession.cs, function GetClientIPAddress, 
where the TODO comment is for this issue)

if (addressFamily == AddressFamily.InterNetwork)
{
   byte[] address = new byte[4];
   Array.Copy(clientAddress.Address, 2, address, 0, 4);
   return new IPAddress(address);
} else if(addressFamily == AddressFamily.InterNetworkV6) {
   byte[] address = new byte[16];
   Array.Copy(clientAddress.Address, 2, address, 0, 16);
   return new IPAddress(address);
}

Original issue reported on code.google.com by dan.libe...@gmail.com on 20 Dec 2010 at 11:47

GoogleCodeExporter commented 8 years ago
Dan,

You're right that this would be a pretty simple modification -- the only other 
place that would need to be changed would be 
NativeMethodsHelper.QuerySessionInformationForEndPoint (admittedly not very 
DRY). The only reason I hadn't done it is that I hadn't set up IPv6 on a 
network yet for testing (see issue 17). But if it works for you, I'll apply the 
patch.

Original comment by danports on 21 Dec 2010 at 1:48

GoogleCodeExporter commented 8 years ago
I committed a fix for this in r111. Can you download the latest build from the 
build server 
(http://teamcity.codebetter.com/viewLog.html?buildId=25024&tab=artifacts&buildTy
peId=bt95 -- login as a guest) and verify that 
ITerminalServicesSession.ClientIPAddress and 
ITerminalServicesSession.RemoteEndPoint report the correct IPv6 results in your 
environment? Thanks.

Original comment by danports on 26 Apr 2011 at 10:56

GoogleCodeExporter commented 8 years ago
Issue 17 has been merged into this issue.

Original comment by danports on 15 Feb 2012 at 4:34