RFC 5954

Essential Correction for IPv6 ABNF and URI Comparison in RFC 3261

πŸ“… published August 2010, from ietf

RFC 5954: Essential Correction for IPv6 ABNF and URI Comparison in RFC 3261 πŸŽ€

Okay bestie, this one is from the IETF (Internet Engineering Task Force) and it's giving fix-it doc energy πŸ’…. The editors are V. Gurbani (Ed.) from Bell Laboratories, Alcatel-Lucent, B. Carpenter (Ed.) from Univ. of Auckland, and B. Tate (Ed.) from BroadSoft. It's a Standards Track document with ISSN 2070-1721, dated August 2010. It updates RFC 3261 πŸ¦‹, and the header doesn't list anything it obsoletes.


Abstract 🌸

So this doc fixes the ABNF (Augmented Backus-Naur Form) rule that makes IPv6 literals in RFC 3261. It also explains how URIs should get compared when they contain text versions of IP addresses πŸ”₯.

Status of This Memo ✨

This is an Internet Standards Track document.

This document is a product of the Internet Engineering Task Force (IETF) πŸ’–. It represents the consensus of the IETF community. It went through public review and got approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check Section 2 of RFC 5741.

For the current status of this document, any errata, and how to give feedback, go to http://www.rfc-editor.org/info/rfc5954 🧚.

Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they were in effect on the date this document was published. Please read these carefully, because they explain your rights and restrictions for this document. Code Components pulled out of this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as described in the Simplified BSD License 🫢.

Table of Contents πŸ“š

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . 2
   3.  Problem Statement . . . . . . . . . . . . . . . . . . . . . . . 2
     3.1.  Extra Colon in IPv4-Mapped IPv6 Address . . . . . . . . . . 2
     3.2.  Comparing URIs with Textual Representation of IP
           Addresses . . . . . . . . . . . . . . . . . . . . . . . . . 3
   4.  Resolution  . . . . . . . . . . . . . . . . . . . . . . . . . . 4
     4.1.  Resolution for Extra Colon in IPv4-Mapped IPv6 Address  . . 4
     4.2.  Clarification for Comparison of URIs with Textual
           Representation of IP Addresses  . . . . . . . . . . . . . . 5
   5.  Generating a Canonical IPv6 Textual Representation  . . . . . . 5
   6.  Security Considerations . . . . . . . . . . . . . . . . . . . . 6
   7.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 6
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . . . 6
     8.1.  Normative References  . . . . . . . . . . . . . . . . . . . 6
     8.2.  Informative References  . . . . . . . . . . . . . . . . . . 6

1. Introduction ✨

This doc corrects the ABNF (Augmented Backus-Naur Form) production rule that's supposed to generate IPv6 literals in RFC 3261 [1] πŸŽ€. It also clarifies the rule for URI (Uniform Resource Identifier) comparison when the URIs contain a textual representation of IP addresses. Literally the two things that were messing people up.

2. Terminology πŸ’…

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [2] πŸ¦‹.

3. Problem Statement 🌈

3.1. Extra Colon in IPv4-Mapped IPv6 Address πŸ’–

Okay so the ABNF [4] for generating IPv6 literals in RFC 3261 [1] is incorrect 😭. When you generate IPv4-mapped IPv6 addresses, the production rule can actually spit out this construct:

[2001:db8:::192.0.2.1]
  • Note the extra colon before the IPv4 address. πŸ™ˆ

The correct construct, of course, would only have two colons before the IPv4 address ✨.

Historically, the ABNF about IPv6 references in RFC 3261 was derived from Appendix B of RFC 2373 [7], which was flawed to begin with (see errata for RFC 2373 [8]). RFC 2373 has since been obsoleted by RFC 4291 [6]. Messy history, but we're cleaning it up 🧹.

The ABNF for IPv6reference, copied from RFC 3261, looks like this:

     IPv6reference  =  "[" IPv6address "]"
     IPv6address    =  hexpart [ ":" IPv4address ]
     IPv4address    =  1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
     hexpart        =  hexseq / hexseq "::" [ hexseq ] / "::" [ hexseq ]
     hexseq         =  hex4 *( ":" hex4)
     hex4           =  1*4HEXDIG

The ambiguity lives in the <IPv6address> production rule, where the <IPv4address> non-terminal gets prefixed by the ":" token πŸ‘€. And since two of the alternatives in the <hexpart> production rule already include the "::" token, expanding those alternatives can yield a faulty construction of an IPv6-mapped IPv4 address with an extra colon. Not it πŸ’€.

3.2. Comparing URIs with Textual Representation of IP Addresses πŸ“

In SIP, URIs get compared for all kinds of reasons. Registrars compare URIs when they receive a binding update request, for instance 🧚. Section 19.1.4 of RFC 3261 [1] gives the rules for comparing URIs, and among other rules, it says:

For two URIs to be equal, the user, password, host, and port components must match.

So does that rule then mean these URIs are equal? πŸ€”

      sip:bob@[::ffff:192.0.2.128] = sip:bob@[::ffff:c000:280]?

      sip:bob@[2001:db8::9:1] = sip:bob@[2001:db8::9:01]?

      sip:bob@[0:0:0:0:0:FFFF:129.144.52.38] = sip:bob@
      [::FFFF:129.144.52.38]?

In all of those examples, the textual representation of the IPv6 address is different, but the addresses are binary equivalents πŸ’œ (implementers are also urged to check Section 5 of this document for recommendations on IPv6 address text representations). Section 19.1.4 of RFC 3261 doesn't have any rule for URIs with different textual representations of IPv6 addresses that all match the same binary equivalent, so that's the gap we're filling 🌸.

Note that the same ambiguity happens for IPv4 addresses, i.e., is 192.0.2.128 = 192.00.02.128? However, IPv6, with its compressed notation and the need to represent hybrid addresses (like IPv4-mapped IPv6 addresses), makes the representation issue way more acute 😩. The resolution discussed in Section 4.2 applies to textual representations of both IPv6 and IPv4 addresses.

8.2. Informative References πŸ¦‹

okay so these are the bonus reads, the ones that aren't required to understand the spec but are still super useful πŸ’…

  • [6] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, February 2006. πŸ’œ
  • [7] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 2373, July 1998. 🌸 this is the older version, and yes they have the same title, so iykyk πŸ™ˆ
  • [8] "RFC Editor Errata", <http://www.rfc-editor.org/errata.php>. πŸ”₯ the list of known mistakes that got fixed later, so check it before you trust anything too hard

Authors' Addresses πŸŽ€

three editors slid in here, and honestly they're the ones who made this whole thing happen 🫢

   Vijay K. Gurbani (editor)
   Bell Laboratories, Alcatel-Lucent
   1960 Lucent Lane
   Room 9C-533
   Naperville, IL  60563
   USA

   Phone:  +1 630 224-0216
   EMail:  vkg@bell-labs.com


   Brian E. Carpenter (editor)
   Department of Computer Science
   University of Auckland
   PB 92019
   Auckland,   1142
   New Zealand

   EMail:  brian.e.carpenter@gmail.com


   Brett Tate (editor)
   BroadSoft

   EMail:  brett@broadsoft.com
πŸ“¦ where this page comes from