by pixl97 · 11y ago · 0 comments
Yup. It is simply amazing how many things I see devs push out that hard code badness (such as php ip2long, as an example). Intrusion detection that only will correctly resolve and send IPv4 to automatic firewall rules. Interfaces that truncate IPv6 addresses so information is lost. Who knows how many security problems are potentially added by this code that expects one thing and can get something else.
Huh? That's what abstractions like sockaddr_storage are for. Who cares how the address maps to the underlying CPU word size?
It's the same reason you shouldn't be storing pointers in ints. Portability requires effort. That's just life.
But I do see the advantage of big addresses. They give you room for meaningful cryptographic semantic information and stateless auto configuration, both of which are very valuable in big distributed systems and for security.
So yeah, could have been simpler but not a big deal. Things like struct sockaddr_storage make programming it pretty easy too, but most older devs aren't familiar with them.
And you'd still have to rewrite all software to take advantage of it.
Everyone who thinks they could've come up with a better solution seems to conveniently forget that no solution would've both extended the address space while providing free backward compatibility with v4. Those are, quite literally, incompatible goals.
Any hacky solution you do come up with (like, say, NAT64) applies to IPv6, as well.
Meanwhile, IPv6 goes on to address a whole host of other issues, like the mess that is CIDR, simplified autoconfiguration, built in address randomization/privacy extensions, etc.
Look, if by the 50's somebody make some calculations and said "if we don't change our ways, we'll be out of X by 2030", and X runs out in 2030, this person will be perfectly on time, not late by 80 years.