<?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 filename "draft-ietf-idr-flowspec-l2vpn-23">
  <!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 strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="&filename;"
  ipr="trust200902"
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">
<!-- 
    * docName should be the name of your draft * category should be
    one of std, bcp, info, exp, historic * ipr should be one of
    trust200902, noModificationTrust200902, noDerivativesTrust200902,
    pre5378Trust200902 * updates can be an RFC number as NNNN *
    obsoletes can be an RFC number as NNNN
-->


<!-- ____________________FRONT_MATTER____________________ -->
<front>
   <title abbrev="L2 Flow Spec">BGP Dissemination of L2 Flow
   Specification Rules</title>
   <!--  The abbreviated title is required if the full title is
        longer than 39 characters --> 

   <seriesInfo name="Internet-Draft"
               value="&filename;"/>

   <author fullname="Weiguo Hao" initials="W."
           surname="Hao">
     <organization>Huawei Technologies</organization>
     <address>
       <postal>
         <street>101 Software Avenue</street>
         <city>Nanjing</city>
         <region>Jiangsu</region>
         <code>210012</code>
         <country>China</country>
       </postal>        
       <email>haoweiguo@huawei.com</email>
     </address>
   </author>

   <author fullname="Donald E. Eastlake, 3rd" initials="D."
           surname="Eastlake">
     <organization>Independent</organization>
     <address>
       <postal>
         <street>2386 Panoramic Circle</street>
         <city>Apopka</city>
         <region>Florida</region>
         <code>32703</code>
         <country>USA</country>
       </postal>        
       <phone>+1-508-333-2270</phone>
       <email>d3e3e3@gmail.com</email>
     </address>
   </author>

   <author fullname="Stephane Litkowski" initials="S."
           surname="Litkowski">
     <organization>Cisco Systems, Inc.</organization>
     <address>
        <email>slitkows.ietf@gmail.com</email>
     </address>
   </author>

   <author fullname="Shunwan Zhuang" initials="S."
           surname="Zhuang">
     <organization>Huawei Technologies</organization>
     <address>
       <postal>
         <street>Huawei Building, No.156 Beiqing Road</street>
         <city>Beijing</city>
         <code>100095</code>
         <country>China</country>
       </postal>        
       <email>zhuangshunwan@huawei.com</email>
     </address>
   </author>

   <date year="2024" month="4" day="15"/>

   <area>Routing</area>
   <workgroup>IDR Working Group</workgroup>
   <!-- "Internet Engineering Task Force" is fine for individual
        submissions.  If this element is not present, the default is
        "Network Working Group", which is used by the RFC Editor as a
        nod to the history of the RFC Series. --> 

   <keyword/>
   <!-- Multiple keywords are allowed.  Keywords are incorporated
        into HTML output files for use by search engines. --> 

<abstract>
<t>This document defines a Border Gateway Protocol (BGP) Flow
Specification (flowspec) extension to disseminate Ethernet Layer 2
(L2) and Layer 2 Virtual Private Network (L2VPN) traffic filtering
rules either by themselves or in conjunction with L3 flowspecs.
AFI/SAFI 6/133 and 25/134 are used for these purposes.  New component
types and two extended communities are also defined.</t>
</abstract>
 
</front>


<!-- ____________________MIDDLE_MATTER____________________ -->
<middle>
    
<section>  <!-- 1. -->
  <name>Introduction</name>

<t>Border Gateway Protocol (BGP) Flow Specification <xref
target="RFC8955"/> (flowspec) is an extension to BGP that supports the
dissemination of traffic flow specifications and resulting actions to
be taken on packets in a specified flow.  It leverages the BGP Control
Plane to simplify the distribution of ACLs (Access Control Lists).
Using the Flow Specification extension new filter rules can be
injected to all BGP peers simultaneously without changing router
configuration.  A typical application is to automate the distribution
of traffic filter lists to routers for DDoS (Distributed Denial of
Service) mitigation, access control, and similar applications.</t>

<t>BGP Flow Specification <xref target="RFC8955"/> defines a BGP
Network Layer Reachability Information (NLRI) format used to
distribute traffic flow specification rules.  The NLRI for (AFI=1,
SAFI=133) specifies IPv4 unicast filtering.  The NLRI for (AFI=1,
SAFI=134) specifies IPv4 BGP/MPLS VPN filtering <xref
target="RFC7432"/>.  The Flow Specification match part defined in
<xref target="RFC8955"/> only includes L3/L4 information like IPv4
source/destination prefix, protocol, ports, and the like, so traffic
flows can only be filtered based on L3/L4 information. This has been
extended by <xref target="RFC8956"/> to cover IPv6 (AFI=2) L3/L4.</t>

<t>Layer 2 Virtual Private Networks (L2VPNs) have been deployed in an
increasing number of networks.  Such networks also have requirements
to deploy BGP Flow Specification to mitigate DDoS attack traffic.
Within an L2VPN network, both IP and non-IP Ethernet traffic may
exist.  For IP traffic filtering, the VPN Flow Specification rules
defined in <xref target="RFC8955"/> and/or <xref target="RFC8956"/>,
which include match criteria and actions, can still be used.  For
non-IP Ethernet traffic filtering, Layer 2 related information like
source/destination MAC and VLAN must be considered.</t>

<t>There are different kinds of L2VPN networks like EVPN <xref
target="RFC7432"/>, BGP VPLS <xref target="RFC4761"/>, LDP VPLS <xref
target="RFC4762"/> and border gateway protocol (BGP) auto discovery
<xref target="RFC6074"/>.  Because the Flow Specification feature
relies on the BGP protocol to distribute traffic filtering rules, it
can only be incrementally deployed in those L2VPN networks where BGP
has already been used for auto discovery and/or signaling purposes
such as BGP-based VPLS <xref target="RFC4761"/>, EVPN, and LDP-based
VPLS <xref target="RFC4762"/> with BGP auto-discovery <xref
target="RFC6074"/>.</t>

<t>This document defines new flowspec component types and two new
extended communities to support L2 and L2VPN flowspec applications.
The flowspec rules can be enforced on all border routers or on some
interface sets of the border routers.  SAFI=133 in <xref
target="RFC8955"/> and <xref target="RFC8956"/> is extended for AFI=6
as specified in Section 2 to cover L2 traffic filtering information
and in Section 3 SAFI=134 is extended for AFI=25 to cover the L2VPN
environment.</t>

<section>
   <name>Terminology</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>

<t>The following acronyms and terms are used in this document:</t>

<dl>

<dt>AFI -</dt><dd>Address Family Identifier</dd>

<dt>ACL -</dt><dd>Access Control List</dd>

<dt>DDoS -</dt><dd>Distributed Denial of Service</dd>

<dt>DEI -</dt><dd>Drop Eligible Indicator</dd>

<dt>EVPN -</dt><dd>Ethernet VPN <xref target="RFC7432"/></dd>

<dt>flowspec -</dt><dd>BGP Flow Specification</dd>

<dt>L2 -</dt><dd>Layer 2</dd>

<dt>L2VPN -</dt><dd>Layer 2 VPN</dd>

<dt>L3 -</dt><dd>Layer 3</dd>

<dt>L3VPN -</dt><dd>Layer 3 VPN</dd>

<dt>NLRI -</dt><dd>Network Layer Reachability Information</dd>

<dt>PCP -</dt><dd>Priority Code Point <xref target="IEEE802.1Q"/></dd>

<dt>SAFI -</dt><dd>Subsequent Address Family Identifier</dd>

<dt>TPID -</dt><dd>Tag Protocol ID, typically a VLAN ID</dd>

<dt>VLAN -</dt><dd>Virtual Local Area Network</dd>

<dt>VPLS -</dt><dd>Virtual Private Line Service <xref
target="RFC4762"/></dd>

<dt>VPN -</dt><dd>Virtual Private Network</dd>

</dl>

 </section>
 
</section>

<section> <!-- 2. -->
  <name>Layer 2 Flow Specification Encoding</name>

<t><xref target="RFC8955"/> defines SAFI 133 and SAFI 134, with AFI=1,
for "dissemination of IPv4 flow specification rules" and
"dissemination of VPNv4 flow specification rules", respectively.
<xref target="RFC8956"/> extends <xref target="RFC8955"/> to also
allow AFI=2 thus making it applicable to both IPv4 and IPv6
applications.  This document further extends SAFI=133 for AFI=6 and
SAFI=134 for AFI=25 to make them applicable to L2 and L2VPN
applications. This document also provides for the optional combination
of L3 flow specifications with these L2 flow specifications.</t>

<t>This section specifies the L2 flowspec for AFI=6/SAFI=133. To
simplify assignments, a new registry is used for L2 flowspec. Since it
is frequently desirable to also filter on L3/L4 fields, provision is
made for their inclusion along with an indication of the L3 protocol
involved (IPv4 or IPv6).</t>

<t>The NLRI part of the MP_REACH_NLRI and MP_UNREACH_NLRI is encoded
as a 1- or 2-octet total NLRI length field followed by several fields
as described below.</t>

<figure anchor="L2NLRI">
  <name>Flow Specification NLRI for L2</name>
    <artwork type="ascii-art" align="center">
      <![CDATA[
+-------------------------------+
| total-length (0xnn or 0xfnnn) |  2 or 3 octets
+-------------------------------+
|             L3-AFI            |  2 octets
+-------------------------------+
|  L2-length (0xnn or 0xfnnn)   |  2 or 3 octets
+-------------------------------+
|           NLRI-value          |  variable
+-------------------------------+
      ]]>
   </artwork>
</figure>

<t>The fields show in Figure 1 are further specified below:</t>

<dl>
  
<dt>total-length:</dt><dd>The length of the subsequent fields (L3 AFI,
L2-length, and NRLI-value) encoded as provided in Section 4.1 of <xref
target="RFC8955"/>. If this field is less than 4, which is the minimum
valid value, then the NLRI is malformed in which case a NOTIFICATION
message is sent and the BGP connection closed as provided in Section
6.3 of <xref target="RFC4271"/>.</dd>

<dt>L3-AFI:</dt><dd>If no L3/L4 filtering is desired, this two octet
field MUST be zero which is a reserved AFI value. Otherwise L3-AFI
indicates the L3 protocol involved by giving its AFI (0x0001 for IPv4
or 0x0002 for IPv6). If the receiver does not understand the value of
the L3-AFI field, the MP_REACH or MP_UNREACH attribute is
ignored. </dd>

<dt>L2-length:</dt><dd>The length of the L2 components at the
beginning of the NLRI-value field encoded as provided in Section 4.1
of <xref target="RFC8955"/>.  If the value of this field indicates
that the L2 components extend beyond the total-length, the NLRI is
malformed in which case a NOTIFICATION message is sent and the BGP
connection closed as provided in Section 6.3 of <xref
target="RFC4271"/>. N2-length MAY be zero although, in that case, it
would have been more efficient to encode the attribute as an L3 Flow
spec unless it is desired to apply an L2 action (see Section 4). A
null L2 flowspec always matches. </dd>

<dt>NLRI-value:</dt><dd>This consists of the L2 flowspec, of length
L2-length, followed by an optionally present L3 flowspec. The result
can be treated in most ways as a single flowspec, matching the
intersection (AND) of all the components except that the components in
the initial L2 region are interpreted as L2 components and the
remainder as L3 components per the L3-AFI field. This is necessary
because there are different registries for the L2, L3 IPv4, and L3
IPv6 component types. If the L3 flowspec is null (length zero), it
always matches.</dd>

</dl>
  
 <section>
   <name>L2 Component Types</name>

 <t>The L2 flowspec portion of the NLRI-value consists of flowspec
 components as in <xref target="RFC8955"/> but using L2 components and
 types as specified below. All components start with a type octet
 followed by a length octet followed by any additional information
 needed. The length octet gives the length, in octets, of the
 information after the length octet.  This structure applies to all
 new components to be defined in the L2 Flow-spec Component Registry
 (see Section 6) and to all existing components except Types 2 and 3
 where the length is in bits.</t>

 <section>
   <name>Type 1 - Ethernet Type (EtherType)</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t>

 <t>Defines a list of {operation, value} pairs used to match the
 two-octet EtherType field.  op is encoded as specified in Section
 4.2.1.1 of <xref target="RFC8955"/>. Values are encoded as 2-octet
 quantities.  Ethernet II framing defines the two-octet Ethernet Type
 (EtherType) field in an Ethernet frame, preceded by destination and
 source MAC addresses, that identifies an upper layer protocol
 encapsulating the frame data. The match fails if LLC encoding is
 being used rather than EtherType encoding.</t>

 </section>

 <section>
   <name>Type 2 - Source MAC</name>

 <t>Encoding: &lt;type (1 octet), MAC Prefix length (1 octet), MAC
 Prefix&gt;</t>

 <t>Defines the source MAC Address prefix to match encoded as in BGP
 UPDATE messages <xref target="RFC4271"/>.  Prefix length is in bits
 and the MAC Prefix is fill out with from 1 to 7 padding bits so that
 it is an integer number of octets. These padding bits are ignored for
 matching purposes.</t>

 </section>
 
 <section>
   <name>Type 3 - Destination MAC</name>

 <t>Encoding: &lt;type (1 octet), MAC Prefix length (1 octet), MAC
 Prefix&gt;</t>
 
 <t>Defines the destination MAC Address to match encoded as in BGP
 UPDATE messages <xref target="RFC4271"/>. Prefix length is in bits
 and the MAC Prefix is fill out with from 1 to 7 padding bits so that
 it is an integer number of octets. These padding bits are ignored for
 matching purposes.</t>

 </section>
 
 <section>
   <name>Type 4 - DSAP (Destination Service Access Point)</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t> 

 <t>Defines a list of {operation, value} pairs used to match the
 1-octet DSAP in the IEEE 802.2 LLC (Logical Link Control Header).
 Values are encoded as 1-octet quantities.  op is encoded as specified
 in Section 4.2.1.1 of <xref target="RFC8955"/>. The match fails if
 EtherType L2 header encoding is being used rather than LLC
 encoding.</t>

 </section>
 
 <section>
   <name>Type 5 - SSAP (Source Service Access Point)</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t>

 <t>Defines a list of {operation, value} pairs used to match the
 1-octet SSAP in the IEEE 802.2 LLC.  Values are encoded as 1-octet
 quantities. op is encoded as specified in Section 4.2.1.1 of <xref
 target="RFC8955"/>.  The match fails if EtherType L2 header encoding
 is being used rather than LLC encoding.</t>

 </section>
 
 <section>
   <name>Type 6 - Control field in LLC</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t>

 <t>Defines a list of {operation, value} pairs used to match the
 1-octet control field in the IEEE 802.2 LLC.  Values are encoded as
 1-octet quantities. op is encoded as specified in Section 4.2.1.1 of
 <xref target="RFC8955"/>.  The match fails if EtherType L2 header
 encoding is being used rather than LLC encoding.</t>

 </section>
 
 <section>
   <name>Type 7 - SNAP</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t>

 <t>Defines a list of {operation, value} pairs used to match 5-octet
 SNAP (Sub-Network Access Protocol) field.  Values are encoded as
 8-octet quantities with the zero padded SNAP left justified. op is
 encoded as specified in Section 4.2.1.1 of <xref
 target="RFC8955"/>. The match fails if EtherType L2 header encoding
 is being used rather than LLC encoding.</t>

</section>

 <section>
   <name>Type 8 - VLAN ID</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t> 

 <t>Defines a list of {operation, value} pairs used to match VLAN ID.
 Values are encoded as 2-octet quantities, where the four most
 significant bits are set to zero and ignored for matching and the 12
 least significant bits contain the VLAN value. op is encoded as
 specified in Section 4.2.1.1 of <xref target="RFC8955"/>.</t>

 <t>In the virtual local-area network (VLAN) stacking case, the VLAN ID
 is the outer VLAN ID.</t>

 </section>
 
 <section>
   <name>Type 9 - VLAN PCP</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t> 

 <t>Defines a list of {operation, value} pairs used to match 3-bit
 VLAN PCP (priority code point) fields <xref target="IEEE802.1Q"/>.
 Values are encoded using a single octet, where the five most
 significant bits are set to zero and ignored for matching and the
 three least significant bits contain the VLAN PCP value. op is
 encoded as specified in Section 4.2.1.1 of <xref
 target="RFC8955"/>.</t>

 <t>In the virtual local-area network (VLAN) stacking case, the VLAN
 PCP is part of the outer VLAN tag.</t>

 </section>
 
 <section>
   <name>Type 10 - Inner VLAN ID</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t> 

 <t>Defines a list of {operation, value} pairs used to match the inner
 VLAN ID for virtual local-area network (VLAN) stacking or Q-in-Q use.
 Values are encoded as 2-octet quantities, where the four most
 significant bits are set to zero and ignored for matching and the 12
 least significant bits contain the VLAN value. op is encoded as
 specified in Section 4.2.1.1 of <xref target="RFC8955"/>.</t>

 <t>In the single VLAN case, this component type MUST NOT be used. If
 it appears the match will fail.</t>
 
 </section>
 
 <section>
   <name>Type 11 - Inner VLAN PCP</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), [op,
 value]+&gt;</t> 

 <t>Defines a list of {operation, value} pairs used to match 3-bit
 inner VLAN PCP fields <xref target="IEEE802.1Q"/> for virtual
 local-area network (VLAN) stacking or Q-in-Q use.  Values are encoded
 using a single octet, where the five most significant bits are set to
 zero and ignored for matching and the three least significant bits
 contain the VLAN PCP value. op is encoded as specified in Section
 4.2.1.1 of <xref target="RFC8955"/>.</t>

 <t>In the single VLAN case, this component type MUST NOT be used. If
 it appears the match will fail.</t>

 </section>
 
 <section>
   <name>Type 12 - VLAN DEI</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), op (1
 octet)&gt;</t>

 <t>This type tests the DEI (Drop Eligible Indicator) bit in the VLAN
 tag. If op is zero, it matches if and only if the DEI bit is zero. If
 op is non-zero, it matches if and only if the DEI bit is one.</t>

 <t>In the virtual local-area network (VLAN) stacking case, the VLAN
 DEI is part of the outer VLAN tag.</t>

</section>

 <section>
   <name>Type 13 - Inner VLAN DEI</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), op (1
 octet)&gt;</t> 

 <t>This type tests the DEI bit in the inner VLAN tag. If op is zero,
 it matches if and only if the DEI bit is zero. If op is non-zero, it
 matches if and only if the DEI bit is one.</t>

 <t>In the single VLAN case, this component type MUST NOT be used. If
 it appears the match will fail.</t>

 </section>
 
 <section>
   <name>Type 14 - Source MAC Special Bits</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), op (1
 octet)&gt;</t>

 <t>This type tests the bottom nibble of the top octet of the Source
 MAC address. The two low order bits of that nibble have long been the
 local bit (0x2) and the group addressed bit (0x1). However, recent
 changes in IEEE 802 have divided the local address space into 4
 quadrants specified by the next two bits (0x4 and 0x8) <xref
 target="RFC7042bis"/>.  This flowspec component permits testing, for
 example, that a MAC is group addressed or is a local address in a
 particular quadrant. The encoding is as given in Section 4.2.1.2 of
 <xref target="RFC8955"/>.</t>

 </section>
 <section>
   <name>Type 15 - Destination MAC Special Bits</name>

 <t>Encoding: &lt;type (1 octet), length (1 octet), op (1
 octet)&gt;</t>

 <t>As discussed in Section 2.1.14 but for the Destination MAC Address
 special bits.</t>

 </section>
</section>

<section>
  <name>Order of Traffic Filtering Rules</name>

 <t>The existing rules in Section 5.1 of <xref target="RFC8955"/> and
 in <xref target="RFC8956"/> for the ordering of traffic filtering are
 extended as follows:</t>

 <t>L2 flowspecs (AFI = 6, 25) take precedence over L3 flowspecs (AFI
 = 1, 2). Between two L2 flowspecs, precedence of the L2 portion is
 determined as specified in this section after this paragraph. If the
 L2 flowspec L2 portions are the same and the L3-AFI is nonzero, then
 the L3 portions are compared as specified in <xref target="RFC8955"/>
 or <xref target="RFC8956"/>
 as appropriate. Note: if the L3-AFI fields are different between two
 L2 flowspecs, they will never match the same packet so it will not be
 necessary to prioritize two flowspecs with different L3-AFI
 values.</t>

 <t>The original definition for the order of traffic filtering rules
 can be reused for L2 with new consideration for the MAC Address
 offset.  As long as the offsets are equal, the comparison is the
 same, retaining longest-prefix-match semantics.  If the offsets are
 not equal, the lowest offset has precedence, as this flow matches the
 most significant bit.</t>

 <t>Pseudocode:</t>
 
      <artwork type="pseudocode" align="center">
        <![CDATA[
flow_rule_L2_cmp (a, b)
{
    comp1 = next_component(a);
    comp2 = next_component(b);
    while (comp1 || comp2) {
        // component_type returns infinity on end-of-list
        if (component_type(comp1) < component_type(comp2)) {
            return A_HAS_PRECEDENCE;
        }
        if (component_type(comp1) > component_type(comp2)) {
            return B_HAS_PRECEDENCE;
        }

        if (component_type(comp1) == MAC_DESTINATION || MAC_SOURCE) {
            common = MIN(MAC Address length (comp1),
                     MAC Address length (comp2));
            cmp = MAC Address compare(comp1, comp2, common);
            // not equal, lowest value has precedence
            // equal, longest match has precedence
        } else {
            common =
               MIN(component_length(comp1), component_length(comp2));
            cmp = memcmp(data(comp1), data(comp2), common);
            // not equal, lowest value has precedence
            // equal, longest string has precedence
        }
    }
    return EQUAL;
}
        ]]>
     </artwork>

</section>
</section>

<section>  <!-- 3. -->
  <name>L2VPN Flow Specification Encoding in BGP</name>

 <t>The NLRI format for AFI=25/SAFI=134 (L2VPN), as with the other VPN
 flowspec AFI/SAFI pairs, is the same as the non-VPN Flow-Spec but
 with the addition of a Route Distinguisher to identify the VPN to
 which the flowspec is to be applied.</t>

 <t>In addition, the IANA entry for SAFI 134 is slightly generalized
 as specified at the beginning of Section 6.</t>

 <t>The L2VPN NLRI format is as follows:</t>

<figure anchor="L2VPNNLRI">
  <name>Flow Specification NLRI for L2VPN</name>
    <artwork type="ascii-art" align="center">
      <![CDATA[
+-------------------------------+
| total-length (0xnn or 0xfnnn) |  2 or 3 octets
+-------------------------------+
|      Route Distinguisher      |  8 octets
+-------------------------------+
|            L3-AFI             |  2 octets
+-------------------------------+
|  L2-length (0xnn or 0xfnnn)   |  2 or 3 octets
+-------------------------------+
|           NLRI-value          |  variable
+-------------------------------+
      ]]>
   </artwork>
</figure>

 <t>The fields in Figure 2, other than the Route Distinguisher, are
 encoded as specified in Section 2 except that the minimum value for
 total-length is 12.</t>

 <t>Flow specification rules received via this NLRI apply only to
 traffic that belongs to the VPN instance(s) into which it is
 imported.  Flow rules are accepted as specified in Section 5.</t>

<section> <!-- 3.1 -->
  <name>Order of L2VPN Filtering Rules</name>

 <t>The order between L2VPN filtering rules is determined as specified
 in Section 2.2. Note that if the Route Distinguisher is different
 between two L2VPN filtering rules, they will never both match the
 same packet so they need not be prioritized.</t>

</section>
</section>

<section>  <!-- 4. -->
  <name>Ethernet Flow Specification Traffic Actions</name>

 <t>The default action for an L2 traffic filtering flowspec is to
 accept traffic that matches that particular rule.  The following
 extended community values per <xref target="RFC8955"/> can be used to
 specify particular actions in an L2 VPN network:</t>

 <table>
   <thead>
<tr><th align="center">type</th><th>extended community</th><th
align="center">encoding</th></tr> 
   </thead>
   <tbody>
<tr><td>0x8006</td><td>traffic-rate</td><td>2-octet as#, 4-octet
float</td></tr> 
<tr><td>0x8007</td><td>traffic-action</td><td>bitmask</td></tr>
<tr><td>0x8008</td><td>redirect</td><td>6-octet Route Target</td></tr>
<tr><td>0x8009</td><td>traffic-marking</td><td>DSCP value</td></tr>
   </tbody>
 </table>
 
 <t>Redirect: The action should be redefined to allow the traffic to
 be redirected to a MAC or IP VRF routing instance that lists the
 specified route-target in its import policy.</t>

 <t>Besides the above extended communities, this document also
 specifies the following BGP extended communities for Ethernet flows
 to extend <xref target="RFC8955"/>:</t>

 <table>
   <thead>
<tr><th align="center">type</th><th>extended community</th><th
align="center">encoding</th></tr> 
   </thead>
   <tbody>
<tr><td>TBD1</td><td>VLAN-action</td><td>bitmask</td></tr>
<tr><td>TBD2</td><td>TPID-action</td><td>bitmask</td></tr>
   </tbody>
 </table>


 <section> <!-- 4.1 -->
   <name>VLAN-action</name>

 <t>The VLAN-action extended community, as shown in the diagram below,
 consists of 6 octets that include action Flags, two VLAN IDs, and the
 associated PCP and DEI values.  The action Flags fields are further
 divided into two parts which correspond to the first action and the
 second action respectively. Bit 0 to bit 7 give the first action
 while bit 8 to bit 15 give the second action.  The bits of PO, PU,
 SW, RI and RO in each part represent the action of Pop, Push, Swap,
 Rewrite inner VLAN and Rewrite outer VLAN respectively.  Through this
 method, more complicated actions also can be represented in a single
 VLAN-action extended community, such as SwapPop, PushSwap, etc.  For
 example, SwapPop action is the sequence of two actions, the first
 action is Swap and the second action is Pop.</t>

  <artwork type="ascii-art" align="center">
    <![CDATA[
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|PO1|PU1|SW1|RI1|RO1| Resv      |PO2|PU2|SW2|RI2|RO2| Resv      |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| VLAN ID1                                      | PCP1      |DE1|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| VLAN ID2                                      | PCP2      |DE2|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
    ]]>
 </artwork>

 <dl>
   
<dt>PO1:</dt><dd>Pop action.  If the PO1 flag is one, it indicates the
outmost VLAN should be removed.</dd>

<dt>PU1:</dt><dd>Push action.  If PU1 is one, it indicates VLAN ID1
will be added, the associated PCP and DEI are PCP1 and DE1. </dd>

<dt>SW1:</dt><dd>Swap action.  If the SW1 flag is one, it indicates the
outer VLAN and inner VLAN should be swapped. </dd>

<dt>PO2:</dt><dd>Pop action.  If the PO2 flag is one, it indicates the
outmost VLAN should be removed. </dd>

<dt>PU2:</dt><dd>Push action.  If PU2 is one, it indicates VLAN ID2
will be added, the associated PCP and DEI are PCP2 and DE2. </dd>

<dt>SW2:</dt><dd>Swap action.  If the SW2 flag is one, it indicates the
outer VLAN and inner VLAN should be swapped. </dd>

<dt>RI1 and RI2:</dt><dd>Rewrite inner VLAN action.  If the RIx flag
is one (where "x" is "1" or "2"), it indicates the inner VLAN should
be replaced by a new VLAN where the new VLAN is VLAN IDx and the
associated PCP and DEI are PCPx and DEx.  If the VLAN IDx is 0, the
action is to only modify the PCP and DEI value of the inner VLAN.</dd>

<dt>RO1 and RO2:</dt><dd>Rewrite outer VLAN action.  If the ROx flag
is one (where "x" is "1" or "2"), it indicates the outer VLAN should
be replaced by a new VLAN where the new VLAN is VLAN IDx and the
associated PCP and DEI are PCPx and DEx.  If the VLAN IDx is 0, the
action is to only modify the PCP and DEI value of the outer VLAN.</dd>

<dt>Resv:</dt><dd>Reserved for future use.  MUST be sent as zero and
ignored on receipt.</dd>

 </dl>

<t>Giving an example below: if the action of PUSH Inner VLAN 10 with PCP
value 5 and DEI value 0 and PUSH Outer VLAN 20 with PCP value 6 and DEI
value 0 is needed, the format of the VLAN-action extended community is
as follows:</t>

  <artwork type="ascii-art" align="center">
    <![CDATA[
  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|0 |1 |0 |0 |0 |0 |0 |0 |0 |1 |0 |0 |0 |0 |0 |0 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| 10                                |1 |0 |1 |0 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| 20                                |1 |1 |0 |0 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    ]]>
 </artwork>

 </section>
 <section><!-- 4.2 -->
   <name>TPID-action</name>
 
 <t>The TPID-action extended community consists of 6 octets which
 includes the fields of action Flags, TP ID1 and TP ID2.</t>

  <artwork type="ascii-art" align="center">
    <![CDATA[
  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|TI|TO|                     Resv                |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    TP ID1                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    TP ID2                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    ]]>
  </artwork>

  <dl>

<dt>TI:</dt><dd>Mapping inner TP ID action.  If the TI flag is one, it
indicates the inner TP ID should be replaced by a new TP ID, the new
TP ID is TP ID1.</dd>

<dt>TO:</dt><dd>Mapping outer TP ID action.  If the TO flag is one, it
indicates the outer TP ID should be replaced by a new TP ID, the new
TP ID is TP ID2. </dd>

<dt>Resv:</dt><dd>Reserved for future use.  MUST be sent as zero and
ignored on receipt. </dd>

  </dl>

 </section>
</section>

<section>  <!-- 5. -->
  <name>Flow Spec Validation</name>

 <t>Flow Specifications received over AFI=25/SAFI=134 are validated
 against routing reachability received over AFI=25/SAFI=128 as
 modified to conform to <xref target="RFC9117"/>.</t>

</section>

<section>  <!-- 6. -->
  <name>IANA Considerations</name>

 <t>IANA is requested to change the description for SAFI 134 <xref
 target="RFC8955"/> to read as follows and to change the reference for
 it to [this document]:</t>

  <t indent="3">134&nbsp;&nbsp;VPN dissemination of flow specification
  rules</t>

 <t>IANA is requested to create an L2 Flow Specification Component
 Type registry on the Flow Spec Component Types registries web page as
 follows:</t>

  <artwork type="ascii-art" align="left">
    <![CDATA[
   Name:  L2 Flow Specification Component Types
   Reference: [this document]
   Registration Procedures:

            0  Reserved
        1-127  Specification Required
      128-255  First Come First Served
   ]]>
 </artwork>

 <t>Initial contents:</t>
 
<table>
  <thead>
<tr><th>type</th><th align="center">Reference</th><th
align="center">description</th></tr>
  </thead>
  <tbody>

<tr><td align="right">0</td><td>[this
document]</td><td>Reserved</td></tr>

<tr><td align="right">1</td><td>[this document]</td><td>Ethernet
Type</td></tr>

<tr><td align="right">2</td><td>[this document]</td><td> Source
MAC</td></tr>

<tr><td align="right">3</td><td>[this document]</td><td>Destination
MAC</td></tr>

<tr><td align="right">4</td><td>[this document]</td><td> DSAP in
LLC</td></tr>

<tr><td align="right">5</td><td>[this document]</td><td>SSAP in
LLC</td></tr>

<tr><td align="right">6</td><td>[this document]</td><td>Control field
in LLC</td></tr>

<tr><td align="right">7</td><td>[this document]</td><td>SNAP</td></tr>

<tr><td align="right">8</td><td>[this document]</td><td>VLAN
ID</td></tr>

<tr><td align="right">9</td><td> [this document]</td><td>VLAN
PCP</td></tr>

<tr><td align="right">10</td><td>[this document]</td><td>Inner VLAN
ID</td></tr>

<tr><td align="right">11</td><td>[this document]</td><td>Inner VLAN
PCP</td></tr>

<tr><td align="right">12</td><td>[this document]</td><td>VLAN
DEI</td></tr>

<tr><td align="right">13</td><td>[this document]</td><td> Inner VLAN
DEI </td></tr>

<tr><td align="right">14</td><td>[this document]</td><td>Source MAC
Special Bits</td></tr>

<tr><td align="right">15</td><td>[this document]</td><td>Destination
MAC Special Bits</td></tr>

<tr><td align="right">16-254</td><td>[this
document]</td><td>unassigned</td></tr>

<tr><td align="right">255</td><td>[this document]</td><td>Reserved
</td></tr>

  </tbody>
</table>

 <t>IANA is requested to assign two values from the "BGP Extended
 Communities Type - extended, transitive" registry [suggested value
 provided in square brackets]:</t>

<table>
  <thead>
<tr><th align="center">Type value</th><th align="center">Name</th><th
align="center">Reference</th></tr> 
  </thead>
  <tbody>
    
<tr><td>TBD1[0x080A]</td><td>Flow spec VLAN action</td><td>[this
document]</td></tr>

<tr><td>TBD2[0x080B]</td><td>Flow spec TPID action</td><td>[this
document]</td></tr>

  </tbody>
</table>

</section>

<section>  <!-- 7. -->
  <name>Security Considerations</name>

 <t>For General BGP Flow Specification Security Considerations, see
 <xref target="RFC8955"/>.</t>

 <t>VLAN tagging identifies Layer 2 communities which are commonly
 expected to be isolated except when higher layer connection is
 provided, such as Layer 3 routing. Thus, the ability of the flowspec
 VLAN action to change the VLAN ID in a frame might compromise
 security.</t>

</section>

</middle>

<!-- ____________________BACK_MATTER____________________ -->
<back>

<references>
  <name>Normative References</name>

<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.4271.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.4761.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.4762.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6074.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8174.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8955.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8956.xml"/>
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9117.xml"/>

</references>
 
<references>
  <name>Informative References</name>

 <reference anchor="IEEE802.1Q">
   <front>
     <title>IEEE Standard for Local and metropolitan area networks -
     Media Access Control (MAC) Bridges and Virtual Bridge Local Area
     Networks</title>
     <author>
       <organization>IEEE 802</organization>
     </author>
     <date year="2014" month="11" day="3"/>
   </front>
   <seriesInfo name="IEE Std" value="802.1Q-2014"/>
 </reference>

  <reference anchor="RFC7042bis"
	     target="https://www.ietf.org/archive/id/draft-intarea-rfc7042bis-02.txt">
    <front>
     <title>OUI Registry Restructuring</title>
     <author fullname="Donald Eastlake"
 	    initials="D."
 	    surname="Eastlake"/>
     <author fullname="Joe Abley"
 	    initials="J."
 	    surname="Abley"/>
     <author fullname="Yizhou Li"
 	    initials="Y."
 	    surname="Li"/>
     <date year="2023" month="April" day="14"/>
    </front>
    <seriesInfo name="work in" value="Progress"/>
  </reference>
  
<xi:include
    href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7432.xml"/>

</references>


<section anchor="Acknowledgements" numbered="false">
  <name>Acknowledgements</name>
  
 <t>The authors wish to acknowledge the important contributions and
suggestions of the following:</t>

 <t indent="3">Hannes Gredler, Xiaohu Xu, Zhenbin Li, Lucy Yong, and
 Feng Dong.</t>

</section>
    
    <section anchor="Contributors" numbered="false">
      <!-- a Contributors section is optional -->
      <name>Contributors</name>
      <contact fullname="Qiandeng Liang" initials="Q."
	       surname="Liang">
        <organization>Huawei Technologies</organization>
        <address>
        <postal>
         <street>101 Software Avenue, Yuhuatai District</street>
         <city>Nanjing</city>
         <region>Jiangsu</region>
         <code>210012</code>
         <country>China</country>
       </postal>        
            <email>liangqiandeng@huawei.com</email>
        </address>
      </contact>
    </section>
 
</back>

</rfc>
