<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!-- Required for schema validation and schema-aware editing -->
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<!-- If further character entities are required then they should be added to the DOCTYPE above.
     Use of an external entity file is not recommended. -->

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="draft-equinox-intarea-icmpext-xlat-source-01"
  ipr="trust200902"
  obsoletes=""
  updates="7915"
  submissionType="IETF"
  consensus="true"
  xml:lang="en"
  version="3">
  <front>
    <title abbrev="icmpext-xlat-source">ICMP Extensions for IP/ICMP translators (XLATs)</title>
    <seriesInfo name="Internet-Draft" value="draft-equinox-intarea-icmpext-xlat-source-01"/>

    <author fullname="David 'equinox' Lamparter" initials="D" surname="Lamparter">
      <organization>NetDEF, Inc.</organization>
      <address>
        <postal>
          <city>San Jose</city>
          <country>USA</country>
        </postal>
        <email>equinox@diac24.net</email>
        <email>equinox@opensourcerouting.org</email>
      </address>
    </author>
    <author fullname="Jen Linkova" initials="J" surname="Linkova">
      <organization>Google</organization>
      <address>
        <postal>
          <street>1 Darling Island Rd</street>
          <city>Pyrmont</city>
          <region>NSW</region>
          <code>2009</code>
          <country>AU</country>
        </postal>
        <email>furry13@gmail.com</email>
        <email>furry@google.com</email>
      </address>
    </author>

    <date year="2024"/>
    <area>Internet</area>
    <workgroup>Internet Area</workgroup>
    <keyword>ipv6</keyword>
    <keyword>ipv4</keyword>
    <keyword>clat</keyword>
    <keyword>traceroute</keyword>


    <abstract>
      <t>
          This document proposes allocating a dedicated IPv4 address for translating arbitrary (non-IPv4-translatable) IPv6 addresses
and suggests the creation of an ICMP Multi-part Extension
          to carry the original IPv6 source address of ICMPv6 messages
          translated to ICMP by stateless (RFC7915) or stateful (RFC 6146) protocol translators.
      </t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
          Source, version control history, and issue tracker for this draft can
          be found at <eref target="https://github.com/eqvinox/icmpext-clat-source"/>.
      </t>
      <t>
          (Note the draft was renamed (clat → xlat) prior to submission but
          changing the repository name on github breaks too many things to be
          worth the effort.)
      </t>
    </note>
  </front>

  <middle>
    <section>
      <name>Introduction</name>
      <t>
To allow communication between IPv6-only and IPv4-only devices, IPv4/IPv6 translators translate IPv6 and IPv4 packet headers according to the IP/ICMP Translation Algorithm defined in <xref target="RFC7915"/>.
For example, 464XLAT (<xref target="RFC6877"/>) defines an architecture for providing IPv4 connectivity across an IPv6-only network. The solution contains two key elements: provider-side translator (PLAT) and customer-side translator (CLAT). CLAT implementations translate private IPv4 addresses to global IPv6 addresses, and vice versa, as defined in <xref target="RFC7915"/>. 
</t>
<t>

To map IPv4 addresses to IPv6 ones the translators use the translation prefix (either a well-known or a network-specific one, see <xref target="RFC6052"/>). The resulting IPv6 addresses can be statelessly translated back to IPv4.
However it's not the case for an arbitrary global IPv6 addresses. Those addresses can only be translated to IPv4 by a stateful translators.
</t>
<t>
One of scenarios when it might be required but not currently possible is translating ICMPv6 error messages send by intermediate nodes to the CLAT address in the 464XLAT envinronment. The most typical example is a diagnistic tool like traceroute sending packets to an IPv4 destination from an IPv6-only host.
Received ICMPv6 Time Exceeded are translated to ICMP Time Exceeded. If those packets were originated from an IPv4 address and translated to ICMPv6 by the PLAT (NAT64) device, then the source address of such packet can be mapped back to IPv4 by removing the translation prefix. However ICMPv6 error messages sent by devices located between the IPv6-only host and the NAT64 device have "native" IPv6 source addresses, which can not be mapped back to IPv4.
Those packets are usually dropped and tools like traceroute can not represent IPv6 intermediate hops in any meaningful way. Such behaviour complicates troubleshooting. It's also confusing for users and increases operational costs, as users report packet loss in the network based on traceroute output.
</t>
      <t>
Some CLAT implementations are known to workaround this issue by representing IPv6 addresses in IPv4 traceroute by using a reserved IPv4 address space and using the hop limit as the last octet, so an IPv6 device 5 hops away is shown as 225.0.0.5 etc.
      </t>
<t>
It should be noted that the similar issue occurs in IPv6 Data Center Environments when an ICMPv6 error message needs to be sent to an IPv4-only client.
As per Section 4.8 of <xref target="RFC7755"/>, ICMPv6 error packets are usually dropped by the translator.
</t>
<t>
This document introduces a dedicated IPv4 address to translate arbitrary global IPv6 addresses in ICMPv6 error messages, and proposes an ICMP extension so original IPv6 address of an ICMPv6 error message can be included into IMCP message and therefore passed to an application.
</t>
    </section>

    <section>
      <name>Requirements Language</name>
      <t>
          The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.
       </t>
    </section>

    <section anchor="xlat">
      <name>Translation Behavior Overview</name>
      <t>
          Whenever a translator translates an ICMPv4 (<xref target="RFC0792"/>) packet from an ICMPv6 (<xref target="RFC4443"/>) one,
          and the IPv6 source address in the outermost IPv6 header does not match the NAT64
          prefix (and is therefore not mappable to an IPv4 address), the translator SHOULD:
</t>
<ul>
<li>
<t>
Append an extension object (<xref target="RFC4884"/>) described in this document to the ICMPv6 packet before translation.
</t>
</li>
<li>
<t>
Perform stateful translation of the IPv6 source address to 192.0.0.11.
</t>
</li>
</ul>
      <t>
          The translator SHOULD NOT use 192.0.0.11/32 to translate the source IPv6 address and SHOULD NOT add the extension if the packet IPv6 source address
is an IPv4 address mapped to an IPv6 address using the translation prefix known to the translator, of if the translator has a stateful entry for the given IPv6 address mapped to another IPv4 address.
      </t>
    </section>
<section anchor="ipv4">
<name>Dedicated IPv4 Address for Stateful Translation of Global IPv6 Addresses</name>
<t>
This document proposed allocating a dedicated IPv4 192.0.0.11/32 to use for statefully translating global IPv6 addresses in ICMPv6 error messages in scenarious, when the transator doesn't have any existing entry to use for translating such an address.
</t>
</section>

    <section anchor="ext">
      <name>IPv6 Original Source Extension Object Format</name>
      <t>
          The suggested encoding to be appended<xref target="RFC4884"/> to
          ICMP messages is as follows:
      </t>
      <figure align="center" anchor="fig_ext">
        <artwork align="center"><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Length = 20          |   Class TBD1  |  C-Type = 0   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                  original IPv6 source address                 |
+                          16 octets                            +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>
      <t>
          The Length, Class and C-Type fields are as defined in
          <xref target="RFC4884"/> and filled in accordingly.  This document
          describes only one encoding and uses C-Type 0 for it.  C-Type
          MUST be set to 0 when appending this extension.  On receipt,
          this extension MUST be ignored if C-Type is not 0 or if Length is
          not 20.
      </t>
      <t>
          The original IPv6 source address field is always 16 octets in length
          and filled as described in this document.  It may contain any source
          address possibly seen in an ICMPv6 packet.  This notably includes
          link-local addresses, the IPv6 loopback address, and mapped IPv4
          addresses.  Receivers MUST NOT reject addresses solely due to the
          address not being a globally scoped IPv6 addresses.
      </t>
    </section>

<section anchor="behave">
<name>Translation Behavior</name>

<section>
<name>Adding IPv6 Original Source Extension Object</name>
<t>
IPv6 Original Source Extension Object SHOULD be added when translating"
</t>
<ul>
<li>
<t>
ICMPv6 Destination Unreachable to ICMPv4 Destination Unreachable
</t>
</li>
<li>
<t>
ICMPv6 Time Exceeded to ICMPv4 Time Exceeded.
</t>
</li>
</ul>
<t>
and  the IPv6 source address in the outermost IPv6 header does not match the NAT64 prefix.
</t>
<t>
IPv6 Original Source Extension Object MUST NOT be added in any other cases.
</t>

<section>
<name>
Adding New ICMP Extension Structure
</name>
<t>
If the original ICMPv6 message does not contain an ICMP Extension Structure (as defined in Section 7 of <xref target="RFC4884"/>), the translator SHOULD append a new ICMP Extension Structure to the resulting ICMPv4 message.
When adding the new Extension Structure, the translator MUST:
</t>
<ul>
<li>
<t>
Create a new ICMP Extension Structure, containing one Extension Header and one IPv6 Original Source Extension object.
</t>
</li>
<li>
<t>
Append that Extension Structure to the original ICMPv6  message.
</t>
</li>
<li>
<t>
If the resulting packet size exceeds the minimum IPv6 MTU: truncate the embedded invoking packet by removing the trailing 24 octets (to accomodate for 4 octets of the extension header and 20 octets of the extension object).
</t>
</li>
<li>
<t>
Set the length field of the ICMPv6 message to the length of the padded "original datagram" field, measured in 32-bit words.
</t>
</li>
<li>
<t>
Translate the resulting ICMPv6 message to IPv6 as per <xref target="RFC7915"/>.
</t>
</li>
</ul>
</section>
<section>
<name>
Adding IPv6 Original Source Extension Object to Existing ICMP Extension Structure
</name>
<t>
If the original ICMPv6 message already contains an ICMP Extension Structure,  the translator SHOULD append an IPv6 Original Source Extension object to that structure.
When appending the object, the translator MUST:
</t>
<ul>
<li>
<t>
Append  an IPv6 Original Source Extension object to the Extension Structure.
</t>
</li>
<li>
<t>
Update the checksum field of the Extension Header accordingly.
</t>
</li>
<li>
<t>
If the resulting packet size exceeds the minimum IPv6 MTU: truncate the embedded invoking packet by removing the trailing 20 octets (to accomodate for 20 octets of the extension object) and update the length field of the ICMPv6 message
</t>
</li>
<li>
<t>
Translate the resulting ICMPv6 message to IPv6 as per <xref target="RFC7915"/>.
</t>
</li>
</ul>
</section>
</section>

<section>
<name>Translating Arbitrary IPv6 Source Addresses Using the Dedicated IPv4 Address</name>
<t>
The translator SHOULD use the dedicated IPv4 192.0.0.11/32 for translating IPv6 source addresses if all of the following conditions are met:
</t>
<ul>
<li>
<t>
The packet being translated is one of the following:
</t>
<ul>
<li>
<t>
ICMPv6 Destination Unreachable
</t>
</li>
<li>
<t>
ICMPv6 Time Exceeded
</t>
</li>
<li>
<t>
ICMPv6 Packet Too Big
</t>
</li>
</ul>
</li>
<li>
<t>
the IPv6 source address in the outermost IPv6 header does not match the NAT64 prefix (and is therefore not mappable to an IPv4 address).
</t>
</li>
<li>
<t>
The translator does not have an explicit address mapping (<xref target="RFC7757"/>) configured for the given global IPv6 address to an IPv4 address .
</t>
</li>
</ul>

<t>
it should be noted that the IPv6 Original Source Extension Object can not be added to ICMPv6 Packet Too Big messages (see Section 4.6 of <xref target="RFC4884"/>). 
At the same time it's highly desirable to ensure that translators translate those messages even if the IPv6 source address in the outermost IPv6 header does not match the NAT64 prefix (and is therefore not mappable to an IPv4 address), as those messages are crucial for Path MTU Discovery.
</t>

</section>
</section>

<section>
<name>
Updates to RFC7915
</name>
<t>
This document makes the following changes to Section 5.1 of <xref target="RFC7915"/>:
</t>
<t>
The text in RFC7915 is as follows:
</t>
<blockquote>
Source Address:  Mapped to an IPv4 address based on the algorithms presented in Section 6.
</blockquote>
<t>
This document updates the text as follows:
</t>
<blockquote>
Source Address:  Mapped to an IPv4 address based on the algorithms presented in Section 6.
When translating ICMPv4 error messages to ICMPv6 error messages and the valid IPv6 source address in the outermost IPv6 header does not match the prefix used in algorithmic mapping, the translator SHOULD follow the recommendations in draft-equinox-intarea-icmpext-xlat-source.
</blockquote>
<t>
This document also adds the following paragraph before the very last paragraph of Section 5.2 of <xref target="RFC7915"/> (before "Error payload:"):
</t>
<blockquote>
If valid IPv6 source address in the outermost IPv6 header of the ICMPv6 messages does not match the prefix used in algorithmic mapping, the translator SHOULD follow the recommendations in draft-equinox-intarea-icmpext-xlat-source.
</blockquote>
</section>

    <section anchor="security">
      <name>Security Considerations</name>
      <t>
          TBD.  Should probably be local-only.
      </t>
    </section>
    <section anchor="privacy">
      <name>Privacy Considerations</name>
      <t>
          TBD
      </t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>
          This document requests that IANA allocates a "Class Value" from the
          "ICMP Extension Object Classes and Class Sub-types" registry
          created by <xref target="RFC4884"/> for use as described above.
          The following entry should be appended:
      </t>
      <table>
        <thead>
          <tr><th>Class Value</th><th>Class Name</th><th>Reference</th></tr>
        </thead>
        <tbody>
          <tr><td>TBD1</td><td>Original IPv6 Source Address</td><td>[THIS DOCUMENT]</td></tr>
        </tbody>
      </table>
<t>
	This document also requests that IANA allocates an IPv4 address 192.0.0.11/32) and updates 
 the IPv4 Special-Purpose Address Registry available
   at (http://www.iana.org/assignments/iana-ipv4-special-registry/) with the following:
</t>
<t>
Address Block: 192.0.0.11/32
</t>
<t>
Name:  [TBA IN THE NEXT VERSION OF THE DRAFT]
</t>
<t>
RFC:  [THIS DOCUMENT]
</t>
<t>
Allocation Date:  TBD3
</t>
<t>
Termination Date:  N/A
</t>
<t>
Source:  True
</t>
<t>
Destination: False
</t>
<t>
Forwardable:  False
</t>
<t>
Global:  False
</t>
<t>
Reserved-by-Protocol:  False
</t>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.0792.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.4443.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.4884.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6052.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7915.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6877.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7757.xml"/>
	<xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8174.xml"/>
      </references>
     <references>
        <name>Informative References</name>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7755.xml"/>
      </references>
    </references>
    <section anchor="Acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>
          This document is the result of discussions with Thomas Jensen.
          The authors would like to thank Darren Dukes, Bill Fenner for their feedback, comments and guidance.
      </t>
    </section>
 </back>
</rfc>
