<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
    which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
    There has to be one entity for each item to be referenced.
    An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC7313 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7313.xml">
<!ENTITY RFC2918 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2918.xml">
<!ENTITY RFC5291 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5291.xml">
<!ENTITY RFC2119 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC4271 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4271.xml">
<!ENTITY RFC7606 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7606.xml">  
<!ENTITY RFC5492 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5492.xml">  
<!ENTITY RFC4684 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4684.xml">
<!ENTITY RFC7432 SYSTEM
  "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7432.xml">
<!ENTITY RFC7752 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.7752.xml">
<!ENTITY RFC1982 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.1982.xml">

]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
    please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that
    most I-Ds might want to use.
    (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space
    (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-idr-bgp-route-refresh-options-06"
ipr="pre5378Trust200902">
  <!-- category values: std, bcp, info, exp, and historic
    ipr values: full3667, noModification3667, noDerivatives3667
    you can add the attributes updates="NNNN" and obsoletes="NNNN"
    they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>

    <title abbrev="Extension to BGP's Route Refresh Message">
    Extension to BGP's Route Refresh Message</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Keyur Patel" initials="K"
            surname="Patel">

      <organization>Arrcus, Inc</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country>USA</country>
        </postal>

        <email>keyur@arrcus.com</email>

      </address>
    </author>


    <author fullname="Aamod Vyavaharkar" initials="A"
            surname="Vyavaharkar">

      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <street>821 Alder Drive</street>

          <city>Milpitas</city>

          <region>CA</region>

          <code>95035</code>

          <country>USA</country>
        </postal>

        <email>avyavaha@cisco.com</email>

      </address>
    </author>

    <author fullname="Niloofar Fazlollahi" initials="N"
            surname="Fazlollahi">

      <organization>Unaffiliated</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country>USA</country>
        </postal>

        <email>Niloofar_fazlollahi@yahoo.com</email>

      </address>
    </author>

    <author fullname="Tony Przygienda" initials="A"
            surname="Przygienda">

      <organization>Juniper Networks</organization>

      <address>
        <postal>
          <street>1194 N. Mathilda Ave</street>

          <city>Sunnyvale</city>

          <region>CA</region>

          <code>94089</code>

          <country>USA</country>
        </postal>

        <email>prz@juniper.net</email>

      </address>
    </author>

<author fullname="Krishnaswamy Ananthamurthy" initials="A"
            surname="Ananthamurthy">

      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <street>821 Alder Drive</street>

          <city>Milpitas</city>

          <region>CA</region>

          <code>95035</code>

          <country>USA</country>
        </postal>

        <email>kriswamy@cisco.com</email>

      </address>
    </author>

    <date year="2025" month="July" day="21"/>

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Network Working Group</workgroup>

    <keyword>IDR</keyword>

    <!-- Keywords will be incorporated into HTML output
        files in a meta tag but they have no effect on text or nroff
        output. If you submit your draft to the RFC Editor, the
        keywords will be used for the search engine. -->

<abstract>
<t>
[RFC2918] defines a route refresh capability to be exchanged between BGP speakers.
BGP speakers that support this capability are advertising that they can resend the entire
BGP Adj-RIB-Out on receipt of a refresh request. By supporting this capability,
BGP speakers are more flexible in applying any inbound routing policy changes as they no longer 
have to store received routes in their unchanged form or reset the session when
an inbound routing policy change occurs. The route refresh capability is advertised
per AFI, SAFI combination.
</t>

<t>
There are newer AFI, SAFI types that have been introduced to BGP that support a
variety of route types (e.g. IPv4/MVPN, L2VPN/EVPN). Currently, there is no way to 
request a subset of routes in a Route Refresh message for a given AFI, SAFI.
This draft defines route refresh capability extensions that help BGP speakers to
request a
subset of routes for a given address family. This is expected to reduce the amount
of update traffic being generated by route refresh requests as well as lessen
the burden
on the router servicing such requests.
</t>

</abstract>

  </front>

  <middle>

<section anchor="introduction" title="Introduction">
<t>
<xref target="RFC2918"/> defines a route refresh capability to be exchanged between BGP 
speakers. BGP speakers that support this capability are advertising that they can resend the entire
BGP Adj-RIB-Out on receipt of a refresh request. By supporting this capability,
BGP speakers are more flexible in applying inbound routing policy changes as they no longer 
have to store copies of received routes in their unchanged form or reset the session when
an inbound routing policy change occurs. The route refresh capability is advertised
per AFI, SAFI combination.
</t>

<t>
Route refresh allows routers to dynamically request a full Adj-RIB-Out update
from their peers when there's an inbound routing policy change. This is useful because
routers that mutually support this capability no longer have to flap the peering
session or store an extra copy of received routes in their original form. This helps 
by reducing memory requirements as well as eliminating the unnecessary churn caused by 
session flaps. <xref target="RFC2918"/> does not define a way for routers to request a subset of the
Adj-RIB-Out for a given AFI, SAFI.
</t>

<t>
This draft defines new extensions to route refresh that will allow requesting
routers to ask for a subset of the Adj-RIB-Out for a given AFI, SAFI combination. 
For example, routers could ask for specific route types from those address families
that support multiple route types or, they could ask for a specific prefix. 
</t>

<t>
As part of the new extensions, this draft combines elements of <xref target="RFC7313"/>
and <xref target="RFC5291"/> and adds a new set of options to the route refresh message
that will specify filters that can be applied to limit the scope of the refresh being 
requested. The new option format will apply to all new option types that may be defined 
moving forward.
</t>


<section title="Use Case Examples">

<t>
The authors acknowledge that while the extensions being proposed in this draft
could potentially be addressed by Route Target Constrain described in <xref target="RFC4684"/>
by using route targets to identify desired subset of routes, this proposal includes
address families where RT Constrain
extension is not
supported and avoids the necessity to assign and manage the route targets per
desired set of routes. The approach in this draft is intended to be a single-hop refresh
only, i.e., propagation of the
refreshes in a way similar to RT Constrain routes is NOT intended.

</t>

<t>
    Several possible use cases are discernible today:
    
    <list style="symbols">
        <t >The capacity
    to refresh routes of a certain type within an address family is needed,
    e.g., auto discovery routes within the EVPN AF <xref
        target="RFC7432"/>.</t>
        
        <t>In VPN scenarios where RT Constrain is not supported or configured,
        RDs can be used.</t>
        
        <t>In BGP LS <xref
            target="RFC7752"/> cases a speaker may choose to hold only a subset
            of routes and depending on configuration request a subset of
            routes. This document could provide further
            filters to support those
            use cases.
            </t>
        
        <t>On changes in inbound policy, when previously configured filters
            have been removed, only the according subset of routes may be
            requested.</t>
    </list>
</t>

</section> <!-- for Introductions section -->


</section>

      <section title="Requirements Language">
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref
        target="RFC2119">RFC 2119</xref>.</t>
      </section>

<section title="Route Refresh Options Capability">
<t>
A BGP speaker will use the BGP Capabilities Advertisement <xref target="RFC5492"></xref>
to advertise the Route Refresh Options Capability to its peers. This new capability will be
advertised using the Capability code [TBD] with a capability length of 0.
</t>
<t>
By advertising the Route Refresh Options Capability to a peer, a BGP speaker
indicates that it is capable of receiving and processing the route refresh options described 
below. This new capability can be advertised along with the Enhanced Route Refresh
Capability described in <xref target="RFC7313"></xref>. However, if the Route Refresh Options
Capability has been negotiated by both sides of the BGP session, then it will override the 
Enhanced Route Refresh Capability.
</t>
</section>

<section title="Route Refresh Sub-Types">
<t>
<xref target="RFC7313"></xref> defines route refresh BGP message sub-types that
utilize the "Reserved" field of the Route Refresh message originally defined in
<xref target="RFC2918"></xref>. Currently, there are three sub-types defined and this
draft proposes three additional sub-types which will be used to indicate a Route
Refresh message that includes options before any ORF field of the Route Refresh message
as well as BoRR and EoRR Route Refresh messages with options.
      <figure align="center">
        <artwork align="left"><![CDATA[
             0 - Normal route refresh request [RFC2918]
                 with/without Outbound Route Filtering (ORF) [RFC5291]
             1 - Demarcation of the beginning of a route refresh
                 (BoRR) operation
             2 - Demarcation of the ending of a route refresh
                 (EoRR) operation
           + 3 - Route Refresh request with options and optional
                 ORF [RFC5291]
           + 4 - BoRR with options
           + 5 - EoRR with options
           255 - Reserved
            ]]></artwork>
      </figure>
</t>
<t>
When the Route Refresh Options Capability has been negotiated by both sides of a BGP session,
both peers MUST use message types 3, 4 and 5. The requesting speaker MUST use the refresh ID for 
all refresh requests including those without any options, i.e., requests for the full BGP Adj-RIB-Out.
</t>
<t>
The Route Refresh Request Message with options will now be formatted
as shown below
</t>
      <figure align="center">
        <artwork align="left"><![CDATA[
      0               1               2               3
      0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |           A F I               |     Res.      |   S A F I     |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |    Total Option Length        |      Refresh ID#      | Flags |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                 One or more Route Refresh Options             |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

            ]]></artwork>
      </figure>
</section>

<section title="Route Refresh Option format">
<t>
  <xref target="RFC2918"></xref> defines the route refresh BGP message
  that includes only the AFI, SAFI of the routes being requested. This
  draft proposes extending the basic message by including options that
  will indicate to the remote BGP speaker that a subset of the entire Adj-RIB-Out
  is being requested. The remote BGP speaker will select routes that match the
  specified options and the flag settings.
</t>
<t>
  As described in the previous section, the options will be added to 
  the Route Refresh message before the ORF field of the message. Outbound Route Filtering is 
  described in <xref target="RFC5291"></xref>. The options will assume the
  following format
</t>
      <figure align="center">
        <artwork align="left"><![CDATA[
      0               1               2               3
      0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |      Length Of Options Field  |  Refresh ID#          | Flags |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |           One or more Route Refresh Options                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

            ]]></artwork>
      </figure>
</section>

<section title="Route Refresh Option Length">
<t>
The Option Length field will occupy the two octets immediately following the Route Refresh
message containing the AFI, SAFI and sub-type. The purpose of this field is to allow
the BGP speaker to calculate the length of any attached ORF fields by subtracting the
Option Length from the Route Refresh message length.
</t>
</section>

<section title="Route Refresh ID">
<t>
The Refresh ID field will occupy twelve bits following the Route Refresh
Options Length. It is infeasible to use a wide number like a 64-bit unsigned
integer since this number must be stored per route entry associated with any
peer supporting this feature, at least during the time any refresh is pending.
It is a value assigned by the requesting BGP
speaker. It MUST be a strictly monotonically increasing number per peer AFI and
SAFI using sequence number arithmetic based on two-complements given in
<xref target="arithmetic"/>. It is comparable to
the calculations standardized in <xref target="RFC1982"></xref> but fixes several
of its anomalies.
The purpose of this field is to allow the requesting BGP speaker to correlate
concurrent, overlapping refresh requests and ultimately delete correct stale routes.
The Refresh ID MUST be reflected in the BoRR
and EoRR messages sent by the BGP speaker servicing the refresh request.
</t>
<t>
A Refresh ID value MUST NOT be reused until an EoRR with this ID has been received
by the requesting speaker
or
the
last
resort
time
has
expired.
The behavior is unspecified otherwise. More specifically, defining the
interval [ LID, HID ] by the values
<figure align="center">
    <artwork align="left"><![CDATA[
LID = MAX(lowest requested Refresh ID# without BoRR,
          lowest received BoRR without EoRR)
    ]]></artwork>
</figure>
and
<figure align="center">
    <artwork align="left"><![CDATA[
HID = highest requested Refresh ID#
    ]]></artwork>
</figure>
the requesting speaker MUST only use values V where V &gt;: LID and V &gt;: HID as
defined by the relation given in <xref target="arithmetic"/>. Beside that,
HID =>: LID MUST hold by the same algebra.
</t>
<t>If no such number V exists, LID must catch up to HID, i.e. no further
    requests can be issued. To use a 3 bit example in <xref target="arithmetic"/>,
    if
    LID was 1 and HID was 4, we cannot progress to unsigned 5 since  1 ? 5.
    When LID progresses to unsigned 2 however, we have 5 &gt;: 2 and 5 &gt;: 4 and we
    can choose a V.
    </t>
<t>Value of 0 MUST NEVER be used as Refresh ID and is considered an "invalid" ID.
    </t>

<t>
    The sending speaker MUST NOT reorder the BoRR messages on sending
    in case it received multiple requests, i.e., the BoRRs MUST follow in the same sequence as
    the requested Route Refresh IDs.
    </t>

</section>

<section title="Route Refresh Option Flags">
<t>
    This draft defines several route refresh option flags:

<list style="symbols">
    <t>
	'O'-bit specifies whether the receiving BGP speaker MUST logically OR the attached options
	or logically AND them (in case of the bit being clear).
    When the flag is clear, the router on the receiving
	end SHOULD logically AND the options and only refresh routes that match all 
	received options. If the option flag is set, the router SHOULD select routes that 
	match using a logical OR of the options. In any case the set of routes sent
	between the according BoRR and EoRR MUST contain at least the logically
	requested set.
    </t>
    <t>
        'C' bit indicates that the receiving BGP speaker MUST clear immediately all the received Route Refresh Requests
        with Options, either pending or being processed. EoRRs MUST NOT be sent. The Refresh ID# on the request
 	MUST be set as the (in unsigned terms) next possible number L for which LID &gt;: L and HID &gt;: L per <xref target="arithmetic"/>
    or in other
    words we "wrap around the sequence number space" on reset.
	The C flag MUST NOT be set on BoRR or EoRR messages and CAN be used only with refresh requests.
    </t>
    <t>
        by 'S' bit indicate a refresh is being spontaneously originated by the
        BGP
        speaker which received requests and has them pending.
        The receiving BGP speaker MUST immediately clear all
        their pending Route Refresh requests with the sending peer.  The
        Refresh ID# on the request MUST be set as the the largest unsigned number L
        for which LID &gt;: L and HID &gt;: L.  When this flag is set, the receiving BGP
        speaker MUST use this sequence number for its next request. To use
        example from <xref target="arithmetic"/>, if the peer received LID 4 and
        HID 5 (i.e. it didn't send BoRR for 4 yet but received request for 5 already)
        it will reset the sequence number to 1 by those rules. Now, if there is
       a  request with 6 in flight, it will be seen as 1 &gt;: 6 when arriving.

    </t>
</list>
</t>

    
<t>The precise format is indicated below
      <figure align="center">
        <artwork align="left"><![CDATA[

             0 1 2 3 4 5 6 7
            +-+-+-+-+-+-+-+-+
            |  .... |C|O|S|R|
            +-+-+-+-+-+-+-+-+

            C    Clear pending requests and reset Refresh ID# space.

            O    Use logical OR of attached options

            S    Synchronize sequence numbers

            R    Reserved bit

            ]]></artwork>
      </figure>
</t>
</section>


<section title="Route Refresh Options">
<t>
This draft introduces new options carried within the Route Refresh message as shown
in the following figure
</t>
<t>
      <figure align="center">
        <artwork align="left"><![CDATA[
      0               1               2               3
      0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |   Type        |            Length             |     Value     |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                  Value (cont'd).                              |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

            ]]></artwork>
      </figure>
</t>
<t>
The option Type is a 1 octet field that uniquely identifies individual options. 
The Length is a 2 octet field that contains the length of the option Value
field in octets. The option Value is a variable length field that is interpreted 
according to the value of the option Type field.
</t>

<t>
The following types are being defined in this draft and additional types
can be defined subsequently as needed

      <figure align="center">
        <artwork align="left"><![CDATA[
+ 1 - Route Type
+ 2 - NLRI Prefix
+ 3 - Route Distinguisher Prefix
            ]]></artwork>
      </figure>
</t>
<t>
The Route Type option would specify a particular route type that is being requested.
This option applies specifically to those AFI/SAFI combinations that support multiple route
types, e.g. L2VPN/EVPN and MUST be otherwise ignored. The value field would be the route type
specifying which route type was being requested. The length of the option depends on the
AFI/SAFI.
</t>
<t>
The NLRI Prefix option would specify a request for all matching address prefixes with their lengths 
equal to or greater than the specified prefix per AFI/SAFI definitions. The value field would contain
the address prefix according to the NLRI specification of the AFI/SAFI contained in the Route Refresh 
message. For those AFI/SAFI combinations that specify NLRIs containing a type and/or RD, the value field
MUST exclude the type and RD and SHOULD only include any remaining NLRI fields. If the requesting speaker 
expects its peer to also match the type and/or RD, the speaker CAN include the type and RD prefix options 
accordingly. The length field would contain the length of the value field in bits.
</t>
<t>
The Route Distinguisher prefix option would specify an RD prefix that is being requested for AFs that 
support it. The receiving BGP speaker would then refresh all routes in the specified AFI/SAFI
that matched the requested RDs. The Value field would contain the RD, its length and the
mask length of the RD prefix. This option applies specifically to those AFI/SAFI combinations
that support route distinguishers and MUST be otherwise ignored.
</t>
</section>

<section anchor="Operation" title="Operation">
<t>
A BGP speaker that understands and supports Route Refresh Options SHOULD advertise the
Route Refresh Options Capability in its Open message. The following procedures for
route refresh are only applicable if the BGP speaker originating the route refresh has received
the route refresh options capability and supports it.
</t>
<t>
When originating a Route Refresh message, a BGP speaker SHOULD use and set these
options if it wants to restrict the scope of updates being refreshed. The specific
options being sent will be set according to the operator's command.
</t>

<t>
When a BGP speaker receives a route refresh message that includes any options, it MUST
parse the options and strongly SHOULD use them to filter outgoing NLRIs when refreshing
the Adj-RIB-Out to the requesting BGP speaker.
</t>
<t>
If a BGP speaker receives the route refresh message with the message subtype set to 
BoRR with options as described above, then it needs to process all the included
options and MUST mark all matching routes as stale as described in  <xref target="RFC7313"/>.
</t>
<t>
If a BGP speaker receives the route refresh message with the message subtype set to 
EoRR with options as described above, then it needs to process all the included
options and delete any remaining stale routes that match the options received with
the EoRR as described in <xref target="RFC7313"/>.
</t>
<t>
A BGP speaker responding to a route refresh request MUST set the message subtypes of the
BoRR and EoRR messages so that each BoRR message has a matching EoRR message. This means
a BoRR message without options SHOULD only be followed eventually by an EoRR message without
options. Similarly, a BoRR message with options MUST eventually be followed by an EoRR message
with the same options. If BoRR and EoRR message options do not match, the outcome is
unpredictable as remaining staled routes pending a refresh may get inadvertently deleted.
BGP speakers MUST NOT summarize EoRR messages by combining options in order to allow the
requesting BGP speaker to uniquely identify the included sets of routes when concurrent
refreshes are originated with overlapping sets of routes.
</t>
<t>
    Observe that overlapping refreshes with different options are possible and
    in such case the
    according BoRR and EoRR messages are associated by using their Refresh ID#.
    The BGP speaker responding to the route refresh requests MAY perform the
    refreshes in parallel. In case of concurrent
    refreshes overlapping same routes, the responding speaker MUST ensure
    that the sent advertisements
    will result in deletion of the omitted routes at the time all EoRRs have been
    received by the remote speaker or
    it MUST explicitly advertise withdrawals to correct any anomalies.</t>
<t>
The BGP speaker requesting a refresh from its peers SHOULD maintain a
locally configurable
upper bound on how long it will keep matching stale routes once a BoRR
has been received.
Each subsequent BoRR SHOULD reset this period so that any remaining
stale routes are only
flushed after the last BoRR has been received in case there are
multiple back-to-back
refreshes being sent out and the last matching EoRR is never received
or arrives too late.
This is an implementation specific detail.
</t>
<t>
A BGP speaker may spontaneously originate a refresh to one or more
of its peers depending on
operator intervention, or due to a policy or configuration change, etc.
In such a case, the
speaker MUST refresh the entire Adj-RIB-Out. The speaker MUST also send
BoRR/EoRR with the
options field with the 'S' flag set and a sequence number which lies
outside the range of the
sequence numbers that are currently in use with the receiving BGP speaker.
</t>
</section>

    <section anchor="Error" title="Error Handling">
    <t>
   The handling of malformed options MUST follow the procedures
   mentioned in  <xref target="RFC7606"/>. This draft obsoletes some of
   the error handling
   procedures in <xref target="RFC7313"/> if the Route Refresh Options
   Capability is sent.
   In addition, this draft mandates the following behavior at the 
   receiver of the route refresh request upon detection of:
</t>
<t>
           Length errors - If the message length minus the fixed-size message
           header is less than 4, the procedure in <xref target="RFC7313"/>
           MUST be followed. Also, if the overall length of all the options or
           any individual
	   option length exceeds the total number of remaining bytes, the same
	   procedure MUST be followed.
</t>
<t>
           Option type errors - Any unknown option type CAN be ignored for AND'ed
           options. In case of
       OR'ed options the receiving speaker MUST ignore all the options and de-facto
       treat it as a full AFI/SAFI Adj-RIB-Out refresh. Such event SHOULD
       be logged in either case to notify the operator.

       
</t>
<t>
           Option value errors - Length errors which cannot be distinguished
           from value
           field errors at the receiver are treated the same as value errors.
           The receiver MUST
           send a NOTIFICATION message with the Error Code "ROUTE-REFRESH
           Message Error"
           and the subcode of Invalid Message Length to the peer. The Data
           field of the NOTIFICATION
           message MUST contain the complete ROUTE-REFRESH message.
</t>
<t>
    BoRR with "unknown" or "invalid" Refresh ID# - The receiver MUST
    discard all pending requests and issue a Route Refresh Request with Options.
    The options MUST be empty and the clear flag MUST be set to resynchronize the
    RIBs. "Unknown" means here
    a BoRR which is not in the interval
    
    <!--
     -->
    <figure align="center">
        <artwork align="left"><![CDATA[
    [ MAX(lowest requested Refresh ID# without BoRR,
          highest received BoRR+1 respecting sequence number arithmetic),
      highest requested Refresh ID# ]
        ]]></artwork>
    </figure>
    
    
</t>
<t>
    EoRR with unknown Refresh ID# - Those SHOULD be ignored and a warning or error
        MUST be logged.
    </t>
<t>
    BoRR or EoRR with incorrect options - analogous to BoRR with
    unknown Refresh ID#.
    </t>
<t>EoRR with known Refresh ID# but without preceding BoRR - analogous to EoRR with
    unknown Refresh ID#. Observe that this can be caused by the peer expiring
    last resort timer and reusing the ID# for another request before the EoRR is
    received. This should be extremely unlikely given the size of the refresh ID
    space.
</t>
    
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
<t>
  This draft defines a new route refresh options format for BGP Route Refresh messages.
</t>
<t>
  This draft defines a new route refresh capability for BGP Route Refresh messages.
  We request IANA to record this capability to create a new registry under BGP Capability
  Codes as follows:

      <figure align="center">
        <artwork align="left"><![CDATA[
		+74	Route Refresh Options Capability
            ]]></artwork>
      </figure>
</t>
<t>
  This draft defines 3 new route refresh message subtypes for BGP Route Refresh messages.
  We request IANA to record these subtypes to create a new registry under BGP Route Refresh Subcodes
  as follows:
      <figure align="center">
        <artwork align="left"><![CDATA[
           + 3 - Route Refresh with options
           + 4 - BoRR with options
           + 5 - EoRR with options
            ]]></artwork>
      </figure>
</t>
    </section>

    <section anchor="Security" title="Security Considerations">
<t>
This extension to BGP does not change the underlying security issues
inherent in the existing <xref target="RFC7313"/> and <xref
target="RFC4271"/>.
</t>
    </section>

<section anchor="Acknowledgements" title="Acknowledgements">
<t>
The authors would like to thank Anant Utgikar for initial discussions resulting in this work.
John Scudder and Jeff Hass provided further comments.
</t>
</section>

  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>

    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
    1. define an ENTITY at the top, and use "ampersand character"RFC2629;
        here (as shown)
    2. simply use a PI
        "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds:
          include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

    Both are cited textually in the same manner: by using xref elements.
    If you use the PI option, xml2rfc will, by default, try to find included
    files in the same directory as the including file. You can also define
    the XML_LIBRARY environment variable
    with a value containing a set of directories to search.  These can be
    either in the local
    filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include=
      "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      
      &RFC1982;
      
      &RFC2918;

      &RFC7313;

      &RFC5291;

      &RFC5492;

      &RFC7606;

      &RFC4684;
    </references>

    <references title="Information References">
      &RFC4271;

      &RFC2119;
      
      &RFC7432;
      
      &RFC7752;

<reference anchor="Wikipedia">
    <front>
        <title>https://en.wikipedia.org/wiki/Serial_number_arithmetic</title>
        <author>
            <organization>Wikipedia</organization>
        </author>
        <date year="2016"></date>
    </front>
</reference>


    </references>


<section anchor="arithmetic" title="Sequence Number Binary Arithmetic">
    <t>The only reasonably reference to a cleaner than <xref target="RFC1982"></xref>
        sequence number solution is given in
        <xref target="Wikipedia"></xref>. It basically converts the problem
        into two complement's arithmetic.
        Assuming a straight two complement's substractions on the bit-width
        of the sequence number
        the according &gt;: and =:
        relations
        are defined as:
        </t>

<t>
<figure align="center">
    <artwork align="left"><![CDATA[
    U_1, U_2 are 12-bits aligned unsigned version number

    D_f is  ( U_1 - U_2 ) interpreted as two complement signed 12-bits
    D_b is  ( U_2 - U_1 ) interpreted as two complement signed 12-bits

    U_1 >: U_2 IIF D_f > 0 AND D_b < 0
    U_1 =: U_2 IIF D_f = 0
]]></artwork>
</figure>
</t>
    <t>
The &gt;: relationsship is symmetric but not transitive.
Observe that this leaves the case of the numbers having maximum two complement
distance, e.g. ( 0 and 0x800 ) undefined in our 12-bits case since D_f and D_b are
both -0x7ff.

    </t>
    <t>A simple example of the relationship in case of 3-bit arithmetic
        follows as table indicating D_f/D_b values and then the relationship of
        U_1 to U_2:
        </t>
<t>
<figure align="center">
    <artwork align="left"><![CDATA[
        U2 / U1   0    1    2    3    4    5    6    7
        0        +/+  +/-  +/-  +/-  -/-  -/+  -/+  -/+
        1        -/+  +/+  +/-  +/-  +/-  -/-  -/+  -/+
        2        -/+  -/+  +/+  +/-  +/-  +/-  -/-  -/+
        3        -/+  -/+  -/+  +/+  +/-  +/-  +/-  -/-
        4        -/-  -/+  -/+  -/+  +/+  +/-  +/-  +/-
        5        +/-  -/-  -/+  -/+  -/+  +/+  +/-  +/-
        6        +/-  +/-  -/-  -/+  -/+  -/+  +/+  +/-
        7        +/-  +/-  +/-  -/-  -/+  -/+  -/+  +/+
    ]]></artwork>
</figure>
</t>

<t>
    <figure align="center">
        <artwork align="left"><![CDATA[
       U2 / U1   0    1    2    3    4    5    6    7
       0         =    >    >    >    ?    <    <    <
       1         <    =    >    >    >    ?    <    <
       2         <    <    =    >    >    >    ?    <
       3         <    <    <    =    >    >    >    ?
       4         ?    <    <    <    =    >    >    >
       5         >    ?    <    <    <    =    >    >
       6         >    >    ?    <    <    <    =    >
       7         >    >    >    ?    <    <    <    =
        ]]></artwork>
    </figure>
</t>

</section>



    <!-- Change Log

v0.0 2016-05-13  AV    Initial version
v0.1 2016-05-25  AV    Incorporated comments from Keyur & Niloofar
v0.2 2016-06-06  AV    Added new subtypes for BoRR and EoRR with options. Expanded the Operation section.
                       Addressed comments from Keyur and Niloofar
v0.3 2016-06-08  AV    Incorporated Keyur's comments
v0.4 2016-06-18  AV    Incorporated comments from review meeting with Keyur, Niloofar & Tony
v0.5 2016-06-22  AV    Incorporated Tony's comments. Added Seq Nr and description. Removed exact prefix option
v0.6 2016-06-30  PRZ   Added use cases, polished edges. Added overlapping transactions. Renamed to ID#
v0.7 2016-07-03  FAZ   Removed mention of attributes from Introduction, minor spelling fixes and grammer simplifications,
 					   Corrected Fazlolahi to Fazlollahi.
v0.8 2016-07-05  PRZ   Removed RD as an option. Clarified Refresh ID usage and handling
v0.9 2016-07-07  AV    Added requirement for refresh ID in all requests, clarified use of C flag and prefix options
		       without RDs
v0.10 2016-07-07 FAZ   Minor modifications
v0.11 2016-07-08 AV    Added RD option back and clarified its use. Added explicit language to indicate Capability 74
		       will override Cap 70.
    -->
  </back>
</rfc>
