<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" number="8665"
     docName="draft-ietf-ospf-segment-routing-extensions-27" category="std" submissionType="IETF" consensus="true" ipr="trust200902" obsoletes="" updates="" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3">
 
  <front>
    <title abbrev="OSPF Extensions for Segment Routing">OSPF Extensions for
    Segment Routing</title>
    <seriesInfo name="RFC" value="8665"/>
    <author fullname="Peter Psenak" initials="P." role="editor" surname="Psenak">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>Apollo Business Center</street>
          <street>Mlynske nivy 43</street>
          <city>Bratislava</city>
          <code>821 09</code>
          <country>Slovakia</country>
        </postal>
        <email>ppsenak@cisco.com</email>
      </address>
    </author>
    <author fullname="Stefano Previdi" initials="S." role="editor" surname="Previdi">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>Via Del Serafico, 200</street>
          <city>Rome</city>
          <code>00142</code>
          <country>Italy</country>
        </postal>
        <email>stefano@previdi.net</email>
      </address>
    </author>
    <author fullname="Clarence Filsfils" initials="C." surname="Filsfils">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street/>
          <city>Brussels</city>
          <region/>
          <code/>
          <country>Belgium</country>
        </postal>
        <email>cfilsfil@cisco.com</email>
      </address>
    </author>
    <author fullname="Hannes Gredler" initials="H." surname="Gredler">
      <organization>RtBrick Inc.</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country/>
        </postal>
        <email>hannes@rtbrick.com</email>
      </address>
    </author>
    <author fullname="Rob Shakir" initials="R." surname="Shakir">
      <organization>Google, Inc.</organization>
      <address>
        <postal>
          <street>1600 Amphitheatre Parkway</street>
          <city>Mountain View</city>
          <code>94043</code>
          <region>CA</region>
          <country>United States of America</country>
        </postal>
        <email>robjs@google.com</email>
      </address>
    </author>
    <author fullname="Wim Henderickx" initials="W." surname="Henderickx">
      <organization>Nokia</organization>
      <address>
        <postal>
          <street>Copernicuslaan 50</street>
          <city>Antwerp</city>
          <code>2018</code>
          <country>Belgium</country>
        </postal>
        <email>wim.henderickx@nokia.com</email>
      </address>
    </author>
    <author fullname="Jeff Tantsura" initials="J." surname="Tantsura">
      <organization>Apstra, Inc.</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country/>
        </postal>
        <email>jefftant.ietf@gmail.com</email>
      </address>
    </author>
    <date month="December" year="2019"/>
    <area>Routing</area>
    <workgroup>Open Shortest Path First IGP</workgroup>
    <keyword>MPLS</keyword>
    <keyword>SID</keyword>
    <keyword>IGP</keyword>
    <keyword>OSPF</keyword>
    <keyword>Label advertisement</keyword>
    <keyword>Segment Routing</keyword>
    <abstract>
      <t>Segment Routing (SR) allows a flexible definition of end-to-end
      paths within IGP topologies by encoding paths as sequences of
      topological subpaths called "segments". These segments are advertised
      by the link-state routing protocols (IS-IS and OSPF).</t>
      <t>This document describes the OSPFv2 extensions required for Segment Routing.</t>
    </abstract>
  </front>
  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>Segment Routing (SR) allows a flexible definition of end-to-end
      paths within IGP topologies by encoding paths as sequences of
      topological subpaths called "segments". These segments are advertised
      by the link-state routing protocols (IS-IS and OSPF). Prefix segments
      represent an ECMP-aware shortest path to a prefix (or a node), as per
      the state of the IGP topology. Adjacency segments represent a hop over a
      specific adjacency between two nodes in the IGP. A prefix segment is typically 
      a multi-hop path while an adjacency segment, in most cases, is a one-hop path. SR's 
      control plane can be applied to both IPv6 and MPLS data planes, and it
      does not require any additional signaling (other than IGP extensions).
      The IPv6 data plane is out of the scope of this specification; it is not applicable 
      to OSPFv2, which only supports the IPv4 address family. When used in MPLS
      networks, SR paths do not require any LDP or RSVP-TE signaling. However, SR can 
      interoperate in the presence of LSPs established with RSVP or LDP.</t>
      <t>There are additional segment types, e.g., Binding Segment Identifier (SID) defined in <xref target="RFC8402" format="default"/>.</t>
      <t>This document describes the OSPF extensions required for Segment Routing.</t>
      <t>Segment Routing architecture is described in <xref target="RFC8402" format="default"/>.</t>
      <t>Segment Routing use cases are described in <xref
      target="RFC7855" format="default"/>.</t>
      <section numbered="true" toc="default">
      <name>Requirements Language</name>
      <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/> 
    when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>
    </section>
 
    <section numbered="true" toc="default">
      <name>Segment Routing Identifiers</name>
      <t>Segment Routing defines various types of Segment Identifiers (SIDs):
      Prefix-SID, Adjacency SID, LAN Adjacency SID, and Binding SID.</t>
      <t>Extended Prefix/Link Opaque Link State Advertisements (LSAs) defined in <xref target="RFC7684" format="default"/> are used for 
      advertisements of the various SID types.</t>
      <section anchor="SIDLABEL" numbered="true" toc="default">
        <name>SID/Label Sub-TLV</name>
        <t>The SID/Label Sub-TLV appears in multiple TLVs or sub-TLVs defined
        later in this document. It is used to advertise the SID or label
        associated with a prefix or adjacency. The SID/Label Sub-TLV has the following
        format:</t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         SID/Label (variable)                  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>
	<t>where:</t><ul empty="true"><li>
        <dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>1</dd>
          <dt>Length:</dt>
          <dd>3 or 4 octets</dd>
          <dt>SID/Label:</dt>
          <dd><t>If the length is set to 3, then the 20 rightmost bits
            represent a label. If the length is set to 4, then the value represents
            a 32-bit SID.</t></dd>
        </dl></li></ul>
      </section>
    </section>
    <section anchor="SRCAP" numbered="true" toc="default">
      <name>Segment Routing Capabilities</name>
      <t>Segment Routing requires some additional router capabilities to be advertised 
      to other routers in the area.</t>
      <t>These SR capabilities are advertised in the Router Information Opaque LSA
      (defined in <xref target="RFC7770" format="default"/>). The TLVs defined below are applicable to 
       both OSPFv2 and OSPFv3; see also 
       <xref target="RFC8666" format="default"/>.</t>
       <section anchor="SRALGO" numbered="true" toc="default">


        <name>SR-Algorithm TLV</name>
        <t>The SR-Algorithm TLV is a top-level TLV of the Router Information Opaque LSA 
        (defined in <xref target="RFC7770" format="default"/>).</t>
        <t>The SR-Algorithm TLV is optional. It <bcp14>SHOULD</bcp14> only be advertised once
        in the Router Information Opaque LSA. If the SR-Algorithm TLV is not advertised 
        by the node, such a node is considered as not being Segment Routing capable.</t>
        <t> An SR Router can use various algorithms when calculating reachability
        to OSPF routers or prefixes in an OSPF area. Examples of these algorithms are 
        metric-based Shortest Path First (SPF), various flavors of Constrained SPF, etc.
        The SR-Algorithm TLV allows a router to advertise the algorithms currently used 
        by the router to other routers in an OSPF area. The SR-Algorithm TLV has 
        the following format: </t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Algorithm 1 | Algorithm...  |   Algorithm n |               |
+-                                                             -+
|                                                               |
+                                                               +
]]></artwork><t>where:</t><ul empty="true"><li>
        <dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>8</dd>
          <dt>Length:</dt>
          <dd>Variable, in octets, depending on the number of algorithms advertised</dd>
          <dt>Algorithm:</dt>
          <dd>
            <t>Single octet identifying the algorithm. The following 
            values are defined by this document:</t>
            <dl newline="false" spacing="normal" indent="6">
              <dt>0:</dt>
              <dd>Shortest Path First (SPF) algorithm based on link
              metric. This is the standard shortest path algorithm as computed
              by the OSPF protocol.  Consistent with the deployed practice for
              link-state protocols, Algorithm 0 permits any node to overwrite
              the SPF path with a different path based on its local policy. If
              the SR-Algorithm TLV is advertised, Algorithm 0
              <bcp14>MUST</bcp14> be included.</dd>
              <dt>1:</dt>
              <dd>Strict Shortest Path First (SPF) algorithm based on link metric. 
                The algorithm is identical to Algorithm 0, but Algorithm 1 requires  that 
                all nodes along the path will honor the SPF routing decision. Local policy
                at the node claiming support for Algorithm 1 <bcp14>MUST NOT</bcp14> alter the 
                SPF paths computed by Algorithm 1.</dd>
            </dl>
          </dd>
        </dl></li></ul>
        <t>When multiple SR-Algorithm TLVs are received from a given router,
        the receiver <bcp14>MUST</bcp14> use the first occurrence of the TLV in the Router
        Information Opaque LSA. If the SR-Algorithm TLV appears in multiple Router
        Information Opaque LSAs that have different flooding scopes, the SR-Algorithm
        TLV in the Router Information Opaque LSA with the area-scoped flooding scope
        <bcp14>MUST</bcp14> be used. If the SR-Algorithm TLV appears in multiple Router
        Information Opaque LSAs that have the same flooding scope, the SR-Algorithm
        TLV in the Router Information (RI) Opaque LSA with the numerically smallest
        Instance ID <bcp14>MUST</bcp14> be used and subsequent instances of the SR-Algorithm
        TLV <bcp14>MUST</bcp14> be ignored.</t>
        <t>The RI LSA can be advertised at any of the defined opaque flooding 
        scopes (link, area, or Autonomous System (AS)). For the purpose of 
        SR-Algorithm TLV advertisement, area-scoped flooding is <bcp14>REQUIRED</bcp14>.</t>
      </section>
      <section anchor="SIDRANGE" numbered="true" toc="default">
        <name>SID/Label Range TLV</name>
        <t>Prefix-SIDs <bcp14>MAY</bcp14> be advertised in the form of an index as described in 
        <xref target="PREFIXSID" format="default"/>. Such an index defines the offset in the SID/Label space 
        advertised by the router. The SID/Label Range TLV is used to advertise such SID/Label
        space.</t>
        <t>The SID/Label Range TLV is a top-level TLV of the Router Information 
        Opaque LSA (defined in <xref target="RFC7770" format="default"/>).</t>
        <t>The SID/Label Range TLV <bcp14>MAY</bcp14> appear multiple times and has the following
        format:</t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Range Size                 |   Reserved    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sub-TLVs (variable)                    |
+-                                                             -+
|                                                               |
+                                                               +]]></artwork>
        <t>where:</t>
       <ul empty="true"><li>
	<dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>9</dd>
          <dt>Length:</dt>
          <dd>Variable, in octets, depending on the sub-TLVs</dd>
          <dt>Range Size:</dt>
          <dd>3-octet SID/label range size (i.e., the number of SIDs or labels 
               in the range including the first SID/label). It <bcp14>MUST</bcp14> be greater than 0.</dd>
          <dt>Reserved:</dt>
          <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and <bcp14>MUST</bcp14> be ignored on reception</dd>
        </dl></li></ul>
        <t>Initially, the only supported sub-TLV is the SID/Label Sub-TLV as defined 
        in <xref target="SIDLABEL" format="default"/>. The SID/Label Sub-TLV <bcp14>MUST</bcp14> be included 
        in the SID/Label Range TLV. The SID/Label advertised in the SID/Label Sub-TLV 
        represents the first SID/Label in the advertised range. </t>
        <t>Only a single SID/Label Sub-TLV <bcp14>MAY</bcp14> be advertised in the SID/Label Range TLV. If more 
        than one SID/Label Sub-TLV is present, the SID/Label Range TLV <bcp14>MUST</bcp14> be ignored.</t>
        <t>Multiple occurrences of the SID/Label Range TLV <bcp14>MAY</bcp14> be
        advertised in order to advertise multiple ranges. In such a case:</t>
        <ul spacing="normal">
          <li>The originating router <bcp14>MUST</bcp14> encode each range into a different SID/Label 
            Range TLV. </li>
          <li>The originating router decides the order in which the set of SID/Label 
            Range TLVs are advertised inside the Router Information Opaque LSA. The 
            originating router <bcp14>MUST</bcp14> ensure the order is the same after a graceful restart 
            (using checkpointing, nonvolatile storage, or any other mechanism) in order 
            to ensure the SID/Label range and SID index correspondence is preserved 
            across graceful restarts.</li>
          <li> The receiving router <bcp14>MUST</bcp14> adhere to the order in which the ranges are 
            advertised when calculating a SID/Label from a SID index.</li>
          <li>The originating router <bcp14>MUST NOT</bcp14> advertise overlapping ranges.</li>
          <li>When a router receives multiple overlapping ranges, it <bcp14>MUST</bcp14> conform
               to the procedures defined in <xref target="RFC8660" format="default"/>.</li>
        </ul>
        <t>The following example illustrates the advertisement of multiple ranges.</t>
        
   <t>The originating router advertises the following ranges:</t>
   <artwork name="" type="" align="left" alt=""><![CDATA[
      Range 1: Range Size: 100   SID/Label Sub-TLV: 100
      Range 1: Range Size: 100   SID/Label Sub-TLV: 1000
      Range 1: Range Size: 100   SID/Label Sub-TLV: 500]]></artwork>
      
   <t>The receiving routers concatenate the ranges and build the Segment 
   Routing Global Block (SRGB) as follows:</t>
<artwork name="" type="" align="left" alt=""><![CDATA[ 
   SRGB = [100, 199]
          [1000, 1099]
          [500, 599]]]></artwork>

<t>The indexes span multiple ranges:</t>

<artwork name="" type="" align="left" alt=""><![CDATA[ 
      index 0 means label 100
      ...
      index 99 means label 199
      index 100 means label 1000
      index 199 means label 1099
      ...
      index 200 means label 500
      ...]]></artwork>
        <t>The RI LSA can be advertised at any of the defined flooding scopes
        (link, area, or autonomous system (AS)). For the purpose of  
        SID/Label Range TLV advertisement, area-scoped flooding is <bcp14>REQUIRED</bcp14>.</t>
      </section>
      <section anchor="SRLB" numbered="true" toc="default">
        <name>SR Local Block TLV</name>
        <t>The SR Local Block TLV (SRLB TLV) contains the range of labels the	
		node has reserved for Local SIDs. SIDs from the SRLB <bcp14>MAY</bcp14> be used for	
		Adjacency SIDs but also by components other than the OSPF protocol.  
		As an example, an application or a controller can instruct the router 
		to allocate a specific Local SID. Some controllers or applications can 
		use the control plane to discover the available set of Local SIDs on 
		a particular router. In such cases, the SRLB is advertised in the control plane.
		The requirement to advertise the SRLB is further described in 
		<xref target="RFC8660" format="default"/>.
		The SRLB TLV is used to advertise the SRLB.</t>
        <t>The SRLB TLV is a top-level TLV of the Router Information 
        Opaque LSA (defined in <xref target="RFC7770" format="default"/>).</t>
        <t>The SRLB TLV <bcp14>MAY</bcp14> appear multiple times in the Router Information
         Opaque LSA and has the following format:</t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Range Size                 |   Reserved    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sub-TLVs (variable)                    |
+-                                                             -+
|                                                               |
+                                                               +]]></artwork>
	<t>where:</t><ul empty="true"><li>
	<dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>14</dd>
          <dt>Length:</dt>
          <dd>Variable, in octets, depending on the sub-TLVs</dd>
          <dt>Range Size:</dt>
          <dd>3-octet SID/Label range size (i.e., the number of SIDs or labels 
               in the range including the first SID/Label). It <bcp14>MUST</bcp14> be greater than 0.</dd>
          <dt>Reserved:</dt>
          <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and <bcp14>MUST</bcp14> be ignored on reception</dd>
        </dl></li></ul>
        <t>Initially, the only supported sub-TLV is the SID/Label Sub-TLV as defined 
        in <xref target="SIDLABEL" format="default"/>. The SID/Label Sub-TLV <bcp14>MUST</bcp14> be included 
        in the SRLB TLV. The SID/Label advertised in the SID/Label Sub-TLV represents
        the first SID/Label in the advertised range.</t>
        <t>Only a single SID/Label Sub-TLV <bcp14>MAY</bcp14> be advertised in the SRLB TLV. If more 
        than one SID/Label Sub-TLV is present, the SRLB TLV <bcp14>MUST</bcp14> be ignored.</t>
        <t>The originating router <bcp14>MUST NOT</bcp14> advertise overlapping ranges.</t>
        <t>Each time a SID from the SRLB is allocated, it <bcp14>SHOULD</bcp14> also be reported to all
		components (e.g., controller or applications) in order for these components to 
		have an up-to-date view of the current SRLB allocation. This is required to avoid
		collisions between allocation instructions.</t>
        <t>Within the context of OSPF, the reporting of Local SIDs is done through 
		OSPF sub-TLVs, such as the Adjacency SID (<xref target="ADJSID" format="default"/>). However, 
		the reporting of allocated Local SIDs can also be done through other means 
		and protocols, which are outside the scope of this document.</t>
        <t>A router advertising the SRLB TLV <bcp14>MAY</bcp14> also have other label ranges, outside 
		of the SRLB, used for its local allocation purposes and not advertised in
		the SRLB TLV. For example, it is possible that an Adjacency SID is allocated using 
		a local label that is not part of the SRLB.</t>
        <t>The RI LSA can be advertised at any of the defined flooding scopes
        (link, area, or autonomous system (AS)). For the purpose of  
         SRLB TLV advertisement, area-scoped flooding is <bcp14>REQUIRED</bcp14>.</t>
      </section>
      <section anchor="SRMS-Pref" numbered="true" toc="default">
        <name>SRMS Preference TLV</name>
        <t>The Segment Routing Mapping Server Preference TLV (SRMS Preference TLV) is used to 
      advertise a preference associated with the node that acts as an SR Mapping Server.
      The role of an SRMS is described in <xref target="RFC8661" format="default"/>. 
      SRMS preference is defined in 
      <xref target="RFC8661" format="default"/>.</t>
        <t>The SRMS Preference TLV is a top-level TLV of the 
      Router Information Opaque LSA (defined in <xref target="RFC7770" format="default"/>).</t>
        <t>The SRMS Preference TLV <bcp14>MAY</bcp14> only be advertised
         once in the Router Information Opaque LSA and has the following format:</t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Preference    |                 Reserved                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>
        <t>where:</t><ul empty="true"><li><dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>15</dd>
          <dt>Length:</dt>
          <dd>4 octets</dd>
          <dt>Preference:</dt>
          <dd>1 octet, with an SRMS preference value from 0 to 255</dd>
          <dt>Reserved:</dt>
          <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and <bcp14>MUST</bcp14> be ignored on reception</dd>
        </dl></li></ul>
        <t>When multiple SRMS Preference TLVs are received from a given router, the receiver
    <bcp14>MUST</bcp14> use the first occurrence of the TLV in the Router
    Information Opaque LSA. If the
    SRMS Preference TLV appears in multiple Router Information Opaque LSAs that have different 
    flooding scopes, the SRMS Preference TLV in the Router Information Opaque LSA with the 
    narrowest flooding scope <bcp14>MUST</bcp14> be used. If the SRMS Preference TLV appears in 
    multiple Router Information Opaque LSAs that have the same flooding scope, the SRMS 
    Preference TLV in the Router Information Opaque LSA with the numerically smallest Instance ID
    <bcp14>MUST</bcp14> be used and subsequent instances of the SRMS Preference TLV <bcp14>MUST</bcp14> be ignored.</t>
        <t>The RI LSA can be advertised at any of the defined flooding scopes (link, area, 
	or autonomous system (AS)). For the purpose of the SRMS 
	Preference TLV advertisement, AS-scoped flooding <bcp14>SHOULD</bcp14> be used. This is because SRMS 
	servers can be located in a different area than consumers of the SRMS advertisements. 
	If the SRMS advertisements from the SRMS server are only used inside the SRMS server's 
	area, area-scoped flooding <bcp14>MAY</bcp14> be used.</t>
      </section>
    </section>

    <section anchor="PFXRANGE" numbered="true" toc="default">
      <name>OSPF Extended Prefix Range TLV</name>

      <t>In some cases, it is useful to advertise attributes for a range of
      prefixes.  The SR Mapping Server, which is described in <xref
      target="RFC8661" format="default"/>, is an example where we need a
      single advertisement to advertise SIDs for multiple prefixes from a
      contiguous address range.</t>

      <t>The OSPF Extended Prefix Range TLV, which is a top-level TLV of the
      Extended Prefix LSA described in <xref target="RFC7684"
      format="default"/> is defined for this purpose.</t>

      <t>Multiple OSPF Extended Prefix Range TLVs <bcp14>MAY</bcp14> be
      advertised in each OSPF Extended Prefix Opaque LSA, but all prefix
      ranges included in a single OSPF Extended Prefix Opaque LSA
      <bcp14>MUST</bcp14> have the same flooding scope. The OSPF Extended
      Prefix Range TLV has the following format:</t>

      <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Prefix Length |     AF        |         Range Size            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Flags       |                Reserved                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Address Prefix (variable)                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      Sub-TLVs (variable)                      |
+-                                                             -+
|                                                               |
]]></artwork>

<t>where:</t>   

<ul empty="true">
  <li>

    <dl newline="false" spacing="normal">
        <dt>Type:</dt>
        <dd>2</dd>
	
	<dt>Length:</dt>
        <dd>Variable, in octets, depending on the sub-TLVs</dd>

        <dt>Prefix Length:</dt>
        <dd>Length of prefix in bits</dd>

        <dt>AF:</dt>
        <dd>Address family for the prefix.  Currently, the only supported
        value is 0 for IPv4 unicast. The inclusion of address family in this
        TLV allows for future extension.</dd>

        <dt>Range Size:</dt>
        <dd>Represents the number of prefixes that are covered by the
        advertisement. The Range Size <bcp14>MUST NOT</bcp14> exceed the
        number of prefixes that could be satisfied by the Prefix Length
        without including the IPv4 multicast address range (224.0.0.0/3).</dd>

        <dt>Flags:</dt>
        <dd>
          <t>Single-octet field. The following flags are defined:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
     0  1  2  3  4  5  6  7 
   +--+--+--+--+--+--+--+--+
   |IA|  |  |  |  |  |  |  |
   +--+--+--+--+--+--+--+--+]]></artwork>
          <t>where:</t>

	  <ul empty="true">
	    <li>
	      <dl newline="false" spacing="normal">

		<dt>IA-Flag:</dt>
                <dd>
		  <t>Inter-Area Flag. If set, advertisement is of
                  inter-area type.  An Area Border Router (ABR) that is
                  advertising the OSPF Extended Prefix Range TLV between areas
                  <bcp14>MUST</bcp14> set this bit.
		  </t>
                  
		  <t>This bit is used to prevent redundant flooding of Prefix
		  Range TLVs between areas as follows:</t>
		  
		  <ul empty="true">
                    <li>
		      <t>
			An ABR only propagates an inter-area Prefix Range
			advertisement from the backbone area to connected
			nonbackbone areas if the advertisement is considered
			to be the best one. The following rules are used to
			select the best range from the set of advertisements
			for the same Prefix Range:</t>
                  
			<ul empty="true">
  			  <li>An ABR always prefers intra-area Prefix Range
			  advertisements over inter-area advertisements.</li>
  
			  <li>An ABR does not consider inter-area Prefix Range
			  advertisements coming from nonbackbone areas.</li>
  
			</ul>

		    </li>
		  </ul>

		</dd>
	      </dl>
	    </li>
	  </ul>
	</dd>
		
		<dt>Reserved:</dt>
		<dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and
		<bcp14>MUST</bcp14> be ignored on reception</dd>

		<dt>Address Prefix:</dt>
		<dd>For the address family IPv4 unicast, the prefix itself is
		encoded as a 32-bit value. The default route is represented by
		a prefix of length 0. Prefix encoding for other address
		families is beyond the scope of this specification.</dd>
	     </dl>
	   </li>
	 </ul>
    </section>

    <section anchor="PREFIXSID" numbered="true" toc="default">
      <name>Prefix-SID Sub-TLV</name>
      <t>The Prefix-SID Sub-TLV is a sub-TLV of the OSPF Extended Prefix TLV described 
      in <xref target="RFC7684" format="default"/> and the OSPF Extended Prefix Range
      TLV described in <xref target="PFXRANGE" format="default"/>. It <bcp14>MAY</bcp14> appear more than once in the 
      parent TLV and has the following format: </t>
      <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Flags    |   Reserved    |      MT-ID    |    Algorithm  | 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     SID/Index/Label (variable)                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>
      <t>where:</t>
      <ul empty="true">
	<li>
      <dl newline="false" spacing="normal">
        <dt>Type:</dt>
        <dd>2</dd>
        <dt>Length:</dt>
        <dd>7 or 8 octets, depending on the V-Flag</dd>
        <dt>Flags:</dt>
        <dd>
          <t>Single-octet field. The following flags are defined: </t>
          <artwork name="" type="" align="left" alt=""><![CDATA[                      
     0  1  2  3  4  5  6  7 
   +--+--+--+--+--+--+--+--+
   |  |NP|M |E |V |L |  |  |
   +--+--+--+--+--+--+--+--+]]></artwork>
          <t>where:</t>
	  <ul empty="true">
	    <li>
	  <dl newline="false" spacing="normal">
            <dt>NP-Flag:</dt>
            <dd>No-PHP (Penultimate Hop Popping) Flag. If set, then the
            penultimate hop <bcp14>MUST NOT</bcp14> pop the Prefix-SID before
            delivering packets to the node that advertised the
            Prefix-SID.</dd>
            <dt>M-Flag:</dt>
            <dd>Mapping Server Flag.  If set, the SID was advertised
                by an SR Mapping Server as described in 
                <xref target="RFC8661" format="default"/>.</dd>
            <dt>E-Flag:</dt>
            <dd>Explicit Null Flag. If set, any upstream neighbor of the
            Prefix-SID originator <bcp14>MUST</bcp14> replace the Prefix-SID
            with the Explicit NULL label (0 for IPv4) before forwarding the
            packet.</dd>
            <dt>V-Flag:</dt>
            <dd>Value/Index Flag. If set, then the Prefix-SID 
                carries an absolute value. If not set, then the Prefix-SID carries 
                an index.</dd>
            <dt>L-Flag:</dt>
            <dd>Local/Global Flag. If set, then the value/index 
                carried by the Prefix-SID has local significance. If not set, then
                the value/index carried by this sub-TLV has global significance.</dd>
            <dt>Other bits:</dt>
            <dd>Reserved. These <bcp14>MUST</bcp14> be zero when sent and are
            ignored when received.</dd>
          </dl>
	  </li>
	  </ul>
        </dd>

        <dt>Reserved:</dt>
        <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and
        <bcp14>MUST</bcp14> be ignored on reception</dd>

        <dt>MT-ID:</dt>
        <dd>Multi-Topology ID (as defined in <xref target="RFC4915"
        format="default"/>)</dd>

        <dt>Algorithm:</dt>
        <dd><t>Single octet identifying the algorithm the Prefix-SID is
        associated with as defined in <xref target="SRALGO"
        format="default"/></t>
        <t>A router receiving a Prefix-SID from a remote node and with an
        algorithm value that the remote node has not advertised in the
        SR-Algorithm TLV (<xref target="SRALGO" format="default"/>)
        <bcp14>MUST</bcp14> ignore the Prefix-SID Sub-TLV.</t>
	</dd>

        <dt>SID/Index/Label:</dt>
        <dd>
          <t>According to the V- and L-Flags, it contains:
          </t>
	  <ul empty="true">
            <li>V-Flag is set to 0 and L-Flag is set to 0: The SID/Index/Label
            field is a 4-octet index defining the offset in the SID/Label
            space advertised by this router.</li>
            <li>V-Flag is set to 1 and L-Flag is set to 1: The SID/Index/Label
            field is a 3-octet local label where the 20 rightmost bits are
            used for encoding the label value.</li>
            <li>All other combinations of V-Flag and L-Flag are invalid and
            any SID Advertisement received with an invalid setting for V- and L-Flags <bcp14>MUST</bcp14> be ignored.</li>
          </ul>
        </dd>
      </dl>
	</li>
      </ul>

      <t>If an OSPF router advertises multiple Prefix-SIDs for the same prefix,
        topology, and algorithm, all of them <bcp14>MUST</bcp14> be ignored.</t>
      <t>When calculating the outgoing label for the prefix, the router <bcp14>MUST</bcp14>
        take into account, as described below, the E-, NP-, and M-Flags advertised by the next-hop router if
        that router advertised the SID for the prefix.  This <bcp14>MUST</bcp14> be done
        regardless of whether the next-hop router contributes to the best path to the
        prefix.</t>
      <t>The NP-Flag (No-PHP) <bcp14>MUST</bcp14> be set and the E-Flag
      <bcp14>MUST</bcp14> be clear for Prefix-SIDs 
        allocated to inter-area prefixes that are originated by the ABR based on intra-area
        or inter-area reachability between areas unless the advertised prefix is directly
        attached to the ABR.</t>
      <t>The NP-Flag (No-PHP) <bcp14>MUST</bcp14> be set and the E-Flag
      <bcp14>MUST</bcp14> be clear for Prefix-SIDs 
        allocated to redistributed prefixes, unless the redistributed prefix is directly
        attached to the Autonomous System Boundary Router (ASBR).</t>



<t>If the NP-Flag is not set, then:
</t>
<ul empty="true">
<li>Any upstream neighbor of the Prefix-SID originator <bcp14>MUST</bcp14> pop
the Prefix-SID. This is equivalent to the penultimate hop-popping mechanism
used in the MPLS data plane.
</li>
<li>The received E-Flag is ignored.
</li>
</ul>

<t>If the NP-Flag is set and the E-Flag is not set, then:
</t>

<ul empty="true">
<li>Any upstream neighbor of the Prefix-SID originator <bcp14>MUST</bcp14>
keep the Prefix-SID on top of the stack. This is useful when the originator of
the Prefix-SID needs to stitch the incoming packet into a continuing MPLS LSP
to the final destination. This could occur at an ABR (prefix propagation from
one area to another) or at an  ASBR (prefix propagation from one
domain to another).
</li>
</ul>

<t>If both the NP-Flag and E-Flag are set, then: 
</t>

<ul empty="true">
<li>Any upstream neighbor of the Prefix-SID originator <bcp14>MUST</bcp14>
replace the Prefix-SID with an Explicit NULL label. This is useful, e.g., when
the originator of the Prefix-SID is the final destination for the related
prefix and the originator wishes to receive the packet with the original EXP
bits.
</li>
</ul>

      <t>When the M-Flag is set, the NP-Flag and the E-Flag <bcp14>MUST</bcp14> be ignored on reception.</t>
      <t>As the Mapping Server does not specify the originator of a prefix advertisement,
        it is not possible to determine PHP behavior solely based on the Mapping Server 
        Advertisement. However, PHP behavior <bcp14>SHOULD</bcp14> be done in the following cases:
      </t>
      <ul empty="true">
        <li>The Prefix is intra-area type and the downstream neighbor is the originator 
        	of the prefix.</li>
	<li>The Prefix is inter-area type and the downstream neighbor is an
	ABR, which is advertising prefix reachability and is also generating
	the Extended Prefix TLV with the A-Flag set for this prefix as
	described in <xref target="RFC7684" sectionFormat="of"
	section="2.1"/>.</li>

        <li> The Prefix is external type and the downstream neighbor is an ASBR,
        which is advertising prefix reachability and is also generating the
        Extended Prefix TLV with the A-Flag set for this prefix as described
        in <xref target="RFC7684" sectionFormat="of" section="2.1"/>.</li>
      </ul>

      <t>When a Prefix-SID is advertised in an Extended Prefix Range TLV, then
      the value advertised in the Prefix-SID Sub-TLV is interpreted as a
      starting SID/Label value.</t>

      <t>Example 1: If the following router addresses (loopback addresses)
        need to be mapped into the corresponding Prefix-SID indexes: </t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
          Router-A: 192.0.2.1/32, Prefix-SID: Index 1
          Router-B: 192.0.2.2/32, Prefix-SID: Index 2
          Router-C: 192.0.2.3/32, Prefix-SID: Index 3
          Router-D: 192.0.2.4/32, Prefix-SID: Index 4]]></artwork>
      <t>then the Prefix field in the Extended Prefix Range TLV would be set to
        192.0.2.1, Prefix Length would be set to 32, Range Size would be set to 4, and
        the Index value in the Prefix-SID Sub-TLV would be set to 1.</t>
      <t>Example 2: If the following prefixes need to be mapped into the
        corresponding Prefix-SID indexes: </t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
           192.0.2.0/30, Prefix-SID: Index 51
           192.0.2.4/30, Prefix-SID: Index 52
           192.0.2.8/30, Prefix-SID: Index 53
          192.0.2.12/30, Prefix-SID: Index 54
          192.0.2.16/30, Prefix-SID: Index 55
          192.0.2.20/30, Prefix-SID: Index 56
          192.0.2.24/30, Prefix-SID: Index 57]]></artwork>
      <t>then the Prefix field in the Extended Prefix Range TLV would be set to
        192.0.2.0, Prefix Length would be set to 30, Range Size would be 7, and 
        the Index value in the Prefix-SID Sub-TLV would be set to 51.</t>
    </section>

    <section anchor="ADJSID" numbered="true" toc="default">
      <name>Adjacency Segment Identifier (Adj-SID)</name>
      <t>An Adjacency Segment Identifier (Adj-SID) represents a router
      adjacency in Segment Routing.</t>
      <section anchor="ADJSIDSUBTLV" numbered="true" toc="default">
        <name>Adj-SID Sub-TLV</name>
        <t>Adj-SID is an optional sub-TLV of the Extended Link TLV defined in 
        <xref target="RFC7684" format="default"/>. It <bcp14>MAY</bcp14> appear multiple times
        in the Extended Link TLV. 
        
        The Adj-SID Sub-TLV has the following format: </t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Flags     |    Reserved   |   MT-ID       |  Weight       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   SID/Label/Index (variable)                  |
+---------------------------------------------------------------+]]></artwork>
       <t>where:</t> 

       <ul empty="true">
         <li>
	   <dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>2</dd>
          <dt>Length:</dt>
          <dd>7 or 8 octets, depending on the V-Flag</dd>
          <dt>Flags:</dt>
          <dd>
            <t>Single-octet field containing the following flags:</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[    
    0 1 2 3 4 5 6 7 
   +-+-+-+-+-+-+-+-+
   |B|V|L|G|P|     |
   +-+-+-+-+-+-+-+-+]]></artwork>
            <t>where:</t>
	    <ul empty="true">
	      <li>
		<dl newline="false" spacing="normal">
              <dt>B-Flag:</dt>
              <dd>Backup Flag. If set, the Adj-SID refers to an
                adjacency that is eligible for protection (e.g., using IP Fast
		Reroute or MPLS-FRR (MPLS-Fast Reroute)
                as described in <xref target="RFC8402"
		sectionFormat="of" section="2.1"/>.</dd>
              <dt>V-Flag:</dt>
              <dd>Value/Index Flag. If set, then the Adj-SID 
                carries an absolute value. If not set, then the Adj-SID carries 
                an index.</dd>
              <dt>L-Flag:</dt>
              <dd>Local/Global Flag. If set, then the value/index 
                carried by the Adj-SID has local significance. If not set, then
                the value/index carried by this sub-TLV has global significance.</dd>
              <dt>G-Flag:</dt>
              <dd>Group Flag. When set, the G-Flag indicates that the 
                Adj-SID refers to a group of adjacencies (and therefore <bcp14>MAY</bcp14> be assigned
                to other adjacencies as well).</dd>
              <dt>P-Flag:</dt>
              <dd>Persistent Flag. When set, the P-Flag indicates that	
			    the Adj-SID is persistently allocated, i.e., the Adj-SID value	
			    remains consistent across router restart and/or interface flap.</dd>
              <dt>Other bits:</dt>
              <dd>Reserved. These <bcp14>MUST</bcp14> be zero when sent and are ignored when
                received.</dd>
		</dl>
	      </li>
	    </ul>
	  </dd>

          <dt>Reserved:</dt>
          <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and <bcp14>MUST</bcp14> be ignored on reception</dd>
          <dt>MT-ID:</dt>
          <dd>Multi-Topology ID (as defined in <xref target="RFC4915" format="default"/></dd>
          <dt>Weight:</dt>
          <dd> Weight used for load-balancing purposes. The use of the
            weight is defined in <xref target="RFC8402" format="default"/>.</dd>
          <dt>SID/Index/Label:</dt>
          <dd>As described in <xref target="PREFIXSID" format="default"/></dd>
		</dl>
	 </li>
       </ul>

        <t>An SR-capable router <bcp14>MAY</bcp14> allocate an Adj-SID for each of its
        adjacencies and set the B-Flag when the adjacency is eligible for protection by 
        an FRR mechanism (IP or MPLS) as described in
	<xref target="RFC8402" sectionFormat="of" section="3.5"/>.</t>
        <t>An SR-capable router <bcp14>MAY</bcp14> allocate more than one Adj-SID to an adjacency.</t>
        <t>An SR-capable router <bcp14>MAY</bcp14> allocate the same Adj-SID to different adjacencies.</t>
        <t>When the P-Flag is not set, the Adj-SID <bcp14>MAY</bcp14> be persistent. When	
	    the P-Flag is set, the Adj-SID <bcp14>MUST</bcp14> be persistent.</t>
      </section>
      <section anchor="LANADJSIDSUBTLV" numbered="true" toc="default">
        <name>LAN Adj-SID Sub-TLV</name>
        <t>The LAN Adjacency SID is an optional sub-TLV of the Extended Link TLV defined in 
        <xref target="RFC7684" format="default"/>. It <bcp14>MAY</bcp14> appear multiple
        times in the Extended Link TLV. It is used to advertise a SID/Label for an adjacency 
        to a non-DR (Designated Router) router on a broadcast, Non-Broadcast Multi-Access (NBMA), or hybrid <xref target="RFC6845" format="default"/> network.
        </t>
        <artwork name="" type="" align="left" alt=""><![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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Flags     |    Reserved   |     MT-ID     |    Weight     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Neighbor ID                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    SID/Label/Index (variable)                 |
+---------------------------------------------------------------+]]></artwork>
        <t>where:</t><ul empty="true"><li><dl newline="false" spacing="normal">
          <dt>Type:</dt>
          <dd>3</dd>
          <dt>Length:</dt>
          <dd>11 or 12 octets, depending on the V-Flag</dd>
          <dt>Flags:</dt>
          <dd>Same as in <xref target="ADJSIDSUBTLV" format="default"/></dd>
          <dt>Reserved:</dt>
          <dd><bcp14>SHOULD</bcp14> be set to 0 on transmission and <bcp14>MUST</bcp14> be ignored on reception</dd>
          <dt>MT-ID:</dt>
          <dd>Multi-Topology ID (as defined in <xref target="RFC4915" format="default"/>)</dd>
          <dt>Weight:</dt>
          <dd>Weight used for load-balancing purposes. The use of the
            weight is defined in <xref target="RFC8402" format="default"/>.</dd>
          <dt>Neighbor ID:</dt>
          <dd>The Router ID of the neighbor for which the LAN Adjacency SID is 
            advertised</dd>
          <dt>SID/Index/Label:</dt>
          <dd><t>As described in <xref target="PREFIXSID" format="default"/></t>
	  </dd>          


        </dl></li></ul>
<t>When the P-Flag is not set, the LAN Adjacency SID <bcp14>MAY</bcp14> be persistent.  When
the P-Flag is set, the LAN Adjacency SID <bcp14>MUST</bcp14> be persistent.
</t>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>Elements of Procedure</name>
      <section numbered="true" toc="default">
        <name>Intra-area Segment Routing in OSPFv2</name>
        <t>An OSPFv2 router that supports Segment Routing <bcp14>MAY</bcp14> advertise Prefix-
        SIDs for any prefix to which it is advertising reachability (e.g.,
        a loopback IP address as described in <xref target="PREFIXSID" format="default"/>).</t>
        <t>A Prefix-SID can also be advertised by the SR Mapping Servers (as
        described in <xref target="RFC8661" format="default"/>). A Mapping
        Server advertises Prefix-SIDs for remote prefixes that exist in the
        OSPFv2 routing domain. Multiple Mapping Servers can advertise Prefix-SIDs 
        for the same prefix; in which case, the same Prefix-SID <bcp14>MUST</bcp14> be advertised by
        all of them. The flooding scope of the OSPF Extended Prefix Opaque LSA
        that is generated by the SR Mapping Server could be either area scoped
        or AS scoped and is determined based on the configuration of the 
        SR Mapping Server.</t>
        <t>An SR Mapping Server <bcp14>MUST</bcp14> use the OSPF Extended Prefix Range TLV when advertising SIDs
        for prefixes. Prefixes of different route types can be combined in a single OSPF 
        Extended Prefix Range TLV advertised by an SR Mapping Server. Because the OSPF 
        Extended Prefix Range TLV doesn't include a Route-Type field, as in the OSPF 
        Extended Prefix TLV, it is possible to include adjacent prefixes from different 
        route types in the OSPF Extended Prefix Range TLV.</t>
        <t>Area-scoped OSPF Extended Prefix Range TLVs are propagated between areas. Similar 
        to propagation of prefixes between areas, an ABR only propagates the OSPF Extended 
        Prefix Range TLV that it considers to be the best from the set it received. The 
        rules used to pick the best OSPF Extended Prefix Range TLV are described in 
        <xref target="PFXRANGE" format="default"/>.</t>

        <t>When propagating an OSPF Extended Prefix Range TLV between areas, ABRs <bcp14>MUST</bcp14> set the
        IA-Flag. This is used to prevent redundant flooding of the OSPF Extended 
        Prefix Range TLV between areas as described in <xref target="PFXRANGE" format="default"/>.</t>
      </section>
      <section numbered="true" toc="default">
        <name>Inter-area Segment Routing in OSPFv2</name>
        <t>In order to support SR in a multiarea environment, OSPFv2 <bcp14>MUST</bcp14>
        propagate Prefix-SID information between areas. The following
        procedure is used to propagate Prefix-SIDs between areas.</t>
        <t>When an OSPF ABR advertises a Type-3 Summary LSA from an intra-area
        prefix to all its connected areas, it will also originate an OSPF Extended
        Prefix Opaque LSA as described in <xref target="RFC7684" format="default"/>. 
        The flooding scope of the OSPF Extended Prefix Opaque LSA type will be set to
        area-local scope. The route type in the OSPF Extended Prefix TLV is set to
        inter-area. The Prefix-SID Sub-TLV will be included in this LSA and
        the Prefix-SID value will be set as follows: </t>
        <ul empty="true" spacing="normal">
         
          <li>The ABR will look at its best path to the prefix in the source
            area and find the advertising router associated with the best
            path to that prefix.</li>
        
          <li>The ABR will then determine if this router advertised a
            Prefix-SID for the prefix and use it when advertising the
            Prefix-SID to other connected areas.</li>
      
          <li>If no Prefix-SID was advertised for the prefix in the source
            area by the router that contributes to the best path to the
            prefix, the originating ABR will use the Prefix-SID advertised by any
            other router when propagating the Prefix-SID for the prefix to other areas.</li>
        </ul>
        <t>When an OSPF ABR advertises Type-3 Summary LSAs from an inter-area
        route to all its connected areas, it will also originate an OSPF Extended
        Prefix Opaque LSA as described in <xref target="RFC7684" format="default"/>. 
        The flooding scope of the OSPF Extended Prefix Opaque LSA type will be set to
        area-local scope. The route type in the OSPF Extended Prefix TLV is set to
        inter-area. The Prefix-SID Sub-TLV will be included in this LSA and
        the Prefix-SID will be set as follows: </t>
        <ul empty="true" spacing="normal">
         
          <li>The ABR will look at its best path to the prefix in the backbone
            area and find the advertising router associated with the best
            path to that prefix.</li>
       
          <li>The ABR will then determine if such a router advertised a
          Prefix-SID for the prefix and use it when advertising the Prefix-SID
          to other connected areas.</li>
        
          <li>If no Prefix-SID was advertised for the prefix in the backbone
            area by the ABR that contributes to the best path to the prefix,
            the originating ABR will use the Prefix-SID advertised by any
            other router when propagating the Prefix-SID for the prefix to other areas.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>Segment Routing for External Prefixes</name>
        <t>Type-5 LSAs are flooded domain wide. When an ASBR, which supports
        SR, generates Type-5 LSAs, it <bcp14>SHOULD</bcp14> also originate
        OSPF Extended Prefix Opaque LSAs as described in <xref
        target="RFC7684" format="default"/>.  The flooding scope of the
        OSPF Extended Prefix Opaque LSA type is set to AS-wide scope.  The route
        type in the OSPF Extended Prefix TLV is set to external. The
        Prefix-SID Sub-TLV is included in this LSA and the Prefix-SID value
        will be set to the SID that has been reserved for that prefix.</t>
        <t>When a Not-So-Stubby Area (NSSA) <xref target="RFC3101" format="default"/> ABR translates Type-7 LSAs into Type-5 
        LSAs, it <bcp14>SHOULD</bcp14> also advertise the Prefix-SID for the prefix. The NSSA ABR determines
        its best path to the prefix advertised in the translated Type-7 LSA
        and finds the advertising router associated with that path. If the
        advertising router has advertised a Prefix-SID for the prefix, then
        the NSSA ABR uses it when advertising the Prefix-SID for the Type-5
        prefix. Otherwise, the Prefix-SID advertised by any other router will
        be used.</t>
      </section>
      <section numbered="true" toc="default">
        <name>Advertisement of Adj-SID</name>
        <t>The Adjacency Segment Routing Identifier (Adj-SID) is advertised
        using the Adj-SID Sub-TLV as described in <xref target="ADJSID" format="default"/>.</t>
        <section numbered="true" toc="default">
          <name>Advertisement of Adj-SID on Point-to-Point Links</name>
          <t>An Adj-SID <bcp14>MAY</bcp14> be advertised for any adjacency on a point-to-point (P2P) link that is
          in neighbor state 2-Way or higher. If the adjacency on a P2P link
          transitions from the FULL state, then the Adj-SID for that adjacency
          <bcp14>MAY</bcp14> be removed from the area. If the adjacency transitions to a
          state lower than 2-Way, then the Adj-SID Advertisement <bcp14>MUST</bcp14> be withdrawn from the
          area.</t>
        </section>
        <section numbered="true" toc="default">
          <name>Adjacency SID on Broadcast or NBMA Interfaces</name>
          <t>Broadcast, NBMA, or hybrid <xref target="RFC6845" format="default"/> networks in OSPF are 
          represented by a star topology where the Designated Router (DR) is the central
          point to which all other routers on the broadcast, NBMA, or hybrid network connect.
          As a result, routers on the broadcast, NBMA, or hybrid network advertise only 
          their adjacency to the DR. Routers that do not act as DR do not form or 
          advertise adjacencies with each other. They do, however, maintain 2-Way adjacency
          state with each other and are directly reachable.</t>
          <t>When Segment Routing is used, each router on the broadcast, NBMA, or hybrid
           network <bcp14>MAY</bcp14> advertise the Adj-SID for its adjacency to the DR using
          the Adj-SID Sub-TLV as described in <xref target="ADJSIDSUBTLV" format="default"/>.</t>
          <t>SR-capable routers <bcp14>MAY</bcp14> also advertise a LAN Adjacency SID for other neighbors
          (e.g., Backup Designated Router, DR-OTHER, etc.) on the broadcast, NBMA, or hybrid network using the 
          LAN Adj-SID Sub-TLV as described in <xref target="LANADJSIDSUBTLV" format="default"/>.</t>
        </section>
      </section>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This specification updates several existing OSPF
      registries and creates a new IGP registry.</t>
      
      <section anchor="RITLVREG" numbered="true" toc="default">
        <name>OSPF Router Information (RI) TLVs Registry</name>
<t>The following values have been allocated:</t>

<table anchor="IANA1" align="left">  
  <name>OSPF Router Information (RI) TLVs</name>    
  <thead>
    <tr>
      <th>Value</th>    
      <th>TLV Name</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>8</td>
      <td>SR-Algorithm TLV</td>
      <td>This document</td>
  
    </tr>
    <tr>
      <td>9</td>
      <td>SID/Label Range TLV</td>
      <td>This document</td>
  
    </tr>
    <tr>
      <td>14</td>
      <td>SR Local Block TLV</td>
      <td>This document</td>

    </tr>
    <tr>
      <td>15</td>
      <td>SRMS Preference TLV</td>
      <td>This document</td>

    </tr>
  </tbody>
</table>

      </section>
      <section anchor="EPLTLVREG" numbered="true" toc="default">
        <name>OSPFv2 Extended Prefix Opaque LSA TLVs Registry</name>
        <t>The following values have been allocated:
        </t>



<table anchor="IANA2" align="left">  
  <name>OSPFv2 Extended Prefix Opaque LSA TLVs</name>    
  <thead>
    <tr>
      <th>Value</th>    
      <th>Description</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>2</td>
      <td>OSPF Extended Prefix Range TLV</td>
      <td>This document</td>
    </tr>
 
  </tbody>
</table>

      </section>
      <section anchor="EPLSTLVREG" numbered="true" toc="default">
        <name>OSPFv2 Extended Prefix TLV Sub-TLVs Registry</name>
        <t>The following values have been allocated:</t>



<table anchor="IANA3" align="left">  
  <name>OSPFv2 Extended Prefix TLV Sub-TLVs</name>    
  <thead>
    <tr>
      <th>Value</th>    
      <th>Description</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>1</td>
      <td>SID/Label Sub-TLV</td>
      <td>This document</td>
    </tr>
     <tr>
      <td>2</td>
      <td>Prefix-SID Sub-TLV</td>
      <td>This document</td>
    </tr>
  </tbody>
</table>


      </section>
      <section anchor="ELLSTLVREG" numbered="true" toc="default">
        <name>OSPFv2 Extended Link TLV Sub-TLVs Registry</name>
        <t>The following initial values have been allocated:</t>


<table anchor="IANA4" align="left">  
  <name>OSPFv2 Extended Link TLV Sub-TLVs</name>    
  <thead>
    <tr>
      <th>Value</th>    
      <th>Description</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>1</td>
      <td>SID/Label Sub-TLV</td>
      <td>This document</td>
    </tr>
     <tr>
      <td>2</td>
      <td>Adj-SID Sub-TLV</td>
      <td>This document</td>
     </tr>
          <tr>
      <td>3</td>
      <td>LAN Adj-SID/Label Sub-TLV</td>
      <td>This document</td>
    </tr>
  </tbody>
</table>
	
      </section>
      <section anchor="IGPALGOREG" numbered="true" toc="default">
        <name>IGP Algorithm Types Registry</name>
        <t>IANA has set up a subregistry called "IGP Algorithm Type" under the
       "Interior Gateway Protocol (IGP) Parameters" registry.
       The registration policy for this registry is "Standards Action" 
       (<xref target="RFC8126" format="default"/> and <xref target="RFC7120" format="default"/>).</t>
        <t>Values in this registry come from the range 0-255.</t>
        <t> The initial values in the IGP Algorithm Type registry are
	as follows:</t>
     

<table anchor="IANA5" align="left">  
  <name>IGP Algorithm Types</name>    
  <thead>
    <tr>
      <th>Value</th>    
      <th>Description</th>
      <th>Reference</th>
    </tr>
  </thead>
  <tbody>         
    <tr>
      <td>0</td>
      <td>Shortest Path First (SPF) algorithm based on link metric. This is 
                the standard shortest path algorithm as computed by the IGP protocol.  
                Consistent with the deployed practice for link-state protocols,  Algorithm 0 
                permits any node to overwrite the SPF path with a different path based on
                its local policy.</td>
      <td>This document</td>
    </tr>
     <tr>
      <td>1</td>
      <td>Strict Shortest Path First (SPF) algorithm based on link metric. 
                The algorithm is identical to Algorithm 0, but Algorithm 1 requires that 
                all nodes along the path will honor the SPF routing decision. Local policy
                at the node claiming support for Algorithm 1 <bcp14>MUST NOT</bcp14> alter the 
                SPF paths computed by Algorithm 1.</td>
      <td>This document</td>
     </tr>

  </tbody>
</table>


      </section>
    </section>
 
    <section anchor="Error-handling" numbered="true" toc="default">
<name>TLV/Sub-TLV Error Handling</name>
<t>For any new TLVs/sub-TLVs defined in this document, if the length is
invalid, the LSA in which it is advertised is considered malformed and <bcp14>MUST</bcp14> be
ignored. An error <bcp14>SHOULD</bcp14> be logged subject to rate limiting.
</t>
    </section>


    <section anchor="Security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>With the OSPFv2 Segment Routing extensions defined herein,
      OSPFv2 will now program the MPLS data plane <xref
      target="RFC3031" format="default"/> in addition to the IP
      data plane. Previously, LDP <xref target="RFC5036" format="default"/> or another label distribution
      mechanism was required to advertise MPLS labels and program the MPLS data plane.</t>
      <t>In general, the same types of attacks that can be carried out on the IP
      control plane can be carried out on the MPLS control plane resulting in traffic
      being misrouted in the respective data planes. However, the latter can be more
      difficult to detect and isolate.</t>
      <t>Existing security extensions as described in <xref target="RFC2328" format="default"/> and
       <xref target="RFC7684" format="default"/> apply to these Segment Routing extensions. While 
       OSPF is under a single administrative domain, there can be deployments where 
       potential attackers have access to one or more networks in the OSPF routing domain. 
       In these deployments, stronger authentication mechanisms such as those specified 
       in <xref target="RFC7474" format="default"/> <bcp14>SHOULD</bcp14> be used.</t>
      <t>Implementations <bcp14>MUST</bcp14> assure that malformed TLVs and sub-TLVs defined in this document 
       are detected and do not provide a vulnerability for attackers to crash the OSPFv2 
       router or routing process. Reception of malformed TLVs or sub-TLVs <bcp14>SHOULD</bcp14> be counted 
       and/or logged for further analysis. Logging of malformed TLVs and sub-TLVs <bcp14>SHOULD</bcp14>
       be rate limited to prevent a Denial of Service (DoS) attack (distributed or otherwise) 
       from overloading the OSPF control plane.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7770.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4915.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7684.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6845.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7120.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3101.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2328.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8402.xml"/>
        <!-- draft-ietf-spring-segment-routing-mpls-22: Companion Document -->

<reference anchor='RFC8660' target='https://www.rfc-editor.org/info/rfc8660'>
<front>
<title>Segment Routing with MPLS Data Plane</title>
<author initials='A' surname='Bashandy' fullname='Ahmed Bashandy' role='editor'>
    <organization />
</author>
<author initials='C' surname='Filsfils' fullname='Clarence Filsfils' role='editor'>
    <organization />
</author>
<author initials='S' surname='Previdi' fullname='Stefano Previdi'>
    <organization />
</author>
<author initials='B' surname='Decraene' fullname='Bruno Decraene'>
    <organization />
</author>
<author initials='S' surname='Litkowski' fullname='Stephane Litkowski'>
    <organization />
</author>
<author initials='R' surname='Shakir' fullname='Rob Shakir'>
    <organization />
</author>
<date month='December' year='2019' />
</front>
<seriesInfo name='RFC' value='8660' />
<seriesInfo name='DOI' value='10.17487/RFC8660' />
</reference>
       
        <!-- draft-ietf-spring-segment-routing-ldp-interop-15: companion document-->



<reference anchor='RFC8661' target="https://www.rfc-editor.org/info/rfc8661">
<front>
<title>Segment Routing Interworking with LDP</title>

<author initials='A' surname='Bashandy' fullname='Ahmed Bashandy' role="editor">
    <organization />
</author>

<author initials='C' surname='Filsfils' fullname='Clarence Filsfils' role="editor">
    <organization />
</author>

<author initials='S' surname='Previdi' fullname='Stefano Previdi'>
    <organization />
</author>

<author initials='B' surname='Decraene' fullname='Bruno Decraene'>
    <organization />
</author>

<author initials='S' surname='Litkowski' fullname='Stephane Litkowski'>
    <organization />
</author>

<date month='December'  year='2019' />
</front>
<seriesInfo name="RFC" value="8661"/>
<seriesInfo name="DOI" value="10.17487/RFC8661"/>
</reference>

	
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7855.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7474.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5036.xml"/>
	<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3031.xml"/>
	
        <!-- draft-ietf-ospf-ospfv3-segment-routing-extensions-23: Companion document -->

       

<reference anchor='RFC8666' target='https://www.rfc-editor.org/info/rfc8666'>
<front>
<title>OSPFv3 Extensions for Segment Routing</title>

<author initials='P' surname='Psenak' fullname='Peter Psenak' role="editor">
    <organization />
</author>

<author initials='S' surname='Previdi' fullname='Stefano Previdi' role="editor">
    <organization />
</author>

<date month='December' year='2019' />



</front>

<seriesInfo name='RFC' value='8666' />
<seriesInfo name="DOI" value="10.17487/RFC8666"/>

</reference>
       
      </references>
    </references>
    <section anchor="Acknowledgements" numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>We would like to thank Anton Smirnov for his contribution.</t>
      <t>Thanks to Acee Lindem for the detailed review of the document, corrections, 
       as well as discussion about details of the encoding.</t>
    </section>

    <section anchor="Contributors" numbered="false" toc="default">
      <name>Contributors</name>
      <t>The following people gave a substantial contribution to the content
      of this document: Acee Lindem, Ahmed Bashandy, Martin Horneffer, Bruno Decraene,
      Stephane Litkowski, Igor Milojevic, and Saku Ytti.</t>
    </section>

  </back>
</rfc>
