• Taldan
    link
    fedilink
    English
    arrow-up
    8
    ·
    4 days ago

    No, this has been a part of IPv4 for a very long time. The behavior is defined here. There are also differences in how the collapse white space, primarily in that IPv6 can collapse multiple zero sections

    While many systems support these funky IPv4 address formats, not all do. It’s a bit of a quirk in that intimate knowledge of IPv4 addressing has largely been lost. If you search for validating IPv4 addresses on StackOverflow, most answers will simplistically check for 4 octets between 0 and 255

    The only place I’ve seen these IPv4 address formats be relevant in the last 10 years is in security. If you’re using a block list to block specific IP addresses (which is pretty dumb to do these days), you have to account for someone sending a request with their IP address in hex, octal, or shortened formats. If you block 127.69.69.69 (yes, I know that’s a loopback), and are getting a request from 2135246149, will your block list recognize it as a blocked address? Many won’t, but that’s something you have to engineer for from a security perspective

    • partial_accumen
      link
      fedilink
      English
      arrow-up
      3
      ·
      4 days ago

      No, this has been a part of IPv4 for a very long time. The behavior is defined here. There are also differences in how the collapse white space, primarily in that IPv6 can collapse multiple zero sections

      " a.b When a two-part address is supplied, the last part shall be interpreted as a 24-bit quantity and placed in the rightmost three bytes of the network address. This makes the two-part address format convenient for specifying Class A network addresses as “net.host”."

      You’re right. I’d never seen that usage before, but its in the man page.

    • Laser@feddit.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 days ago

      There are also differences in how the collapse white space, primarily in that IPv6 can collapse multiple zero sections

      What do you mean by that? The example did collapse multiple zero sections for IPv4 as well (127.69), and IPv6 can also only collapse one block, namely the longest one, otherwise it’d be ambiguous as to how to pad each. Or am I misunderstanding?

      • Taldan
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        4 days ago

        In IPv4, there is no way to indicate which octet is being skipped. Think of the address 127.0.69.69, which we’ll use the equivalent of 1270:0000:0000:0000:0000:0000:0000:6969:6969 in IPv6 (yes, I realize that address space doesn’t make sense. It’s just for illustration)

        In IPv4, you cannot shorten 127.0.69.69 to 127.69.69. The assumption with 3 octets is that the last two have been merged into one. 127.69.69 would be equivalent to 127.69.0.69

        In IPv6, this ambiguity is removed. Double colons are used to indicate missing zeros. 1270::6969:6969 is equivalent to the above IPv6 address. Double colon simply pads out the address at that point until it is the correct length. I seem to recall some other interesting features of it, but I don’t use IPv6 enough to remember them exactly

        Ninja edit: There is also a bit of weirdness in IPv4 because it’s not technically white space expansion as (I think) it is in IPv6. It’s just putting multiple bytes into a single octet. That’s why 127.257 or 127.0.257 would both resolve to 127.0.1.1

      • partial_accumen
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 days ago

        The example did collapse multiple zero sections for IPv4 as well (127.69), and IPv6 can also only collapse one block, namely the longest one,

        The IPv4 example collapsed two “blocks”, “.000.000.”, or rather octets, and could do so because they were next to one another, which looks to behave the same way IPv6 does. In IPv6 the largest number of all zero hextets can be removed and replaced with double colons. So multiple hextets ( .0000) can be removed in shortening as long as they are next to one another in the IP address.