[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Regular Expression for IPv6 addresses
On Wed, 10 Feb 2010 09:12:11 +1100, Mark Andrews said:
> In message <alpine.DEB.1.10.1002091548170.25663 at red.crap.retrofitta.se>, Thomas
> Habets writes:
> > On Fri, 5 Feb 2010, Mark Andrews wrote:
> > > And now for the trick question. Is ::ffff:077.077.077.077 a legal
> > > mapped address and if it, does it match 077.077.077.077?
> >
> > Forget IPv6. The first question is does 077.077.077.077 match
> > 077.077.077.077 in IPv4?
>
> I think you meant "does 077.077.077.077 match 77.77.77.77 in IPv4".
No, he had it right, because...
> > The answer is a long one full of different answers depending on
> > who's doing the parsing (gethostbyname(), inet_aton(),
> > inet_net_pton(), etc..) and on what OS. And also on many bugs.
>
> Indeed. It's a minefield out there for application developers that
> want consistancy. Even when you develop your own some OS vendor will
> go and stuff it up on you.
There's no guarantee that 2 different binaries on the same box will resolve
077.077.077.077 to the same 32-bit sequence, so it's in fact possible that
it's not even equal to itself, much less 77.77.77.77.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://mailman.nanog.org/pipermail/nanog/attachments/20100209/94031fdd/attachment.bin>