Hacker News new | ask | show | jobs
by edoceo 7 days ago
Maybe the crazy part is also what is a valid IPv6 string. Amd for safety mostly-never pass anything to the shell.
1 comments

IPv6 addresses are annoyingly complex. This isn't reason why because the shell-passing thing is a bad idea anyway, but it illustrates this.
Outside of interface identifiers, what is so complex about them? I think they end up being purely simpler than IPv4 addresses since they can’t be mistaken for DNS names.
Multiple official ways to format them, the :: stuff, more kinds of addresses that actually come up commonly (ULA, LL, privacy, etc)
Beyond the :: stuff, I can only think of IPv4-mapped IPv6 addresses, where you can represent a trailing 32 bits as dotted decimal (e.g. 2001:db8::192.0.2.1). And the :: stuff also exists in IPv4 in the same way, just using dots instead of colons.

ULA is equivalent to RFC1918.

LL also exists in IPv4 (PIPA), but I take your point that it's not common in most environments.

Yes, privacy addressing is different.

But, the context that you were commenting in was about the representation of addresses, not the semantics themselves ("what is a valid IPv6 string"). And there doesn't seem to be any greater complexity other than the IPv4-mapped IPv6 addresses thing. Which doesn't seem all that complex, especially if you see it as a tradeoff to escape the DNS name ambiguity of IPv4.

But they could be mingled with port numbers
No, because in a context where you'd have a port number, the address is surrounded with brackets: [2001:db8::]:80