<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" []>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<?rfc tocdepth="2"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="no" ?>
<rfc category="exp" docName="draft-chroboczek-babel-extension-mechanism-02"
     ipr="trust200902" updates="6126">
<front>
<title abbrev="Babel Extension Mechanism">Extension Mechanism for the Babel Routing Protocol</title>
<author fullname="Juliusz Chroboczek" initials="J." surname="Chroboczek">
<organization>PPS, University of Paris-Diderot</organization>
<address>
<postal>
<street>Case 7014</street>
<city>75205 Paris Cedex 13</city>
<region></region>
<code></code>
<country>France</country>
</postal>
<email>jch@pps.univ-paris-diderot.fr</email>
</address>
</author>

<date day="21" month="November" year="2014"/>

<abstract><t>This document defines the encoding of extensions to the
Babel routing protocol <xref target="RFC6126"/>.</t>
</abstract>

</front>

<middle>

<section title="Extending the Babel routing protocol">

<t>A Babel packet <xref target="RFC6126"/> contains a header followed by
a sequence of TLVs, each of which is a sequence of octets having an
explicit type and length.  The original Babel protocol has the following
provisions for including extension data:</t>
<t>
<list style="symbols">
<t>a Babel packet with a version number different from 2 MUST be
silently ignored (<xref target="RFC6126"/>, Section 4.2);</t>
<t>an unknown TLV MUST be silently ignored (<xref target="RFC6126"/>,
Section 4.3);</t>
<t>except for Pad1 and PadN, all TLVs are self-terminating, and any extra
data included in a TLV MUST be silently ignored (<xref target="RFC6126"/>,
Section 4.2);</t>
<t>the Flags field of the Update TLV contains 6 undefined bits that
MUST be silently ignored (<xref target="RFC6126"/>, Section 4.4.9);</t>
<t>any data following the last TLV of a Babel packet MUST be silently
ignored (<xref target="RFC6126"/>, Section 4.2).</t>
</list></t>

<t>Each of these provisions provides a place to store data needed by
extensions of the Babel protocol.  However, in the absence of any further
conventions, independently developed extensions to the Babel protocol
might make conflicting uses of the available space, and therefore lead to
implementations that would fail to interoperate.  This document formalises
a set of rules for extending the Babel protocol that are designed to
ensure that no such incompatibilities arise, and that are currently
respected by a number of deployed extensions.</t>

<t>In the rest of this document, we call "original protocol" the protocol
defined in <xref target="RFC6126"/>, and "extended protocol" any extension
of the Babel protocol that follows the rules set out in this document.</t>

</section>

<section title="Mechanisms for extending the Babel protocol">

<t>This section describes each of the mechanisms available for extending
the Babel protocol.</t>

<section title="New versions of the Babel protocol">

<t>The header of a Babel packet contains an eight-bit protocol
version.  The currently deployed version of Babel is version 2; any
packets containing a version number different from 2 MUST be silently
ignored.</t>

<t>Versions 0 and 1 were experimental versions of the Babel protocol that
have seen some modest deployment; these version numbers SHOULD NOT be
reused by future versions of the Babel protocol.  Version numbers larger
than 2 might be used by a future incompatible protocol.</t>

</section>

<section title="New TLVs">

<t>An extension may carry its data in a new TLV type.  Such new TLVs
will be silently ignored by implementations of the original Babel
protocol, as well as by other extended implementations of the Babel
protocol, as long as the TLV types do not collide.</t>

<t>All new TLVs MUST have the format defined in <xref target="RFC6126"/>,
Section 4.3.  New TLVs SHOULD be self-terminating, in the sense defined in
the next section, and any data found after the main data section of the
TLV SHOULD be treated as a series of sub-TLVs.</t>

</section>

<section title="Sub-TLVs">

<t>With the exception of the Pad1 TLV, all Babel TLVs carry an explicit
length.  With the exception of Pad1 and PadN, all TLVs defined by the
original protocol are self-terminating, in the sense that the length of
the meaningful data that they contain (the "natural length") can be
determined without reference to the explicitly encoded length.  In some
cases, the natural length is trivial to determine: for example, a HELLO
TLV always has a natural length of 2 (4 including the Type and Length
fields).  In other cases, determining the natural length is not that easy,
but needs to be done in any case by an implementation that interprets the
given TLV: for example, the natural length of an Update TLV depends on
both the prefix length and the amount of prefix compression being
performed.</t>

<t>If the explicit length of a TLV defined by the original protocol is
larger than its natural length, the extra space present in the TLV is
silently ignored by an implementation of the original protocol; extended
implementations MAY use it to store arbitrary data, and SHOULD structure
the additional data as a sequence of sub-TLVs.  Unlike TLVs, the sub-TLVs
themselves need not be self-terminating.</t>

<t>An extension MAY be assigned one or more sub-TLV types.  Sub-TLV types
are assigned independently from TLV types: the same numeric type can be
assigned to a TLV and a sub-TLV.  Sub-TLV types are assigned globally:
once an extension is assigned a given sub-TLV number, it MAY use this
number within any TLV; however, the interpretation of a given sub-TLV type
can depend on which particular TLV it is embedded within.</t>

<t>The format of sub-TLVs is defined in <xref target="sub-tlvs"/>
below.</t>

</section>

<section title="The Flags field">

<t>The Flags field is an eight-bit field in the Update TLV.  Bits with
values 80 and 40 hexadecimal are defined by the original protocol, and
MUST be recognised and used by every implementation.  The remaining
six bits are not currently used, and are silently ignored by existing
implementations.</t>

<t>Due to the small size of the Flags field, extensions to the Babel
protocol SHOULD NOT use the six unused bits of the Flags field, and no
registry of flag assignments is currently being defined.</t>

</section>

<section title="Packet trailer">

<t>A Babel packet carries an explicit length in its header.  A Babel
packet is carried by a UDP datagram, which in turn contains an explicit
length in its header.  It is possible for a UDP datagram carrying a Babel
packet to be larger than the size of the Babel packet.  In that case, the
extra space after the Babel packet, known as the packet trailer, is
silently ignored by an implementation of the original protocol.</t>

<t>The packet trailer was originally intended to be used as
a cryptographic trailer.  However, the authentication extension to Babel
<xref target="RFC7298"/> ended up using a pair of new TLVs, and no currently
deployed extension of Babel uses the packet trailer.  The format and
purpose of the packet trailer is therefore currently left undefined.</t>

</section>

</section>

<section title="Format of sub-TLVs" anchor="sub-tlvs">

<t>A sub-TLV has exactly the same structure as a TLV.  Except for Pad1
(<xref target="pad1"/>), all sub-TLVs have the following structure:</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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length     |     Body...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
]]></artwork></figure>
<t>Fields :
<list style="hanging" hangIndent="10">
<t hangText="Type">The type of the sub-TLV.</t>
<t hangText="Length">The length of the body, exclusive of the Type and
Length fields.</t>
<t hangText="Body">The sub-TLV body, the interpretation of which depends
on both the type of the sub-TLV and the type of the TLV within which it is
embedded.</t>
</list></t>

<section title="Standard sub-TLVs">

<t>This document defines two types of sub-TLVs, Pad1 and PadN.  These
two sub-TLVs MUST be correctly parsed and ignored by any extended
implementation of the Babel protocol that uses sub-TLVs.</t>

<section title="Pad1" anchor="pad1">

<figure><artwork><![CDATA[
 0               
 0 1 2 3 4 5 6 7 
+-+-+-+-+-+-+-+-+
|   Type = 0    |
+-+-+-+-+-+-+-+-+
]]></artwork></figure>

<t>Fields :
<list style="hanging" hangIndent="10">
<t hangText="Type">Set to 0 to indicate a Pad1 sub-TLV.</t>
</list></t>

<t>This sub-TLV is silently ignored on reception.</t>

</section>

<section title="PadN">

<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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Type = 1   |    Length     |      MBZ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
]]></artwork></figure>

<t>Fields :
<list style="hanging" hangIndent="10">
<t hangText="Type">Set to 1 to indicate a PadN sub-TLV.</t>
<t hangText="Length">The length of the body, exclusive of the Type and
Length fields.</t>
<t hangText="MBZ">Set to 0 on transmission.</t>
</list></t>

<t>This sub-TLV is silently ignored on reception.</t>

</section>

</section>

<section title="Unknown sub-TLVs">

<t>Any unknown sub-TLV MUST be silently ignored by an extended
implementation that uses sub-TLVs.</t>

</section>

</section>

<section title="Choosing between extension mechanisms">

<t>New versions of the Babel protocol should only be defined if the new
version is not backwards compatible with the original protocol.</t>

<t>In many cases, an extension could be implemented either by defining
a new TLV, or by adding a new sub-TLV to an existing TLV.  For example, an
extension whose purpose is to attach additional data to route updates can
be implemented either by creating a new "enriched" Update TLV, or by
adding a sub-TLV to the Update TLV.</t>

<t>The two encodings are treated differently by implementations that do
not understand the extension.  In the case of a new TLV, the whole unknown
TLV is ignored by an implementation of the original protocol, while in the
case of a new sub-TLV, the TLV is parsed and acted upon, and the unknown
sub-TLV is silently ignored.  Therefore, a sub-TLV should be used by
extensions that extend the Update in a compatible manner (the extension
data may be silently ignored), while a new TLV must be used by extensions
that make incompatible extensions to the meaning of the TLV (the whole TLV
must be thrown away if the extension data is not understood).</t>

<t>Using a new bit in the Flags field is equivalent to defining a new
sub-TLV while using less space in the Babel packet.  Due to the high risk
of collision in the limited Flags space, and the doubtful space savings,
we do not recommend the use of the Flags field.</t>

<t>We refrain from making any recommendations about the usage of the
packet trailer due to the lack of implementation experience.</t>

</section>

<section title="IANA Considerations">

<t>IANA is to create two new registries, called "Babel TLV types" and
"Babel sub-TLV types".  The allocation policy for both of these
registries is Expert Review <xref target="RFC5226"/>.</t>

<texttable>
<preamble>The initial value of the Babel TLV types registry is as follows:
</preamble>
<ttcol>Type</ttcol><ttcol>Name</ttcol><ttcol>Reference</ttcol>
<c>0</c><c>Pad1</c><c><xref target="RFC6126"/></c>
<c>1</c><c>PadN</c><c><xref target="RFC6126"/></c>
<c>2</c><c>Acknowledgment Request</c><c><xref target="RFC6126"/></c>
<c>3</c><c>Acknowledgment</c><c><xref target="RFC6126"/></c>
<c>4</c><c>Hello</c><c><xref target="RFC6126"/></c>
<c>5</c><c>IHU</c><c><xref target="RFC6126"/></c>
<c>6</c><c>Router-Id</c><c><xref target="RFC6126"/></c>
<c>7</c><c>Next Hop</c><c><xref target="RFC6126"/></c>
<c>8</c><c>Update</c><c><xref target="RFC6126"/></c>
<c>9</c><c>Route Request</c><c><xref target="RFC6126"/></c>
<c>10</c><c>Seqno Request</c><c><xref target="RFC6126"/></c>
<c>11</c><c>TS/PC</c><c><xref target="RFC7298"/></c>
<c>12</c><c>HMAC</c><c><xref target="RFC7298"/></c>
<c>13</c><c>Source-specific Update</c><c><xref target="BABEL-SS"/></c>
<c>14</c><c>Source-specific Request</c><c><xref target="BABEL-SS"/></c>
<c>15</c><c>Source-specific Seqno Request</c><c><xref target="BABEL-SS"/></c>
</texttable>

<texttable>
<preamble>The initial value of the Babel sub-TLV types registry is as
follows:
</preamble>
<ttcol>Type</ttcol><ttcol>Name</ttcol><ttcol>Reference</ttcol>
<c>0</c><c>Pad1</c><c>(this document)</c>
<c>1</c><c>PadN</c><c>(this document)</c>
<c>2</c><c>Diversity</c><c><xref target="BABEL-DIVERSITY"/></c>
<c>3</c><c>Timestamp</c><c><xref target="BABEL-RTT"/></c>
</texttable>

</section>

<section title="Acknowledgments">

<t>I am grateful to Denis Ovsienko and Gabriel Kerneis for their feedback
on previous versions of this document.</t>

</section>

</middle>

<back>

<references title="References">

<reference anchor="RFC6126"><front>
<title>The Babel Routing Protocol</title>
<author fullname="Juliusz Chroboczek" initials="J." surname="Chroboczek"/>
<date month="February" year="2011"/>
</front>
<seriesInfo name="RFC" value="6126"/>
</reference>

<reference anchor='RFC7298'>
<front>
<title>Babel Hashed Message Authentication Code (HMAC) Cryptographic Authentication</title>
<author initials='D.' surname='Ovsienko' fullname='D. Ovsienko'></author>
<date year='2014' month='July' />
</front>
<seriesInfo name='RFC' value='7298' />
</reference>

<reference anchor="RFC5226">
<front>
<title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
<author initials='T.' surname='Narten' fullname='T. Narten'></author>
<author initials='H.' surname='Alvestrand' fullname='H. Alvestrand'></author>
<date year='2008' month='May' />
</front>
<seriesInfo name='BCP' value='26' />
<seriesInfo name='RFC' value='5226' />
</reference>

<reference anchor="BABEL-SS">
<front>
<title>Source-specific Routing</title>
<author initials='M' surname='Boutier' fullname='Matthieu Boutier'></author>
<author initials='J' surname='Chroboczek' fullname='Juliusz Chroboczek'></author>
<date month='July' day='3' year='2013' />
</front>
<seriesInfo name='Internet-Draft' value='draft-boutier-homenet-source-specific-routing-00' />
</reference>

<reference anchor="BABEL-RTT">
<front>
<title>Delay-based Metric Extension for the Babel Routing Protocol</title>
<author initials='B' surname='Jonglez' fullname='Baptiste Jonglez'></author>
<author initials='J' surname='Chroboczek' fullname='Juliusz Chroboczek'></author>
<date month='July' day='2' year='2014' />
</front>

<seriesInfo name='Internet-Draft' value='draft-jonglez-babel-rtt-extension-00' />
</reference>

<reference anchor="BABEL-DIVERSITY">
<front>
<title>Diversity Routing for the Babel Routing Protocol</title>
<author initials='J' surname='Chroboczek' fullname='Juliusz Chroboczek'></author>
<date month='July' day='4' year='2014' />
</front>

<seriesInfo name='Internet-Draft' value='draft-chroboczek-babel-diversity-routing-00' />
</reference>

</references>

</back>
</rfc>
