On Mon, Oct 21, 2024 at 10:53 AM John Levine <[email protected]> wrote:
> No kidding, and there's been some really funky IPv4 address parsers over > the > years. Some of them treat a leading zero to mean an octal number, some > allow a > single large integer, and there are a lot of different ideas about where > to put > the implicit zeros in an address like 1.2 or 1.2.3. I propose we deal with > none > of those and let sleeping dogs lie. > You're referring to the variety of syntaxes that inet_addr() accepts in the C library. I had thought that was the standard, but after I asked in a public venue loaded with people who have been doing this stuff way longer than me, I discovered that there isn't a standard. The only standard is that the internal representation is a network-byte-order 32-bit quantity. Everything else is by convention. Even the RFCs disagree; there are some older RFCs that use leading zeros -- which inet_addr() would interpret as octal -- but they include 008.001.002.003, for example, which obviously would fail to parse. So since there isn't a standard, calling it a string seems like the closest we can get, at least for IPv4. For v6, there might be an ABNF grammar available to cite or reference. -MSK
_______________________________________________ dmarc mailing list -- [email protected] To unsubscribe send an email to [email protected]
