PcapSockAddr.toString() should use standard IPv6
A java PCAP and DPI library
Brought to you by:
voytechs
PcapSockAddr formats IPv6 addresses by showing the first 4 bytes as regular bytes (positive or negative integers). Instead, the standard IPv6 format (eight groups of four hexadecimal digits separated by colons) should be used.
For example, if the data attribute of the PcapSockAddr was (I know you can't actually set the data field manually):
data = new byte[] {-4, -38, 0, 0, 0, 0, 0, 0, -67, -112, -121, 91, 26, -26, -120, 16};
Then toString() would return:
[INET6: -4.-38.0.0]
But, to use standard IPv6 format (and to show all bytes), it should return (e.g., using java.net.InetAddress.getByAddress(data).toString()):
fcda:0:0:0:bd90:875b:1ae6:8810
Changed the PcapSockAddr.toString() to rely on FormatUtils.ip(byte[]) method for ip address conversion. This was a very legacy implementation that just never was updated before.
Fixed in 1.4.r1415