<?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 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 RFC4272 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4272.xml">
<!ENTITY RFC5492 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5492.xml">
<!ENTITY I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.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="no"?>
<!-- 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-ietf-idr-ext-opt-param-05" ipr="trust200902"
 updates="4271">
  <!-- 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>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="Extended Optional Parameters Length">Extended
      Optional Parameters Length for BGP OPEN Message</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Enke Chen" initials="E.C." 
            surname="Chen">
      <organization>Cisco Systems</organization>

      <address>
        <email>enkechen@cisco.com</email>
      </address>
    </author>

    <author fullname="John Scudder" initials="J.S." 
            surname="Scudder">
      <organization>Juniper Networks</organization>

      <address>
        <email>jgs@juniper.net</email>
      </address>
    </author>

    <date/>

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>IDR</keyword>
    <keyword>BGP</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>
The Optional Parameters in the BGP OPEN message as defined in the base
BGP specification are limited to 255 octets due to a one-octet length
field.  BGP Capabilities are carried in this field and may foreseeably
exceed 255 octets in the future, leading to concern about this
limitation.
      </t>
      <t>
In this document we update RFC 4271 by extending the BGP OPEN length field in a
backward-compatible manner.  The Parameter Length field of individual
Optional Parameters is similarly extended.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>
The Optional Parameters Length field in the BGP OPEN message is defined
in <xref target="RFC4271">the base BGP specification</xref> as one
octet, thus limiting the Optional Parameters field in the OPEN message
to 255 octets.  As BGP Capabilities <xref target="RFC5492"></xref> are
carried in the Optional Parameters field, and new BGP capabilities
continue to be introduced, the limitation is becoming a concern for BGP
development.
      </t>
      <t>
In this document we update <xref target="RFC4271"/> by extending the 
BGP OPEN length field in a
backward-compatible manner.  The Parameter Length field of individual
Optional Parameters is similarly extended.  This is done by using
Optional Parameters Length of 255 combined with Optional Parameter Type
255 as a distinguished value pair, which indicates that an extended
Optional Parameters Length field follows.  In this case the Parameter
Length field of the Optional Parameters in the BGP OPEN message is also
extended.
      </t>

      <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>

    <section title="Protocol Extensions">
      <t>
This document reserves Optional Parameter Type code 255 as the "Extended
Length" type code.
      </t>
      <t>
In the event that the length of Optional Parameters in the BGP OPEN
message does not exceed 255, the encodings of <xref target="RFC4271">the
base BGP specification</xref> MUST be used without alteration.
      </t>
      <t>
However, if the length of Optional Parameters is greater than 255, an
extended encoding is used. The (non-extended) length field is set to 
255, as is the subsequent octet that in the non-extended format would
be the first Optional Parameter Type. The subsequent two octets carry 
the actual length.  In
addition, the "Parameter Length" field of each Optional Parameter is
enlarged to two octets.  Other than the larger sizes of the given
fields, there is no change to the BGP OPEN message defined in <xref
target="RFC4271"></xref>.
	  </t>
      <t>
When receiving an OPEN, a BGP speaker determines the extended encoding
is in use if the first Optional Parameter Type field is 255. In this
case, the BGP speaker MUST ignore the non-extended Optional Parameters
Length field, and must instead rely on the Extended Optional Parameters
Length field.
      </t>
<!--      <t>
However, if the length of Optional Parameters in the BGP OPEN
message is greater than 255, this extended length is encoded as follows:
      </t>
      <t><list style="symbols">
        <t>
      The Optional Parameter Length field (as defined in <xref
      target="RFC4271"></xref>) is set to 255.
        </t>
        <t>
      The octet following this field (which would normally be 
      the type code of the first Optional Parameter, under the 
      usual encoding) is also set to 255.
        </t>
        <t>
      The two subsequent octets comprise the Extended Optional 
      Parameter Length field, a two-octet unsigned integer whose
      value gives the actual length of Optional Parameters.
        </t>
      </list></t> -->
      <t>
Accordingly, when the length of Optional Parameters in the BGP OPEN
message is greater than 255, the OPEN message format is modified as
follows, repurposing the Optional Parameters Length field as well as
the first Optional Parameter Type field to indicate the use of the extended 
format:
      </t>
      <figure>
        <artwork><![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
       +-+-+-+-+-+-+-+-+
       |    Version    |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     My Autonomous System      |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |           Hold Time           |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                         BGP Identifier                        |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |Non-Ext OP Len.|Non-Ext OP Type|  Extended Opt. Parm. Length   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       |             Optional Parameters (variable)                    |
       |                                                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>
      <t>
The non-extended Optional Parameters Length field MUST be set to 255 on 
transmission, and MUST be ignored on receipt once the use of the
extended format is determined.
	  </t>
	  <t>
The subsequent one-octet field, that in the non-extended format
would be the first Optional Parameter Type field, MUST be set to 255
on transmission. On receipt, a value of 255 for this field is the
indication that the extended format is in use.
      </t>
      <t>
In this extended encoding, the subsequent two-octet field, termed
the Extended Optional Parameters Length field, is an unsigned
integer indicating the total length of the Optional Parameters field
in octets.  If the value of this field is zero, no Optional
Parameters are present (this would never be expected to happen with
the extended encoding, however).
	  </t>
      <t>
Likewise, in that situation the Optional Parameters encoding is modified
to be the following:
      </t>
      <figure>
        <artwork><![CDATA[
    0                   1                   2
    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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Parm. Type   |        Parameter Length       |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    ~            Parameter Value (variable)         ~
    |                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>
      <t>
The rules for encoding Optional Parameters are unchanged with respect
to those given in <xref target="RFC4271"/> other than the extension
of the Parameter Length field to be a two-octet unsigned integer.
      </t>
      <t>
In parsing an OPEN message, a BGP speaker MUST use the value of the
one-octet "Optional Parameters Length" field and the value of the octet
following it to determine the encoding of the Optional Parameters
length, as well as the size of the "Parameter Length" field of the
Optional Parameters.  If both values are 255, then the four-octet
encoding described above is used for the Optional Parameters length. 
Otherwise the encoding defined in <xref target="RFC4271"></xref> is
used.
      </t>
      <t>
This encoding is chosen for backward compatibility reasons -- a BGP
speaker which has not been upgraded to support this specification may
legitimately send Optional Parameters whose length equals exactly 255, 
thus the Optional Parameters Length field alone is insufficient as an 
indicator.  However, such a speaker would never legitimately send an
Optional Parameter whose type code is 255, since that value has been
reserved by this specification.
      </t>
    </section>
    
    <section title="Errors">
      <t>
If a BGP speaker supporting this specification (a "new speaker") is
peering with one which does not (an "old speaker") no interoperability
issues arise unless the new speaker needs to encode Optional Parameters
whose length exceeds 255.  In that case, it will transmit an OPEN
message which the old speaker will interpret as containing an Optional
Parameter with type code 255.  Since by definition the old speaker will
not recognize that type code, the old speaker may be expected to close
the connection with a NOTIFICATION with an Error Code of OPEN Message
Error and an Error Subcode of Unsupported Optional Parameters, according
to Section 6.2 of <xref target="RFC4271"></xref>.
      </t>
      <t>
Although the above is the most likely error to be sent, it is not
impossible that the old speaker might detect some other error first,
such as a length error, depending on the details of the implementation. 
In no case would the peering be expected to establish successfully; the
only question is which NOTIFICATION would be generated.
      </t>
      <t>
We note that in any case, such a peering could not succeed, since 
by definition the extended length encoding would not be used by the
new speaker unless the basic encoding was insufficient.
      </t>
      <t>
Although the Optional Parameter Type code 255 is used in this 
specification as the indication that the extended encoding is in
use, it is not a bonafide Optional Parameter Type in the usual sense,
and MUST NOT be used other than as described above. If encountered
as an actual Optional Parameter Type code, it MUST be treated as 
an unrecognized Optional Parameter and handled according to 
<xref target="RFC4271"/> Section 6.2.
	  </t>
    </section>
    
    <section title="IANA Considerations">
      <t>
IANA is requested to designate BGP OPEN Optional Parameter Type code 255
as the Extended Length type code.
      </t>
    </section>
    
    <section title="Security Considerations">
      <t>
This extension to BGP does not change the underlying security issues
inherent in the existing BGP <xref target="RFC4272"/>.
      </t>
    </section>
    
    <section title="Acknowledgements">
      <t>
The authors would like to thank Yakov Rekhter and Srihari Sangli
for discussing various options to enlarge the Optional Parameters field.
We would also like to thank Matthew Bocci, Jakob Heitz, Pradosh Mohapatra, Keyur Patel and Hannes
Gredler for their valuable comments.
      </t>
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC4271;
    </references>

    <references title="Informative References">
      &RFC5492;
      &RFC4272;
    </references>
  </back>
</rfc>
