kmualem
kmualem

Reputation: 135

IPV6 validation issue

I'm working on IPV6 validation both server (java) and client (javascript) side and i have Incompatibility issue with the following IPs:

  1. 02001:0000:1234:0000:0000:C1C0:ABCD:0876
  2. 2001:0000:1234:0000:00001:C1C0:ABCD:0876

both of them have an extra zero and looks invalid to me.

My javascript validation (based on http://www.intermapper.com/support/tools/IPV6-Validator.aspx) return invalid but my server side says it's a valid IP.

In the server side, I'm checking 2 options:
1. java.net.InetAddress.getByName("");
2. com.google.common.net.InetAddresses.isInetAddress("");

Can you please advise?

Thanks!

Upvotes: 0

Views: 211

Answers (1)

Michael Hampton
Michael Hampton

Reputation: 9980

RFC 4291 describes the textual representation of IPv6 addresses.

It specifies that each of the fields is "one to four hexadecimal digits" (section 2.2). This is in line with the fact that the IPv6 address is a 128-bit binary value (RFC 3587); thus any extra digits would cause the value to be more than 128 bits and therefore invalid..

Whatever tool you are using that said these addresses are valid, it is broken.

Upvotes: 2

Related Questions