News for hackers. Stuff that matters.
Re:There’s more than one way to write an IP address by majke on Tuesday July 09, 2019 @08:12AM (#20390981)
Parsing IPv6 also requires some thought! Consider 0000:0000:0001:0002:0000:0000:dead:beef

- 0000:0000:1:2::dead:beef

- ::1:2:0000:0000:dead:beef

- ::1:2:0:0:dead:beef

- ::1:2:0:0:222.173.190.239

- 0:0:1:2::222.173.190.239

Re:There’s more than one way to write an IP address by majke on Tuesday July 09, 2019 @10:03AM (#20391820)
Digging more about IPv6 representation:

- It's possible to stick "::" in many places

- It's possible to have :0000: before or after "::"

- leading zeros (:0001: is the same as :1:)

- "Text Representation of Special Addresses", so the ::192.168.0.1 representation

- hex uppercase vs hex lowercase

see https://tools.ietf.org/html/rfc5952

Re:There’s more than one way to write an IP address by kbirkeland on Tuesday July 09, 2019 @10:51AM (#20392324)
Also due to the ambiguity of ports also using a colon delimiter, the IPv6 address may be in brackets:

    [::1:2:0:0:dead:beef]:443
And link-local addresses are mandatory and scoped per interface, so they need a zone id supplied as either an integer or interface name:

    fe80::1:2:0:0:dead:beef%eth0
Re:There’s more than one way to write an IP address by Already__Taken on Tuesday July 09, 2019 @10:08AM (#20391873)
that rfc says upper/lower doesn't matter? Am I wrong?
Re:There’s more than one way to write an IP address by deathanatos on Tuesday July 09, 2019 @11:12AM (#20392543)
That's the point: because it doesn't matter it provides two representations for the same semantic thing.
Re:There’s more than one way to write an IP address by jolmg on Tuesday July 09, 2019 @12:03PM (#20393179)
Well, that's just like IPv4, then. They can still be canonicalized, if you need to compare them.
Re:There’s more than one way to write an IP address by thwarted on Tuesday July 09, 2019 @10:03PM (#20398604)
That's why there are library routines for this, inet_pton and inet_ntop. No one should need to parse these addresses themselves.