Menu

#128 PcapSockAddr.toString() should use standard IPv6

Version 1.3
closed-fixed
API Issue (77)
5
2013-08-19
2013-04-04
Monica
No

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

Discussion

  • Sly Technologies

    • status: open --> closed-fixed
     
  • Sly Technologies

    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

     

Log in to post a comment.

MongoDB Logo MongoDB