<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC4360 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4360.xml">
<!ENTITY RFC4364 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4364.xml">
<!ENTITY RFC4684 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4684.xml">
<!ENTITY RFC7606 SYSTEM "http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7606.xml">
<!ENTITY WIDE-COMMUNITIES SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-wide-bgp-communities.xml">
<!ENTITY FLEX-TE-SLICING SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.zzhang-teas-network-slicing-with-flex-te.xml">
<!ENTITY GENERIC-RTC SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.zzhang-idr-bgp-rt-constrains-extension.xml">
]>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc strict="no"?>
<?rfc rfcedstyle="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-zzhang-idr-bitmask-route-target-01" ipr="trust200902">
  <front>
    <title abbrev="bitmask-route-target">Bitmask Route Target</title>

    <author fullname="Zhaohui Zhang" initials="Z." surname="Zhang">
      <organization>Juniper Networks</organization>
      <address>
        <email>zzhang@juniper.net</email>
      </address>
    </author>

    <author fullname="Srihari Sangli" initials="S." surname="Sangli">
      <organization>Juniper Networks</organization>
      <address>
        <email>ssangli@juniper.net</email>
      </address>
    </author>

    <author fullname="Jeffrey Haas" initials="J." surname="Haas">
      <organization>Juniper Networks</organization>
      <address>
        <email>jhaas@juniper.net</email>
      </address>
    </author>

    <date year="2021"/>

    <workgroup>idr</workgroup>

    <abstract>
      <t>This document specifies a new type of Route Target called Bitmask
         Route Target as a BGP Community Container. The key element of a
         Bitmask Route Target is a Bitmask. Two Bitmask Route Targets are
         considered equivalent for the purpose of controlling route propagation
         (via Route Target Constraints) and importation if the result of
         logical "AND" operation of the Bitmask of the two is non-zero.
      </t>
    </abstract>

    <note 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>
    </note>
  </front>

  <middle>
    <section title="Introduction">
    <t>The importation and propagation of BGP routes can be controlled using
       Route Targets <xref target="RFC4364"/> and 
       Constrained Route Target Distribution (RT-C) <xref target="RFC4684"/>.
       RT-C relies on matching a Route Target prefix.
       The typical matching use case is the full 8-octet encoding of the Route
       Target Extended Community.
    </t>
    <t>For some applications, it's desirable to have a Route Target with the
       semantic of a bit-string.  For such situations and it may be desirable
       to match such bit-string Route Targets that have specific bits set.
       This document defines a new type of Route Target for that purpose.
    </t>
    <t>An example use case of this Bitmask Route Target is documented in
       <xref target="I-D.zzhang-teas-network-slicing-with-flex-te"/>.
    </t>
    <t>The use of Bitmask Route Target with Constrained Route Target Distribution
       is specified separately in
       <xref target="I-D.zzhang-idr-bgp-rt-constrains-extension"/>.
    </t>
    </section>
    <section title="Specification" anchor="spec">
    <t>The Bitmask Route Target is a Transitive BGP Community Container
       of type TBD1 <xref target="I-D.ietf-idr-wide-bgp-communities"/>.
    </t>
    <t>The semantics of Global Administrator and Local Administor are identical
       to those in <xref target="RFC4360"/>.
    </t>
    <t>The container's contents is a series of Bitmask Route Targets.  Each
       Bitmask Route Target includes a 1-octet Global Administrator (GA) Type,
       a 1-octet GA Sub-Type, 1-octet GA Length, a variable length GA,
       a 4-octet Local Administrator (LA), a 1-octet Bitmask Length in number
       of octets, and a variable length Bitmask.
    <figure>
	<artwork>

      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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |  GA Type        |  GA Sub-Type  |  GA Length    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |  Global Administrator (variable length)                       ~
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |  Local Administrator                                          |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |  Bitmask Length |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ~                   Bitmask (variable length)                   ~
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	</artwork>
    </figure>
    </t>
    <t>The following GA Types and corresponding lengths are defined
       in this document:
       <list>
          <t>1: AS Number, 4-octets</t>
          <t>2: IPv4 Address, 4-octets</t>
          <t>3: IPv6 Address, 16-octets</t>
       </list>
    </t>
    <t>The follow GA Sub-Types are defined in this document:
       <list>
         <t>2: Route-Target</t>
       </list>
    </t>
    <section title="Matching Semantics">
    <t>A Bitmask Route Target, A, is considered to match Bitmask Route Target, B,
       for the purpose of controlling propagation and importation of a route
       with an attached Bitmask Route Target B if the following conditions are
       met:
       <list style="symbols">
	 <t>The GA Type, GA Sub-Type, GA Length, GA, and LA fields in A and B
	    match.
         </t>
	 <t>Either:
	    <list>
	    <t>
	      The Bitmask Length of A is 0.  In other words, "match all".
	    </t>
            <t>The result of the logical "AND" operation of the Bitmask field
	       in A and B is not 0. When A and B have different Bitmask Lengths,
	       the shorter Route Target's Bitmask is considered to be padded with
	       zeroes for match purposes vs. the longer one.
            </t>
	    </list>
         </t>
       </list>
    </t>
   </section>
   </section>
    <section title="Error Handling">
      <t>A Bitmask Route Target MUST NOT be originated with a RESERVED GA Type.
	 Implementations receiving BGP Routes with a RESERVED Bitmask Route
	 Target MUST check its syntactic correctness and MAY silently discard it.
      </t>
      <t>A Bitmask Route Target SHOULD NOT be originated with a Bitmask Length of 0.
      </t>
      <t>A Bitmask Route Target is considered malformed if:
         <list style="symbols">
	   <t>The length of the Bitmask Route Target is less than the
	      minimum length of 8: 1-octet GA Type, 1-octet GA Sub-Type, 1-octet GA Length, 
	      0-length GA, 4-octet LA, 0-octet Bitmask.
	   </t>
	   <t>The Bitmask Route Target GA Type is known by the
	      implementation and the GA Length is incorrect vs. the registered GA
	      Type.
	   </t>
	   <t>The total computed length of the Bitmask Route Targets in a
	      BGP Community Container is not identical to the BGP Community
	      Container Length.  Each Bitmask Route Target's computed length
	      is: 1-octet GA Type, 1-octet GA Length field, N-octet GA Length
	      value, 4-octet LA field, 1-octet Bitmask Length, N-octet Bitmask
	      Length value.
	   </t>
	 </list>
      </t>
      <t>BGP Updates containing malformed Bitmask Route Targets should use the
	 Treat-as-withdraw behavior for the routes in the Update according to
	 <xref target="RFC7606"/>.
      </t>
    </section>
    <section anchor="Security" title="Security Considerations">
      <t>This document does not change security aspects as discussed in
         <xref target="RFC4364"/> and <xref target="I-D.ietf-idr-wide-bgp-communities"/>.
      </t>
    </section>
    <section title="IANA Considerations">
    <t>This document requests IANA to assign a BGP Community Container
       Type for the Bitmask Route Target from the "BGP Community Container Types"
       registry for TBD1.
    </t>
    <t>This document requests IANA to setup a "Bitmask Route Target
       Global Administrator Type Registry".  The initial allocation and policy for this registry is:
    </t>

<texttable title="Bitmask Route Target GA-Type Registry">
<ttcol>GA Type</ttcol>
<ttcol>GA Type Name</ttcol>
<ttcol>GA Type Length (octets)</ttcol>
<ttcol>Reference</ttcol>

<c>0</c>        <c>RESERVED</c>                            <c>UNSPECIFIED</c> <c>This document</c>
<c>1</c>        <c>AS Number</c>                           <c>4</c>           <c>This document</c>
<c>2</c>        <c>IPv4 Address</c>                        <c>4</c>           <c>This document</c>
<c>3</c>        <c>IPv6 Address</c>                        <c>16</c>          <c>This document</c>
<c>4..127</c>   <c>Available, Specification Required</c>   <c>TBD</c>         <c>-</c>
<c>128..254</c> <c>Available, First Come, First Served</c> <c>TBD</c>         <c>-</c>
<c>255</c>      <c>RESERVED</c>                            <c>UNSPECIFIED</c> <c>This document</c>
</texttable>

    <t>This document requests IANA to setup a "Bitmask Route Target Global Administrator Sub-Type
       Registry".  The initial allocation and policy for this registry is:
    </t>

<texttable title="Bitmask Route Target GA-Sub-Type Registry">
<ttcol>GA Sub-Type</ttcol>
<ttcol>GA Sub-Type Name</ttcol>
<ttcol>Reference</ttcol>

<c>0</c>        <c>RESERVED</c>                            <c>This document</c>
<c>1</c>        <c>Available, Specification Required</c>   <c>-</c>
<c>2</c>        <c>Route-Target</c>                        <c>This document</c>
<c>3..127</c>   <c>Available, Specification Required</c>   <c>-</c>
<c>128..254</c> <c>Available, First Come, First Served</c> <c>-</c>
<c>255</c>      <c>RESERVED</c>                            <c>This document</c>
</texttable>

    </section>
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors thank John Scudder for his comments and suggestions.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC7606;
      &RFC8174;
      &WIDE-COMMUNITIES;
    </references>
    <references title="Informative References">
      &RFC4360;
      &RFC4364;
      &RFC4684;
      &FLEX-TE-SLICING;
      &GENERIC-RTC;
    </references>
  </back>
</rfc>
