<?xml version="1.0" encoding="US-ASCII"?>
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com)
     by Daniel M Kohn (private) -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
]>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-xie-idr-mpbgp-extention-4map6-00"
     ipr="trust200902">
  <front>
    <title abbrev="MP-BGP Extension for 4map6 Advertisement">MP-BGP Extension and the Procedures for IPv4/IPv6 Mapping Advertisement</title>

    <author fullname="Chongfeng Xie" initials="C" surname="Xie">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street>Beiqijia Town, Changping District</street>

          <city>Beijing</city>

          <code>102209</code>

          <country>China</country>
        </postal>

        <email>xiechf@chinatelecom.cn</email>
      </address>
    </author>

    <author fullname="Guozhen" initials="G" surname="Dong">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street>Beiqijia Town, Changping District</street>

          <city>Beijing</city>

          <code>102209</code>

          <country>China</country>
        </postal>

        <email>donggz@chinatelecom.cn</email>
      </address>
    </author>

    <author fullname="Xing Li" initials="X" surname="Li">
      <organization>CERNET Center/Tsinghua University</organization>

      <address>
        <postal>
          <street>Shuangqing Road No.30, Haidian District</street>

          <city>Beijing</city>

          <code>100084</code>

          <country>China</country>
        </postal>

        <email>xing@cernet.edu.cn</email>
      </address>
    </author>

    <date day="15" month="January" year="2023"/>

    <workgroup>Network Working Group</workgroup>

    <keyword>RFC</keyword>

    <abstract>
      <t>This document defines NLRI with specific AFI/SAFI combination, a new
      BGP path attribute known as the &ldquo;4map6&rdquo; and a set of related
      procedures, which can be used for transferring IPv4/IPv6 address mapping rule to
      support IPv4 service delivery in multi-domain IPv6-only underlay
      networks.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The document [I-D./draft-ietf-v6ops-framework-md-ipv6only-underlay] proposes
      a framework for deploying IPv6-only as the underlay in multi-domain
      networks, in which IPv4 packets will be stateless translated or
      encapsulated into IPv6 ones for transmission across IPv6-only underlay
      domains. To achieve this goal, this framework introduces a specific data
      structure called address mapping rule to support stateless IPv4-IPv6
      packet conversion. For an incoming packet, the mapping rules are used by
      the ingress PE to generate corresponding IPv6 source and destination
      addresses from the IPv4 source and destination address of the original
      IPv4 packet, and vice versa. Since the mapping rule for the destination
      IPv4 address can identify the right PE egress by providing the IPv6
      mapping prefix, it gives the direction of IPv4 service data transmission
      throughout the IPv6-only network. It is obvious that the exchange of the mapping rule corresponding to the
      destination IPv4 address in a given packet should precede to the process
      of IPv4 data transmission in IPv6-only network, otherwise, the data
      originated from IPv4 network will be dropped due to the absence of the
      IPv6 mapping prefix corresponding to its destination address.</t>

      <t>When an ingress PE processes the incoming IPv4 packets, the mapping
      rule for the source address can be obtained locally, but for the mapping
      rule of the destination address, since it is not generated locally by
      the ingress PE, it needs corresponding methods to be obtained remotely.
      This document defines MP-BGP extension in which BGP update message
      contains the mapping rule for IPv4 service delivery. The extensions
      include NLRI with specific AFI/SAFI combination, new BGP Path Attribute
      known as the &ldquo;4map6&rdquo; corresponding to the NLRI and a set of
      related procedures.</t>

      <section title="Requirements Language">
        <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>

    <section title="Terminology and Reference Topology">
      <t>In the context of this document, multi-domain underlay networks refer
      to a network system composed of multiple autonomous systems (i.e., AS)
      interconnected, each AS can serve different scenarios. Multi-domain
      networks can be operated by one or more network operators. Consider the following scenarios, the network shown in figure 1 is typical multi-domain IPv6-only underlay networks, it is used as a basic scenario to illustrate the extension of the MP-BGP and its related procedures in this document. The network comprises of AS1, AS2 and AS3, it provides IPv4 services communications between IPv4 network 1 and IPv4 network 2, which have IPv4 address block IPv4Blk1 and IPv4Blk2 respectively. It is consistent with section 6 of draft [I-D.ietf-v6ops-framework-md-ipv6only-underlay] . PE and P routers are network routers which constitute the IPv6-only underlay. The definition of PE and P is consistent with that in draft [I-D.ietf-v6ops-framework-md-ipv6only-underlay] . It should be noted that in a multi-domain networks, some ASBRs are not at the edge of the network. In this case, they run as P routers. On each PE router that the IPv4 address prefix is reachable through, there is a locally configured IPv6 virtual interface (VIF) address. The VIF address, as an ordinary global IPv6 /128 address, must also be injected into the IPv6 IGP so that it is reachable across the multi-domain transit core.</t>

      <t><figure>
          <artwork><![CDATA[ 

IPv4blk1         +--------+       +-+      +--------+        IPv4blk2
 +--------+     /    AS1    \    /AS2\    /   AS3     \     +--------+
|   IPv4   |   |+--++  +--+| |  |+--+ |  | +--+  +-+-+ |   |  IPv4    |
| network 1|---||PE1|--|P1 |-|--||P2|-|--|-|P3|--|PE2|-|---| network 2|
 +--------+    |+---+  +--+| |  |+--+ |  | +--+  +---+ |    +--------+
                \___________/    \___/    \___________/
 Figure 1.Topology of Typical Multi-domain IPv6-only Networks]]></artwork>

          <postamble/>
        </figure>The following term will be used in this document,</t>

      <t>&bull; Distance metric, the distance to the egress PE in terms of the
      number of ASes.</t>

      <t>The extension of MP-BGP4 for mapping rule processing and transmission
      across domains in this draft will involve PE and P routers. Each PE and
      P router maintains a Mapping Rule Database as depicted in figure 2. The
      entry in the Mapping Rule Database consists of an IPv4 address prefix,
      IPv4 address prefix length, IPv6 mapping prefix, IPv6 mapping prefix
      length and the distance to the egress. It should be noted that the
      database here is just an example, and developers can design the
      structure of database according to the actual situation.</t>

      <t><figure>
          <artwork><![CDATA[
+----------+----------------+----------+---------------+------------+
|  IPv4    |  IPv4          |  IPv6    | IPv6          | Distance   |
|  Address |  Address       |  Mapping | Mapping       | to the     |
|  Prefix  |  Prefix Length |  Prefix  | Prefix Length | Egress     |
+----------+----------------+----------+---------------+------------+
     Figure 2: The Entry of Mapping Rule Database]]></artwork>
        </figure>The IPv4 packet sent from IPv4 network 1 will traverse the
      IPv6-only network and reach the destination network, i.e., IPv4
      network 2. Its ingress in the IPv6-only network is PE1 and the egress is
      PE2. Before the data packet is transmitted, the address mapping rules
      corresponding to its IPv4 destination address should be transmitted from
      PE2 to PE1. During the mapping rule announcement and transmission
      process, it may pass through the intermediate nodes, such as P3, P2 and
      P1, and finally reach PE1. For a given intermediate node, it may receive
      advertisement messages of this mapping rule from multiple upstream
      intermediate nodes. In order to reduce the overall quantity of
      advertisement message, it needs to select and update the local Mapping
      Rule Database, generates advertisement messages based on the selected
      mapping rule information and transmit them to downstream intermediate
      nodes.</t>
    </section>

    <section title="MP-BGP Protocol Extension">
      <t/>

      <section title="NLRI Encoding for IPv4/IPv6 Mapping Rule Advertisement">
        <t>Multiprotocol BGP (MP-BGP) <xref target="RFC4760"/>specifies that
        the set of usable next-hop address families is determined by the
        Address Family Identifier (AFI) and the Subsequent Address Family
        Identifier (SAFI). <xref target="RFC8950"/> specifies the extensions
        to allow advertisement of IPv4 NLRI or VPN IPv4 NLRI with a next-hop
        address that belongs to the IPv6 protocol. This document specifies the
        extensions necessary to allow advertisement of address mapping rules
        across domains. To support the transmission of mapping rule from any
        egress PE to any ingress PE within and across domains, a new Subsequent
        Address Family Identifier (SAFI) needs to be assigned
        by IANA. When this is available, the BGP update message can contain
        the 4map6 BGP path attribute. The BGP update whose MP_REACH_NLRI
        attribute contains the AFI/SAFI combinations specified above is called
        as 4map6 routing information. The use and meaning of the fields of
        MP_REACH_NLRI in this case are as follows:</t>

        <t indent="8"> &ndash; AFI = 2 (IPv6)</t>

        <t indent="8"> &ndash; SAFI = xx (4map6)</t>

        <t indent="8"> &ndash; Length of Next Hop</t>

        <t indent="8"> &ndash; Network Address of Next Hop = When a BGP speaker
        advertises the 4map6 NLRI via BGP, it uses its own address as the BGP
        next hop in the MP_REACH_NLRI.</t>

        <t indent="8"> &ndash; NLRI = Composite IPv6 address prefix, which is composed of a IPv6
        mapping prefix, the original IPv4 address prefix, and the remaining
        bits are zero.</t>

        <t>The NLRI field is encoded as shown in figure 3:</t>

        <figure>
          <artwork><![CDATA[  
                  +----------------------------+
                  |       Length    1 octet    |
                  +----------------------------+
                  |       Prefix    variable   |
                  +----------------------------+
                 Figure 3: the Format of NLRI Field]]></artwork>
        </figure>
      </section>

      <section title="4map6 Path Attribute">
        <t>This document specifies a way in which BGP protocol can be used by
        a given PE to tell other PE, "If you need to send IPv4 packet whose
        destination address is within a given IPv4 address block, please send
        them to me, here's the information you need to properly transform the
        IPv4 packet into IPv6 one". A PE signals this information to other BGP
        speakers by using a new BGP attribute type value -- the 4map6
        attribute. This attribute specifies the IPv6 mapping prefix that may
        be used, as well as whatever additional information (if any) is needed
        in order to properly transform the IPv4 packets. As a new BGP path
        attribute defined in this document, 4map6 attribute is optional and transitive, it is encoded as shown below:</t>

        <figure>
          <artwork><![CDATA[
	   +---------------------------------------------------+
	   |     Length of IPv6 Mapping Prefix(1 octets)       |
	   +---------------------------------------------------+
	   |     Forwarding Type(1 octet)                      |
	   +---------------------------------------------------+
	   |     Address Origin Type(1 octet)                  |
	   +---------------------------------------------------+
	   |     IPv4 Origin(1 octet)                          |
	   +---------------------------------------------------+
	   |     Length of IPv4 AS Path(1 octet)               |
	   +---------------------------------------------------+
	   |     IPv4 AS Path(variable)                        |
	   +---------------------------------------------------+
                 Figure 4:Encoding of the 4map6 attribute
           ]]></artwork>
        </figure>

        <t>The use and meaning of these fields are as follows:</t>

        <t>a) Length of IPv6 Mapping Prefix</t>

        <t>This is a 1-octet field whose value expresses the length of IPv6
        mapping prefix.</t>

        <t>b) Forwarding Type</t>

        <t>This field identifies the IPv4/IPv6 forwarding capability of the
        egress PE, the data octet can assume the following values:</t>

        <t indent="4">Value   Meaning</t>

          <t indent="4">  0   Translation and encapsulation</t>

          <t indent="4">  1   Encapsulation</t>

          <t indent="4">  2   Translation</t>

        <t>c) Address Origin Type</t>

        <t>The data octet can assume the following value:</t>

        <t indent="4">Value   Meaning</t>

	        <t indent="4">  0     Local</t> 

   	      <t indent="4">  1     Relay</t>

        <t>d) IPv4 Origin</t>

        <t>This field is the copy of the Origin attribute in BGP update
        message received from IPv4 domain.The value of this field exists only when the value of "Address Origin Type" is 1, otherwise it is NULL.</t>

        <t>e) Length of IPv4 AS_Path</t>

        <t>A 1-octet field whose value expresses the length of the "IPv4
        AS_Path" measured in octets.The value of this field exists only when the value of "Address Origin Type" is 1, otherwise it is NULL.</t>

        <t>f) IPv4 AS_Path</t>

        <t>This field is the copy of the AS_PATH attribute in BGP UPDATE
        message received from IPv4 domain.The value of this field exists only when the value of "Address Origin Type" is 1, otherwise it is NULL.</t>
      </section>

      <section title="Explicit Withdrawal of IPv4/IPv6 Mapping Rule">
        <t>When a PE ceases to provide egress service for a given IPv4
        address block, it may explicitly withdraw the mapping rules
        associated with it. Suppose a PE has announced, on a given BGP
        session, the mapping rule of a given IPv4 prefix and it now wishes to
        withdraw that mapping rule. To do so, it may send a BGP UPDATE message
        with an MP_UNREACH_NLRI attribute.</t>

        <t>This encoding of MP_UNREACH_NLRI attribute is used for explicitly
        withdrawing the mapping rule for a given IPv4 prefix (on a given BGP
        session). Note that IPv4 address prefix/IPv6 mapping prefix bindings
        that were not advertised on the given session can not be withdrawn by
        this method.</t>

        <t>When using an MP_UNREACH_NLRI attribute to withdraw a IPv4 route
        whose NLRI was previously specified in an MP_REACH_NLRI attribute, the
        lengths and values of the respective prefixes must match, and the
        respective AFI/SAFIs must match. An explicit withdrawal in an
        AFI/SAFI-xx UPDATE on a given BGP session not only withdraws the
        binding between the IPv4 address prefix and the IPv6 mapping prefix, it
        also withdraws the path to that prefix that was previously advertised
        in a SAFI-xx UPDATE on that session.</t>
      </section>
    </section>

    <section title="Operation">
      <section title="Advertisement of Mapping Rule Update by egress PE">
        <t>When a PE router learns routing information from the locally
        attached IPv4 access networks, the control plane of the PE should
        process the information as follows:</t>

        <t>1. Install and maintain local IPv4 routing information in the IPv4
        routing database.</t>

        <t>2. Install and maintain new entries in the Mapping Rule Database.
        Each entry should consist of the IPv4 prefix and the local IPv6
        mapping prefix.</t>

        <t>3. Advertise the new contents of the local Mapping Rule Database in
        the form of BGP update advertisement to IPv6 peer routers. The process
        to generate IPv6 route advertisement with 4map6 attribute based on
        IPv4 route advertisement messages is as follows:</t>

        <t indent="4">a) Set the values of AFI and SAFI in MP_REACH_NLRI to 2 and xx
        respectively;</t>

        <t indent="4">b) The IPv6 mapping prefix of the egress PE splices IPv4 address
        blocks in IPv4 routing advertisements to form a composite IPv6 address
        prefix with a length of L1. The composite IPv6 address prefix is
        copied to address prefix field of the NLRI structure in the MP_
        REACH_NLRI, and the length field of the NLRI is set to L1, the
        structure of the composite IPv6 address prefix in NLRI is shown in
        figure 5. L2 is the length of the IPv6 mapping prefix Pref6-2 of PE2,
        the field of Length of IPv6 Mapping Prefix value in the 4map6
        attribute is set to L2.</t>

        <t indent="4">c) In addition, the values of Origin, Length of AS_ Path, AS_Path
        information in the original IPv4 route advertisement is copied to the
        fields of IPv4 Origin, Length of IPv4 AS_Path,IPv4 AS_Path of
        4map6 attribute respectively.</t>

        <figure>
          <artwork><![CDATA[
	 |--------L2--------|
	 +------------------+------------------+-------------+
	 |  IPv6 Mapping    |   IPv4           |  ...0000... |
	 |  Prefix of PE2   |   address prefix |             |
  	 +------------------+------------------+-------------+
	 |-----------------L1------------------|
	      Figure 5:Structure of IPv6 prefix in NLRI
      ]]></artwork>
        </figure>
      </section>

      <section title="Receiving Mapping Rule advertisement by P router">
        <t>When a P router receives BGP update advertisement from neighboring
        P or PE routers and uses that information to populate the local
        Mapping Rule Database, the following procedures are used to update the
        Mapping Rule Database and send mapping rule advertisement to next
        equipment:</t>

        <t>1. Validate the received BGP update advertisement as 4map6 routing
        information by AFI = 2 (IPv6) and SAFI = xx (4map6).</t>

        <t>2. Extract the IPv4 address prefix which is encoded in positions L2
        to L1-1 of the NLRI field and lookup in the Mapping Rule Database, if
        an entry which matches the IPv4 address prefix is found, then,</t>

        <t indent="8">   &ndash; Compare the distance metric in the 4map6 attribute of BGP
        advertisement and that of the entry found, if the former is less than
        the latter, then</t>

        <t indent="12">      &bull; Update the entry found in the Mapping Rule Database with the
        attributes of BGP advertisement by extracting the IPv6 address prefix
        from the IPv6 mapping prefix field and place that as an associated
        entry next to the IPv4 network index.</t>

        <t indent="12">      &bull; Advertise the updated contents of the local Mapping Rule
        Database in the form of MP_REACH_NLRI update information to IPv6 peer
        routers.</t>

        <t indent="8">   else then</t>

        <t indent="12">   &bull; Keep the entry in the Mapping Rule Database unchanged.</t>

        <t indent="12">   &bull; Advertise the contents of the local Mapping Rule Database in
        the form of BGP update advertisement to IPv6 peer routers.</t>

        <t indent="4">else then</t>

        <t indent="8">   &ndash; Install and maintain a new entry in the Mapping Rule
        Database with the extracted IPv4 prefix, its corresponding IPv6
        mapping prefix and distance metric to the egress.</t>

        <t indent="8">   &ndash; Advertise the contents of the local Mapping Rule Database in
        the form of BGP update advertisement to IPv6 peer routers.</t>


        <t>It should be noted that this process does not change or affect the
        IPv6 FIB table of the P router.</t>
      </section>

      <section title=" Receiving Mapping Rule Update by Ingress PE">
        <t>When a PE router receives BGP advertisement from neighboring P or
        PE routers and uses that information to populate the local Mapping
        Rule Database and the BGP routing database, the following procedures
        are used to update the Mapping Rule Database and send IPv4 routing
        information to its IPv4 peers.</t>

        <t>1. Validate the received BGP update advertisement as 4map6 routing
        information by AFI = 2 (IPv6) and SAFI = xx (4map6).</t>

        <t>2. Extract the IPv4 address prefix which is encoded in positions L2
        to L1-1 of the NLRI field and lookup in the Mapping Rule Database, if
        an entry which matches the IPv4 address prefix is found, then,</t>

        <t indent="8">&ndash; Compare the distance metric in the BGP advertisement and
        that of the entry found, if the former is less than the latter,
        then</t>

        <t indent="12">&bull; Update the entry found in the Mapping Rule Database with the
        4map6 attributes of BGP advertisement by extracting the IPv6 address
        prefix from the IPv6 mapping prefix field and place that as an
        associated entry next to the IPv4 network index.</t>

        <t indent="12">&bull; Redistribute the new 4map6 routing information to the local
        IPv4 routing table. Set the destination network prefix as the
        extracted IPv4 prefix, set the Next Hop as Null, and set the OUTPUT
        Interface as the 4map6 VIF on the local PE router.</t>

        <t indent="8">else then</t>

        <t indent="12">&bull; Keep the entry in the Mapping Rule Database unchanged.</t>

        <t indent="4">else then</t>

        <t indent="8">&ndash; Install and maintain a new entry in the Mapping Rule
        Database with the extracted IPv4 prefix, its corresponding IPv6
        mapping prefix and distance metric to the egress.</t>

        <t indent="8">&ndash; Redistribute the new 4map6 routing information to the local
        IPv4 routing table. Set the destination network prefix as the
        extracted IPv4 prefix, set the Next Hop as Null, and set the OUTPUT
        Interface as the 4map6 VIF on the local PE router.</t>
      </section>
    </section>

    <section title="Mapping Rule Capability">
      <t><xref target="RFC5492"/>defines a Capabilities Optional Parameter and
      processing rules. The Capabilities Optional Parameter is a triple that
      includes a one-octet Capability Code, a one-octet Capability length, and
      a variable-length Capability Value. A BGP speaker can include a
      Capabilities Optional Parameter to communicate capabilities in a BGP
      OPEN message. A PE or P router that wishes to exchange mapping rule
      information must use the Multiprotocol Extensions Capability Code as
      defined in <xref target="RFC4760"/>, to advertise the corresponding
      (AFI, SAFI) pair.</t>
    </section>

    <section title="Error Handling">
      <t>When a BGP speaker encounters an error while parsing the 4map6 path
      attribute, the speaker must treat the update as a withdrawal of existing
      routes to the included 4map6 SAFI NLRIs, or discard the update if no
      such routes exist. A log entry should be raised for local analysis.</t>
    </section>

    <section title="IANA Considerations">
      <t>With this document IANA is requested to allocate the following
      codes,</t>

      <t>1)A code for 4map6 path attribute in the BGP &ldquo;BGP Path
      Attributes&rdquo; registry</t>

      <t>2)Value xx for 4map6 in the BGP "Capability Codes" registry</t>

      <t>3)A new SAFI value (xx) for the BGP 4map6 SAFI.</t>

      <t>All the codes above use this document as the reference.</t>
    </section>

    <section title="Security Considerations">
      <t>This extension to MP-BGP does not change the underlying security
      issues inherent in the existing MP-BGP.</t>
    </section>
  </middle>

  <back>
  
  <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include="reference.RFC.4760"?>

      <?rfc include="reference.RFC.5492"?>

      <?rfc include='reference.RFC.8174'?>

      <?rfc include="reference.RFC.8950"?>

   
    </references>

    <references title="Informative References">
    
      <?rfc include='reference.I-D.ietf-v6ops-framework-md-ipv6only-underlay'?>

    </references>
  </back>
</rfc>
