Device's IPv6 Addresses

Apr 15, 2012 at 10:56 PM

When printing all addresses of LivePacketDevice.AllLocalMachine I've noticed that the IPv6 address is displayed as:


where is should be:


I think the problem might be in the following function:


IpV6SocketAddress::IpV6SocketAddress(sockaddr *address)
: SocketAddress(address->sa_family)
	sockaddr_in6* ipV6Address = (struct sockaddr_in6 *)address;
	unsigned long *value = reinterpret_cast<unsigned long *>(ipV6Address->sin6_addr.u.Byte);
	_address = IpV6Address(UInt128(*value, *(value+1)));


where UInt128's constructor expects 2 parameters of 64-bit length, but in fact receives 2 parameters of 32-bit length which are implicitly casted to c# ulong.

When looking at ipV6Address variable it seems it holds the correct value.

Apr 16, 2012 at 8:23 PM

Hi Crema,


Thanks for catching this!

I've fixed it in ChangeSet 66797.

The fix will be incorporated in the next version of Pcap.Net.

If you don't want to wait for it, you can download the latest sources and follow the Pcap.Net developer's guide to build it.