Skip to content

Io.net.Ip6Address.format should canonically format the Well-Known Prefix #25897

@blblack

Description

@blblack

Zig Version

0.16.0-dev.1301+cbfa87cbe

Steps to Reproduce and Observed Behavior

The recommended canonical text representation of IPv6 addresses is currently defined in RFC 5952.

Section 5 deals with when a formatter should output the final 4 bytes in :IPv4 form. The language there predates both the publication of some newer related RFCs and the deprecation of some older ones, but the most-reasonable interpretation in present times (IMHO) is that a generic IPv6 address text-formatting function with no special knowledge should canonically emit the :IPv4 form in exactly two cases:

  • IPv4 Mapped - ::ffff/96 (the current fomatter already does this)
  • The "Well-Known Prefix" - 64:ff9b::/96 - This is defined in RFC 6052, which an the RFC that didn't quite exist yet when 5952 was published, but 5952 Section 5's first sentence is referencing an early draft of RFC 6052 when it says and IPv4-translatable addresses [ADDR-FORMAT].

All other known fixed-prefix cases are, AFAIK, deprecated and/or historical and don't warrant :IPv4 formatting in a generic formatter.

Expected Behavior

That an IPv6 address with bytes like 64:ff9b::c000:201 should canonical format as 64:ff9b::192.0.2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions