<?xml version='1.0' encoding='utf-8'?>
<!--      
     Documentation is at https://authors.ietf.org/en/templates-and-schemas
-->
<?xml-model href="rfc7991bis.rnc"?>
<!-- Required for schema validation and schema-aware editing -->
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<!-- If further character entities are required then they should be added to the DOCTYPE above.
Use of an external entity file is not recommended. -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="exp" docName="draft-bless-rtgwg-kira-06" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" xml:lang="en" version="3">
  <!-- 
    * docName should be the name of your draft
    * category should be one of std, bcp, info, exp, historic
    * ipr should be one of trust200902, noModificationTrust200902, noDerivativesTrust200902, pre5378Trust200902
    * updates can be an RFC number as NNNN
    * obsoletes can be an RFC number as NNNN 
-->

  <front>
    <title abbrev="KIRA">Kademlia-directed ID-based Routing Architecture (KIRA)</title>
    <!-- https://authors.ietf.org/en/rfcxml-vocabulary#title-4 -->
    <!--  The abbreviated title is required if the full title is longer than 39 characters -->

    <seriesInfo name="Internet-Draft" value="draft-bless-rtgwg-kira-06"/>
    <!-- https://authors.ietf.org/en/rfcxml-vocabulary#seriesinfo -->
    <!-- Set value to the name of the draft  -->
   
    <author fullname="Roland Bless" initials="R." surname="Bless">
      <!-- https://authors.ietf.org/en/rfcxml-vocabulary#author -->
    <!-- initials should not include an initial for the surname -->
    <!-- role="editor" is optional -->
    <!-- Can have more than one author -->
      
    <!-- all of the following elements are optional -->
      <organization>Karlsruhe Institute of Technology (KIT)</organization>
      <!-- https://authors.ietf.org/en/rfcxml-vocabulary#organization -->
      <address>
        <!-- https://authors.ietf.org/en/rfcxml-vocabulary#address -->
        <postal>
          <!-- Reorder these if your country does things differently -->
          <street>Kaiserstr. 12</street>
          <code>76131</code>
          <city>Karlsruhe</city>
          <country>DE</country>
          <!-- Can use two letter country code -->
        </postal>
        <phone>+4915201601400</phone>
        <email>roland.bless@kit.edu</email>
        <!-- Can have more than one <email> element -->
        <uri>https://tm.kit.edu/~bless</uri>
      </address>
    </author>
    <!-- <date year="2024" month="10" day="19"/> --> <!-- https://authors.ietf.org/en/rfcxml-vocabulary#date -->
    <date year="2026"/>
    <!-- On draft subbmission:
         * If only the current year is specified, the current day and month will be used.
         * If the month and year are both specified and are the current ones, the current day will
           be used
         * If the year is not the current one, it is necessary to specify at least a month and day="1" will be used.
    -->

    <area>Routing</area>
    <workgroup>Internet Engineering Task Force</workgroup>
    <!-- "Internet Engineering Task Force" is fine for individual submissions.  If this element is 
          not present, the default is "Network Working Group", which is used by the RFC Editor as 
          a nod to the history of the RFC Series. -->
    
    <keyword>Routing</keyword>
    <!-- Multiple keywords are allowed.  Keywords are incorporated into HTML output files for 
         use by search engines. -->

    <!--  ########################################################## -->

    <abstract>
      <t>This document describes the Kademlia-directed ID-based Routing
      Architecture KIRA. KIRA is a scalable zero-touch distributed routing
      solution that is tailored to control planes. It prioritizes scalable and
      resilient connectivity over route efficiency (stretched paths are
      accepted as trade-off against routing protocol overhead). KIRA's self-assigned,
      topologically independent IDs can be embedded into IPv6 addresses.
      Combined with further self-organization mechanisms from Kademlia, KIRA
      achieves a zero-touch solution that provides scalable IPv6 connectivity
      without requiring any manual configuration. For example, it can connect
      hundreds of thousands of routers and devices in a single network without
      requiring any form of hierarchy (like areas). It works well in various
      topologies and is loop-free even during convergence. This self-contained
      solution, and especially the independence from any manual configuration,
      make it suitable as a resilient base for all management and control tasks,
      allowing the network to recover from the most complex failure scenarios. The
      architecture consists of the ID-based network layer routing protocol
      R²/Kad in its Routing Tier (using source routing) and a PathID-based
      Forwarding Tier (using PathIDs as labels for paths). KIRA’s
      tightly integrated add-on services (e.g., name resolution as well as fast and
      efficient topology discovery) provide a perfect basis for autonomic
      network management solutions.
      </t>
    </abstract>
    <!--  ########################################################## -->
 
  </front>
  <middle>
    <!--  ########################################################## -->
    <section>
      <!-- The default attributes for <section> are numbered="true" and toc="default" -->
      <name>Introduction</name>
      <!--  ############ -->
      
      <t>
        KIRA is a scalable zero-touch distributed routing solution that is
        tailored to control planes. In contrast to commonly used routing
        protocols like OSPF, ISIS, BGP etc., it prioritizes resilient
        connectivity over route efficiency. It scales to hundreds of thousands
        of nodes in a single network, uses ID-based addresses, is zero-touch
        (i.e., it requires no manual configuration for and after deployment) and
        works well in various network topologies. Moreover, it offers a flexible
        memory/stretch trade-off per node, shows fast recovery from link or node
        failures, and is loop-free, even during convergence. Additionally, it
        includes a built-in Distributed Hash Table (DHT) as an add-on service that
        can be used for simple name service registration and resolution, thereby
        helping to realize autonomic network management, control, and zero-touch
        deployments.
      </t>
      <section anchor="requirements">
        <!-- anchor is an optional attribute -->
        <name>Requirements Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.</t>
      </section>
      <!-- The 'Requirements Language' section is optional -->
    </section>
    <!--  ########################################################## -->
    <section anchor="overview">
      <name>Overview of KIRA</name>
      <!-- ########## -->
      <t>
        KIRA's main objective is to provide self-organized robust control plane
        (CP) connectivity on top of a link-layer topology. The CP is typically
        used to configure, monitor, manage, and control networked resources
        (switches, routers, end-systems). The goal is to never lose control over
        the resources as long as there exist paths leading to them. KIRA is
        structured into a two-tier architecture consisting of a Routing Tier and
        a Forwarding Tier (see <xref target="fig-KIRA-architecture"/>). KIRA
        runs the zero-touch, distributed, highly scalable, ID-based routing
        protocol R²/Kad in the Routing Tier to find viable paths to
        destinations. The core concept of R²/Kad is that it discovers paths in
        the underlying topology by using an ID-based overlay routing scheme
        (based on Kademlia) combined with source routing between overlay hops.
        KIRA nodes employ this information to construct fast path forwarding tables
        in the Forwarding Tier for CP data traffic (e.g., packets from control plane
        applications). While source routing is robust (since it does not require
        converged routes) it can cause significant overhead, especially for
        small payloads. The Forwarding Tier avoids this overhead for CP data
        traffic by using PathIDs as forwarding state instead of the source
        routes and a scheme that is similar to label switching. However,
        existing forwarding support for IPv6 in hardware can be used, so KIRA
        does not require specialized new forwarding mechanisms.
      </t>
      <t>
        Add-on modules can make use of KIRA's routing information
        and available mechanisms, i.e., they are tightly coupled
        but offer optional support. Examples are a fully-distributed
        name resolution service (based on KIRA's built-in partial DHT
        functionality) and an efficient topology discovery service
        (KeLLy, <xref target="KeLLy-2023"/>).
      </t>
      <t>
        R²/Kad employs a flat ID-based addressing scheme to easily
        support zero-touch operation, self-organization as well as
        mobility and multi-homing. ID-based routing (sometimes also
        denoted as name-independent routing or routing with flat
        identifiers) has the advantage of providing stable addresses
        (called NodeIDs) to upper layers.  Thus, in case (virtual)
        resources are moved within the topology, any control
        connection to them stays alive. In contrast to other ID-based
        addressing approaches, KIRA is a genuine ID-based approach,
        because it does not use topological addresses at all and thus
        does not require any additional identifier-locator mapping
        (increased risk of inconsistency) and associated protocols
        (additional overhead and convergence time).
      </t>
      <t>
        As just motivated, R²/Kad uses topologically independent
        NodeIDs, generated by the KIRA nodes themselves, so address
        assignment is performed in a distributed manner by each node
        autonomously. Typically, NodeIDs are taken from a 112-bit
        address space, but depending on the network size, smaller
        NodeIDs are possible. KIRA uses IPv6 packets
	      <xref target="RFC8200"/>  for its messages
        and CP data packets, because NodeIDs can be easily embedded
        into an IPv6 address (e.g., 16 bit prefix + 112 bit NodeID)
        and existing hardware-based and software-based forwarding
        mechanisms can be leveraged. Mainly very basic IPv6 features
        like link-local addresses, the packet format, fragmentation,
        and neighbor discovery are used, e.g., it does not require any
        address configuration features or router discovery.
      </t>
      <t>
        The <em>Forwarding Tier</em> is able to forward IPv6 packets,
        so that (control) applications can use IPv6 and all
        corresponding transport protocols above. R²/Kad messages use
        source routing based on NodeIDs whereas traffic in the
        Forwarding Tier uses NodeIDs and PathIDs for its forwarding
        decision. A PathID is conceptually a hash of a sequence of
        NodeIDs that form a path segment. PathIDs are unique (with
        high probability) for a path segment. To carry PathIDs in
        addition to the final destination NodeID, the original IPv6
        packet becomes encapsulated, e.g., using a segment routing header
        that contains the PathID for the path segment that the packet
        should traverse next. Intermediate nodes simply exchange the
        PathID at each hop with the PathID of the remaining path
        segment (similar to label switching), or they strip the outer
        header when the next node is the end of a path segment.
        PathIDs are precomputed in a 2-hop vicinity of a KIRA node and
        are installed by R²/Kad signaling in some intermediate nodes
        on demand for paths longer than five hops. To forward CP
        packets KIRA nodes only need to perform lookups in their
        NodeID forwarding table and/or PathID forwarding table,
        perform encapsulation or decapsulation and rewrite PathIDs.
      </t>
      <figure anchor="fig-KIRA-architecture">
        <name>KIRA-Architecture</name>
        <artset>
          <artwork alt="KIRA Architecture" name="" type="ascii-art" align="left">Add-On Modules
             ┌─────────────────┐ ┌─────────────────┐
             │ DHT-based       │ │ KeLLy Topology  │
             │ Name Resolution │ │ Discovery       │
Routing Tier └─────────────────┘ └─────────────────┘
┌──────────────────────────────────────────────────┐ ┌─────────────┐
│R²/Kad                                            │ │ Control     │
│ ┌───────────────────┐ ┌───────────┐ ┌──────────┐ │ │ Plane       │
│ │- Path Discovery   │ │  Routing  │ │Path      │ │ │ Applications│
│ │- Routing          │ │  Table    │ │Management│ │ │             │
│ │- Failure Recovery │ │           │ │          │ │ │             │
│ └───────────────────┘ └───────────┘ └────┬─────┘ │ │             │
│                                          │       │ │             │
└──────▲───────────────────────────────────┼───────┘ └────▲────────┘
       │                                   │              │Trans-
       │              ┌────────────┬───────┘              │port
R²/Kad │   Forwarding │            │                      │over
Msgs   │   Tier       │            │                      │IPv6
       │  ┌─┬─────────▼─┬──┬───────▼─────┬─┬─────────┬─┬──▼───────┬─┐
       │  │ │NodeID     │  │PathID       │ │Encaps./ │ │Node Local│ │
       │  │ │Forwarding │  │Forwarding   │ │Decaps.  │ │Forwarding│ │
       │  │ │Table      │  │Table        │ │         │ │          │ │
       │  │ └───────────┘  └─────────────┘ └─────────┘ └─▲────────┘ │
       │  │                                              │          │
       │  │            ┌─────────────────────────────────┴─┐        │
       │  │         ┌─►│          Fast Forwarding          ├──┐     │
       │  └─────────┼──┴───────────────────────────────────┴──┼─────┘
       ▼     IPv6 ──┘                                         └─►IPv6
    UDP+IPv6
</artwork>
          <artwork alt="KIRA Architecture" type="svg">
        <svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" width="1280" height="720" viewBox="0 0 1280.0 720.0" version="1.1" id="svg62">
              <defs id="defs62"/>
              <g id="g62">
                <rect x="0" y="0" width="1280" height="720" fill="#FFFFFF" id="rect1"/>
                <path d="M192 391 1049.07 391" stroke="black" stroke-width="2" stroke-miterlimit="8" stroke-dasharray="16 6" fill="none" fill-rule="evenodd" id="path1"/>
                <rect x="290.5" y="426.5" width="759" height="137" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect2"/>
                <rect x="192.5" y="286.5" width="615" height="93" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect3"/>
                <text font-family="sans-serif" font-size="32" transform="translate(201.6 320)" id="text3">R²/Kad</text>
                <path d="m 824.04178,148.69486 c 0,-8.09231 7.13402,-14.65308 15.9334,-14.65308 h 213.64352 c 8.7994,0 15.9367,6.56077 15.9367,14.65308 v 58.61028 c 0,8.09231 -7.1373,14.65308 -15.9367,14.65308 H 839.97518 c -8.79938,0 -15.9334,-6.56077 -15.9334,-14.65308 z" stroke="#ffffff" stroke-width="2" stroke-miterlimit="8" fill="#000000" fill-rule="evenodd" id="path3"/>
                <text font-family="sans-serif" font-size="24" transform="translate(861.224 161)" id="text4" fill="#ffffff">Control Plane</text>
                <text font-family="sans-serif" font-size="24" transform="translate(868.137 189)" id="text5" fill="#ffffff">Applications</text>
                <text font-family="sans-serif" font-size="19" transform="translate(833.557 213)" id="text6" fill="#ffffff">(e.g., SDN/NFV Controller)</text>
                <path d="M816.5 83.5001 816.5 426.274" stroke="#000000" stroke-width="3" stroke-miterlimit="8" stroke-dasharray="12 9" fill="none" fill-rule="evenodd" id="path6"/>
                <rect x="407.5" y="524.5" width="526" height="40" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="black" id="rect6"/>
                <text fill="#ffffff" font-family="sans-serif" font-size="24px" id="text7" x="495.771" y="553">PathID</text>
                <text fill="#FFFFFF" font-family="sans-serif" font-size="24" transform="translate(579.771 553)" id="text8">-</text>
                <text fill="#FFFFFF" font-family="sans-serif" font-size="24" transform="translate(588.105 553)" id="text9">based Fast Forwarding</text>
                <path d="M211 372.5 243.5 340 276 372.5 259.75 372.5 259.75 530.5 276 530.5 243.5 563 211 530.5 227.25 530.5 227.25 372.5Z" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="8" fill="black" fill-rule="evenodd" id="path9"/>
                <text fill="#FFFFFF" font-family="sans-serif" font-size="21" transform="matrix(6.12323e-17 -1 1 6.12323e-17 250.622 534)" id="text10">R²/Kad Messages</text>
                <path d="M383.5 594.267 552.884 594.267 552.884 582.748 537.5 582.748 566.5 563.5 595.5 582.748 580.116 582.748 580.116 621.5 383.5 621.5Z" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" fill-rule="evenodd" id="path10"/>
                <text font-family="sans-serif" font-size="24" transform="translate(434.716 616)" id="text11">Fast Path</text>
                <text font-family="sans-serif" font-size="24" transform="translate(332.045 592)" id="text12">CP</text>
                <text font-family="sans-serif" font-size="24" transform="translate(332.045 620)" id="text13">IPv6</text>
                <text font-family="sans-serif" font-size="24" transform="translate(332.045 649)" id="text14">Packets</text>
                <path d="M728.847 564.5 728.847 592.741 881.453 592.741 881.453 572.328 909.5 605.414 881.453 638.5 881.453 618.087 703.5 618.087 703.5 564.5Z" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" fill-rule="evenodd" id="path14"/>
                <text font-family="sans-serif" font-size="24" transform="translate(750.523 613)" id="text15">Fast Path</text>
                <text font-family="sans-serif" font-size="21" transform="translate(969.776 270)" id="text16">Control</text>
                <text font-family="sans-serif" font-size="21" transform="translate(954.089 293)" id="text17">Plane (CP)</text>
                <text font-family="sans-serif" font-size="21" transform="translate(971.022 316)" id="text18">„Data“</text>
                <text font-family="sans-serif" font-size="21" transform="translate(957.916 339)" id="text19">Transport</text>
                <text font-family="sans-serif" font-size="21" transform="translate(982.102 362)" id="text20">over</text>
                <text font-family="sans-serif" font-size="21" transform="translate(981.689 385)" id="text21">IPv6</text>
                <path d="M262 148.667C262 140.567 268.567 134 276.667 134L473.333 134C481.433 134 488 140.567 488 148.667L488 207.333C488 215.433 481.433 222 473.333 222L276.667 222C268.567 222 262 215.433 262 207.333Z" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="8" fill="black" fill-rule="evenodd" id="path21"/>
                <text font-family="sans-serif" font-size="24" transform="translate(312.616 161)" id="text22">Distributed</text>
                <text font-family="sans-serif" font-size="24" transform="translate(314.369 189)" id="text23" fill="#ffffff">Hash Table</text>
                <text font-family="sans-serif" font-size="19" transform="translate(307.116 213)" id="text24">(Key/Value Store)</text>
                <path d="M583 148.667C583 140.567 589.567 134 597.667 134L794.333 134C802.433 134 809 140.567 809 148.667L809 207.333C809 215.433 802.433 222 794.333 222L597.667 222C589.567 222 583 215.433 583 207.333Z" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="8" fill="black" fill-rule="evenodd" id="path24"/>
                <text font-family="sans-serif" font-size="24" transform="translate(644.267 172)" id="text25" fill="#ffffff">Topology</text>
                <text font-family="sans-serif" font-size="24" transform="translate(594.774 200)" id="text26" fill="#ffffff">Discovery (KeLLy)</text>
                <path d="M673.5 241 698 216.5 722.5 241 710.25 241 710.25 263 722.5 263 698 287.5 673.5 263 685.75 263 685.75 241Z" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" fill-rule="evenodd" id="path26"/>
                <path d="M351.5 240.5 375.5 216.5 399.5 240.5 387.5 240.5 387.5 263.5 399.5 263.5 375.5 287.5 351.5 263.5 363.5 263.5 363.5 240.5Z" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" fill-rule="evenodd" id="path27"/>
                <path d="M7.5-1.5 16.5-1.5 16.5 1.5 7.5 1.5ZM19.5-1.5 25.5001-1.5 25.5001 4.4999 22.5001 4.4999 22.5001 0 24.0001 1.5 19.5 1.5ZM25.5001 7.49989 25.5001 16.4999 22.5001 16.4999 22.5001 7.49989ZM25.5001 19.4999 25.5001 28.4999 22.5001 28.4999 22.5001 19.4999ZM25.5001 31.4999 25.5001 40.4999 22.5001 40.4999 22.5001 31.4999ZM25.5001 43.4999 25.5001 52.4999 22.5001 52.4999 22.5001 43.4999ZM25.5001 55.4999 25.5001 64.4999 22.5001 64.4999 22.5001 55.4999ZM25.5001 67.4999 25.5001 76.4999 22.5001 76.4999 22.5001 67.4999ZM25.5001 79.4999 25.5001 88.4999 22.5001 88.4999 22.5001 79.4999ZM25.5001 91.4999 25.5001 100.5 22.5001 100.5 22.5001 91.4999ZM25.5001 103.5 25.5001 112.5 22.5001 112.5 22.5001 103.5ZM25.5001 115.5 25.5001 124.5 22.5001 124.5 22.5001 115.5ZM25.5001 127.5 25.5001 136.5 22.5001 136.5 22.5001 127.5ZM25.5001 139.5 25.5001 148.5 22.5001 148.5 22.5001 139.5ZM25.5001 151.5 25.5001 160.5 22.5001 160.5 22.5001 151.5ZM25.5001 163.5 25.5001 172.5 22.5001 172.5 22.5001 163.5ZM25.5001 175.5 25.5001 184.5 22.5001 184.5 22.5001 175.5ZM25.5001 187.5 25.5001 196.5 22.5001 196.5 22.5001 187.5ZM25.5001 199.5 25.5001 208.5 22.5001 208.5 22.5001 199.5ZM25.5001 211.5 25.5001 220.5 22.5001 220.5 22.5001 211.5ZM25.5001 223.5 25.5001 232.5 22.5001 232.5 22.5001 223.5ZM25.5001 235.5 25.5001 244.5 22.5001 244.5 22.5001 235.5ZM25.5001 247.5 25.5001 256.5 22.5001 256.5 22.5001 247.5ZM25.5001 259.5 25.5001 268.5 22.5001 268.5 22.5001 259.5ZM25.5001 271.5 25.5001 280.5 22.5001 280.5 22.5001 271.5ZM25.5001 283.5 25.5001 292.5 22.5001 292.5 22.5001 283.5ZM25.5001 295.5 25.5001 304.5 22.5001 304.5 22.5001 295.5ZM25.5001 307.5 25.5001 316.5 22.5001 316.5 22.5001 307.5ZM25.5001 319.5 25.5001 328.5 22.5001 328.5 22.5001 319.5ZM25.5001 331.5 25.5001 340.5 22.5001 340.5 22.5001 331.5ZM25.5001 343.5 25.5001 352.5 22.5001 352.5 22.5001 343.5ZM25.5001 355.5 25.5001 364.5 22.5001 364.5 22.5001 355.5ZM25.5001 367.5 25.5001 376.5 22.5001 376.5 22.5001 367.5ZM25.5001 379.5 25.5001 388.5 22.5001 388.5 22.5001 379.5ZM25.5001 391.5 25.5001 400.5 22.5001 400.5 22.5001 391.5ZM25.5001 403.5 25.5001 412.5 22.5001 412.5 22.5001 403.5ZM25.5001 415.5 25.5001 424.5 22.5001 424.5 22.5001 415.5ZM25.5001 427.5 25.5001 436.5 22.5001 436.5 22.5001 427.5ZM25.5001 439.5 25.5001 448.5 22.5001 448.5 22.5001 439.5ZM25.5001 451.5 25.5001 460.5 22.5001 460.5 22.5001 451.5ZM25.5001 463.5 25.5001 472.5 22.5001 472.5 22.5001 463.5ZM25.5001 475.5 25.5001 484.5 22.5001 484.5 22.5001 475.5ZM25.5001 487.5 25.5001 496.5 22.5001 496.5 22.5001 487.5ZM25.5001 499.5 25.5001 508.5 22.5001 508.5 22.5001 499.5ZM25.5001 511.5 25.5001 520.5 22.5001 520.5 22.5001 511.5ZM25.5001 523.5 25.5001 532.5 22.5001 532.5 22.5001 523.5ZM25.5001 535.5 25.5001 544.5 22.5001 544.5 22.5001 535.5ZM25.5001 547.5 25.5001 556.5 22.5001 556.5 22.5001 547.5ZM25.5001 559.5 25.5001 563.192 17.192 563.192 17.192 560.192 24.0001 560.192 22.5001 561.692 22.5001 559.5ZM14.192 563.192 7.5001 563.192 7.5001 560.192 14.192 560.192ZM9 4.5 0 0 9-4.5ZM9.0001 566.192 0.000104987 561.692 9.0001 557.192Z" fill="black" transform="matrix(-1.83697e-16 -1 -1 1.83697e-16 937.192 134.5)" id="path28"/>
                <path d="M499 175 572.209 175" stroke="black" stroke-width="8" stroke-miterlimit="8" stroke-dasharray="8 8" fill="none" fill-rule="evenodd" id="path29"/>
                <text font-family="sans-serif" font-size="24" transform="translate(193.179 276)" id="text29">Routing Tier</text>
                <text font-family="sans-serif" font-size="24px" id="text30" x="193.36484" y="102.93032">Add</text>
                <text font-family="sans-serif" font-size="24px" id="text31" x="238.53183" y="102.93032">-</text>
                <text font-family="sans-serif" font-size="24px" id="text32" x="246.86484" y="102.93032">on Modules</text>
                <text font-family="sans-serif" font-size="24" transform="translate(290.137 419)" id="text33">Forwarding Tier</text>
                <rect x="305.53375" y="289.44977" width="177.55525" height="85.100449" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect33"/>
                <text font-family="sans-serif" font-size="19" transform="translate(314.35 316)" id="text34">•</text>
                <text font-family="sans-serif" font-size="19" transform="translate(332.883 316)" id="text35">Path Discovery</text>
                <text font-family="sans-serif" font-size="19" transform="translate(314.35 338)" id="text36">•</text>
                <text font-family="sans-serif" font-size="19" transform="translate(332.883 338)" id="text37">Routing</text>
                <text font-family="sans-serif" font-size="19" transform="translate(314.35 360)" id="text38">•</text>
                <text font-family="sans-serif" font-size="19" transform="translate(332.883 360)" id="text39">Failure Recovery</text>
                <rect x="493.77109" y="291.5" width="132" height="81" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect39"/>
                <text font-family="sans-serif" font-size="19" transform="translate(499.855 338)" id="text40">Routing Table</text>
                <rect x="638.55493" y="291.5" width="133" height="81" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect40"/>
                <text font-family="sans-serif" font-size="19" transform="translate(679.596 327)" id="text41">Path</text>
                <text font-family="sans-serif" font-size="19" transform="translate(646.509 349)" id="text42">Management</text>
                <rect x="408.5" y="435.5" width="132" height="80" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" id="rect42"/>
                <text font-family="sans-serif" font-size="19" transform="translate(443.802 459)" id="text43">NodeID</text>
                <text font-family="sans-serif" font-size="19" transform="translate(429.468 481)" id="text44">Forwarding</text>
                <text font-family="sans-serif" font-size="19" transform="translate(453.495 503)" id="text45">Table</text>
                <rect x="575.5" y="435.5" width="132" height="80" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" id="rect45"/>
                <text font-family="sans-serif" font-size="19" transform="translate(613.636 459)" id="text46">PathID</text>
                <text font-family="sans-serif" font-size="19" transform="translate(596.736 481)" id="text47">Forwarding</text>
                <text font-family="sans-serif" font-size="19" transform="translate(620.763 503)" id="text48">Table</text>
                <rect x="742.52771" y="435.52774" width="143.31088" height="79.944527" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#ffffff" id="rect48"/>
                <text font-family="sans-serif" font-size="19" transform="translate(754.157 459)" id="text49">Encapsulation</text>
                <text font-family="sans-serif" font-size="19" transform="translate(805.324 481)" id="text50">/</text>
                <text font-family="sans-serif" font-size="19" transform="translate(753.171 503)" id="text51">Decapsulation</text>
                <rect x="909.5" y="435.5" width="133" height="80" stroke="black" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" id="rect51"/>
                <text font-family="sans-serif" font-size="19" transform="translate(955.025 459)" id="text52">Node</text>
                <text font-family="sans-serif" font-size="19" transform="translate(955.192 481)" id="text53">Local</text>
                <text font-family="sans-serif" font-size="19" transform="translate(931.272 503)" id="text54">Forwarding</text>
                <path d="M912.5 243 937 218.5 961.5 243 949.25 243 949.25 412 961.5 412 937 436.5 912.5 412 924.75 412 924.75 243Z" stroke="#000000" stroke-width="1.33333" stroke-miterlimit="8" fill="#FFFFFF" fill-rule="evenodd" id="path54"/>
                <text font-family="sans-serif" font-size="24" transform="translate(925.93 592)" id="text55">CP</text>
                <text font-family="sans-serif" font-size="24" transform="translate(925.93 620)" id="text56">IPv6</text>
                <text font-family="sans-serif" font-size="24" transform="translate(925.93 649)" id="text57">Packets</text>
                <text font-family="sans-serif" font-size="24px" id="text58" x="201.992" y="594">UDP +</text>
                <text font-family="sans-serif" font-size="24px" id="text59" x="201.992" y="622">Link Local</text>
                <text font-family="sans-serif" font-size="24px" id="text60" x="201.992" y="651">IPv6</text>
                <path d="m 699.807,372.5 v 32.99 H 486.79659 l 1.41814,-1.5 v 23.991 h -2.83627 V 402.49 h 213.01041 l -1.41814,1.5 V 372.5 Z m -208.75601,53.981 -4.2544,9 -4.2544,-9 z" fill="#000000" id="path60" stroke-width="0.972329"/>
                <path d="M699.54 372.5 699.54 405.49 641.5 405.49 643 403.99 643 427.98 640 427.98 640 402.49 698.04 402.49 696.54 403.99 696.54 372.5ZM646 426.48 641.5 435.48 637 426.48Z" fill="black" id="path61"/>
                <path d="M192 248 1049.07 248" stroke="black" stroke-width="2" stroke-miterlimit="8" stroke-dasharray="16 6" fill="none" fill-rule="evenodd" id="path62"/>
              </g>
            </svg>
          </artwork>
        </artset>
      </figure>
      <t>
        CP applications (e.g., SDN controllers, Kubernetes Cluster
        Controllers, Virtual Infrastructure Manager, traditional OAM
        applications and so on) simply use NodeIDs as addresses for
        the resources/devices they want to control or for other
        controllers they want to exchange state with. Therefore, CP
        applications can transparently use the connectivity
        established by KIRA.  Since NodeIDs are randomly generated,
        KIRA provides a simple built-in key/value store (Distributed
        Hash Table – DHT) that can be used as name service. KIRA nodes
        and services can dynamically register their NodeID under a
        certain well-known name and other KIRA nodes can lookup their
        corresponding NodeIDs. The DHT functionality will be specified
        as a separate KIRA module and corresponding application
        interfaces are out-of-scope for this specification.
      </t>
      <t>
        KIRA nodes possess relatively small routing tables, that grow
        with O(log(n)), where n is the number of KIRA nodes in the
        network (see <xref target="KIRA-Networking-2022"/> for
        evaluation results).  The advantage of small routing tables is
        scalability, but comes at the cost of path stretch.  That is,
        packets to destinations that are not kept in the routing table
        of a node take a longer path than the shortest possible path,
        because they are using the ID-based overlay routing
        strategy. However, KIRA nodes will learn the shortest paths to
        all 'contacts' in their routing tables and it is a node local
        decision how large the routing table can be.  For example, a
        controller node may add all KIRA nodes that it controls as
        contacts to its routing table.  Because KIRA uses source
        routing in R²/Kad and PathID-based forwarding in its
        forwarding tier, it can easily support multi-path routing and
        keep backup paths for fast fail-over reactions.
      </t>
      <t>
        KIRA uses a mixture of reactive and periodic mechanisms to
        cope with link and node failures. Error messages that indicate
        failed links usually trigger routing updates and a path
        rediscovery procedure. However, routing updates are not
        flooded to all KIRA nodes, so some nodes may still have
        obsolete path information. These inconsistencies will be
        detected either when using the obsolete path to a contact
        (triggering an error message from the node before the broken
        link) or by a maintenance procedure that is carried out
        periodically. These periodic maintenance procedures test the
        validity of the currently known paths and may also trigger a
        rediscovery procedure to find alternative paths.
      </t>
      <t>
        Moreover, KIRA also possesses a specific end-system mode,
        where KIRA nodes are part of the KIRA network, but they are
        not exchanging routing information and are not forwarding
        packets for other KIRA nodes (see <xref target="sec-end-system-mode"/>).
      </t>
      <t>
        Finally, KIRA also supports a domain concept. A KIRA node
        may be member of one or multiple domains. Unless configured
        otherwise, a KIRA node is member of the global domain with
        DomainID=0 by default. KIRA nodes keep their NodeID for
        all domains, the only difference is that routes are
        guaranteed to run inside a domain D in case source and
        destination nodes are both members of this domain D.
        This allows for using domains for administrative purposes
        (e.g., all KIRA nodes inside the same Autonomous System could
        be part of the same domain) or to use domains to build clusters
        of KIRA nodes that are grouped by closeness in the underlying
        network topology.
      </t>
    </section>
    <!-- Terminology
         NodeID
         KIRA Instance
    -->


    <!--  ########################################################## -->
    <section anchor="protocol-overview">
      <name>Protocol Operation</name>
      <!--  ################## -->
      <t>
        This section gives on overview of the main concepts with
        respect to the R²/Kad protocol operation. First, KIRA's
        ID-wise addressing concept is introduced, then the routing
        table structure is presented. After that, several procedures
        are described, beginning with node startup, vicinity discovery,
        and the join procedure to populate the routing table, followed
        by path discovery, overhearing, and rediscovery mechanisms.
      </t>
      <section anchor="addressing">
        <name>Addressing, NodeIDs and the XOR Metric</name>
        <!--  ++++++++++++++++++++++++++++++++++++++ -->
        <t>
          Every KIRA instance uses a single NodeID as its address. The
          NodeID is taken from a larger unstructured address space
          [0..2<sup>B-1</sup>] (typically B=112). KIRA uses the XOR (logical
          exclusive or) metric in this address space to define the
          distance between two NodeIDs X and Y (see also <xref target="Kademlia2002"/>). The distance function d(X,Y)= X
          XOR Y is interpreted as integer and fulfills all properties
          of a metric (d(X,Y)&gt;=0, and d(X,Y)=0 &lt;=&gt; X=Y;
          d(X,Y)=d(Y,X); as well as the triangle inequality
          d(X,Y)&lt;=d(X,Z)+d(Z,Y)). This distance function largely
          corresponds to a prefix bit distance metric d<sub>p</sub>(X,Y) =
          B-lcp(X,Y), where lcp(X,Y) denotes the length of the longest common
          prefix in bits.  The XOR metric is finer than the d<sub>p</sub>(X,Y)
          metric though, because when there are X,Y, and Z with
          d<sub>p</sub>(X,Y)=d<sub>p</sub>(Y,Z)=d<sub>p</sub>(X,Z), the XOR metric can uniquely
          determine whether Y or Z are closer to X. More generally
          speaking, for a given distance d(X,Y)=d there exists exactly
          one Y so that d(X,Y)=d. This property is important since it
          allows a node to unambiguously determine which NodeID is ID-wise
          closer to a given other NodeID and it provides the basis for
          KIRA's loop-freedom. Note that the ID space with this metric
          is not cyclic (i.e., a node with a very small NodeID is not
          close to a node with a very large NodeID).
        </t>
        <t>
          The XOR metric defines an overlay structure across all KIRA
          nodes in the ID space: KIRA nodes establish logical
          connections with their ID-wise closest overlay neighbors
          (which are typically different from the underlay neighbors)
          with respect to the XOR metric as distance metric, i.e., the
          ID-wise closer neighbors have a smaller distance according to
          XOR. KIRA uses this metric to determine the next KIRA node
          that a KIRA message is forwarded to in order to reach a
          certain destination NodeID. R²/Kad messages are forwarded by
          using source routing between overlay hops.
        </t>
        <t>
          In addition to NodeIDs, KIRA can use any ID from the ID
          space as destination address. Typically, names of objects
          can be hashed to result in a key value, which is called
          Resource ID. In this case, the ID-wise closest KIRA node
          will be found as responsible node for storing a value (or a
          referral) for this key. This makes it possible to provide an
          integrated DHT for name-to-NodeID registration and lookup.
        </t>
      </section>
      <section anchor="nodeid-creation">
        <name>NodeID Creation</name>
        <!--  +++++++++++++++ -->
        <t>
          NodeIDs are randomly generated and are taken from a 112 bit
          address space. Reserved NodeIDs listed in
          <xref target="sec-ReservedNodeIDs"/>
          <bcp14>MUST NOT</bcp14> be used as NodeID of a KIRA node. Future
          versions of this specification will detail an algorithm to create
          self-certifying NodeIDs as using certain hash functions from a public
          key. NodeIDs are unique with high probability, e.g., for
          10<sup>12</sup> nodes the probability for uniqueness is at least
          1-9.63∙10<sup>−11</sup>. However, in case two nodes possess the same
          NodeID, protocol mechanisms can be used to detect this situation
          (will be specified in a later version of this document) and
          the conflict can be resolved by letting both sides generate new
          NodeIDs. Depending on a KIRA node's capabilities, NodeIDs (together
          with other protocol parameters) may be stored in non-volatile memory
          so that nodes keep their NodeID even after restart. Other KIRA nodes
          may choose to generate a new NodeID on every restart.
        <!-- TBD NodeID creation from public keys -->
        </t>
      </section>
      <section anchor="sec-routing-table">
        <name>Routing Table</name>
        <!--  +++++++++++++ -->
         <t>
           The entries in the routing table (RT) are called
           'contacts'.  Contact data contains the NodeID of the
           contact as well as a set of discovered paths that lead to this
           contact (besides other node state and attributes). A path
           to a contact is stored as path vector that contains a
           complete sequence of NodeIDs, which can be traversed to
           reach the contact. Except for contacts in its routing
           table, a KIRA node does not know paths to other
           destinations, but they can be discovered by using a
           recursive overlay routing strategy: a KIRA node source
           routes a packet to the contact (using the known path) that
           is the ID-wise closest to the destination ID according to
           its routing table. The next overlay hop performs the same
           action until the destination node is reached. After the
           initial discovery phase, only Underlay Neighbors (ULNs)
           and some contacts from the 3-hop underlay neighborhood are
           stored in the routing table. Underlay Neighbors are
           nodes attached to the links of the KIRA node (i.e.,
           neighbors in the sense of <xref target="RFC8200"/>
           that are directly reachable via link layer and the
           Internet-layer or higher-layer tunnels).
        </t>
        <t>
           R²/Kad's efficiency and flexibility are closely related to
           its routing table. It is structured as tree of k-buckets as
           in <xref target="Kademlia2002"/>.  A k-bucket in the
           routing table contains a list of (at most) k contacts in
           distance between 2<sup>i</sup> and 2<sup>i+1</sup> (i.e., the bucket's range,
           where 0&lt;=i&lt;112) from this node. Usually, k&gt;=20 is
           constant and the same for all buckets and nodes, but it can
           also be varied per node (k=40 is <bcp14>RECOMMENDED</bcp14>
           as default for R²/Kad).  Buckets at deeper levels share
           more prefix bits with the node's own ID; however, buckets
           for small values of i are generally empty as no appropriate
           nodes exist in this address space. Thus, the highest bucket
           (depth 1) contains contacts from half of the ID space whose
           highest NodeID bit differs from the node's ID, whereas the
           deepest buckets contain all nodes that are ID-wise closest
           to the node (i.e., the ID-wise closest overlay neighbors).
        </t>
        <t>
           If KIRA node X learns a new contact Y, it puts it into the
           corresponding k-bucket b<sub>l</sub> in case it still has capacity
           left. The bucket index l is determined by calculating the common
           prefix length between X and Y (number of high-order zero bits of
           d(X,Y)).  If the bucket contains k entries already, it is split
           into two new buckets (and the contained entries moved to them
           accordingly) in case X falls into the bucket's range. Otherwise,
           a selection algorithm determines whether the new contact should
           replace an existing entry in this bucket.  KIRA uses
           Proximity Neighbor Selection (PNS) in all but the deepest two
           buckets so that contacts with shorter
           path lengths are preferred. If path lengths are equal,
           nodes with a higher degree (see NodeDegree in <xref target="sec-routing-table"/>)
	         <bcp14>SHOULD</bcp14> be preferred as this results in shorter paths
	         (following a powerlaw topology strategy). However, other contact
	         selection strategies are possible even on a per-node basis, but
	         the desired effect may not be visible unless all nodes follow
	         the same strategy. Setting and changing strategies even during
	         runtime inside a Domain is left for future work.
        </t>
        <t>
	         An additional mechanism for path selection
           improves path diversity and prevents route flapping: in case an
           alternative path of equal length has been discovered for an
           already known contact, this path replaces the previous path only
           if the hash sum of the path elements is closer to the node's own
           NodeID. Due to the uniqueness property of the XOR metric, the
           path selection will always unambiguously converge to a unique
           path.
        </t>
        <t>
           Underlay neighbors are kept in special buckets that have
           no capacity limit, i.e., they will never be preempted. In
           general, routing also works without this ULN buckets extension of
           <xref target="Kademlia2002"/>, but the resulting stretch will be
           slightly higher.
        </t>
        <t>
           X identifies its closest known contact in its RT by locating the
           k-bucket that corresponds to the longest matching prefix of
           destination Z with its own NodeID X by using d(X,Z).  It
           then selects a contact with the shortest path vector from within
           the bucket; this is called Proximity Routing (PR).  The
           XOR metric is used to uniquely select the ID-wise closest contact
	         if all paths have equal length or if destination Z falls into the
	         node's deepest bucket.
        </t>
        <t>
	   Each contact typically contains the following information:
        </t>
        <ul>
          <li>
            <em>NodeID</em> of the contact.</li>
          <li>
            <em>State</em>: the state that the contact is
	     considered to be in.  It is one of <em>undefined</em>,
	     <em>valid</em>, <em>rediscovering</em>, <em>invalid</em>,
	     <em>dead</em>.</li>
          <li>A set of path vectors, i.e., a complete sequence of
	     NodeIDs that lead to the contact when traversed.  There
	     is an <em>active</em> path (used as default), a
	     <em>proposed</em> path and possibly several backup or
	     alternative paths. Paths also carry timestamps
	     for points in time when they were last validated
	     and when they were refreshed (using PathSetupRsp or ProbeRsp, see
	     also <xref target="sec-fast-forwarding"/>).</li>
          <li>
            <em>Sequence Number</em>: a sequence number that is determined
	     by the contact and that changes when the underlay
	     connectivity state changes at the contact, i.e., with
	     newly detected or failed underlay neighbors.</li>
          <li>
            <em>LastSeen</em>: time of last direct contact</li>
          <li>
            <em>Sync ULN Sequence Number</em>: a sequence number used for
	     state synchronization with ULNs.</li>
          <li>
            <em>UnderlayNeighbor</em>: a boolean value indicating that
	     this contact is an underlay neighbor</li>
          <li>
            <em>NodeDegree</em>: the contact's number of underlay neighbors.</li>
          <li>
            <em>Rediscovery State</em>: temporary state keeping track of
	     the rediscovery process.</li>
        </ul>
      </section>
      <section anchor="sec-startup">
        <name>Node Startup and Vicinity Discovery</name>
        <!--  +++++++++++++++++++++++++++++++++++ -->

        <t>
          KIRA nodes generate their NodeID first (see <xref target="nodeid-creation"/>).  After that they start an
          initial discovery phase to explore their underlay
          vicinity. After that, the join procedure and continuous
          discovery are periodically repeated to keep the node
          connected to its overlay and improve the quality of
          discovered routes.
        </t>
        <t>
         In its initial discovery phase, a KIRA node discovers its
         underlay adjacencies, i.e., its underlay neighbors (ULNs) that
         can be directly reached via link-local communication on one
         of their network interfaces.  KIRA nodes periodically send
         ULNHello messages to a well-known link-local multicast address
         ALL-KIRA-NODES, and receiving nodes may reply with a
         ULNDiscoveryReq to set up an adjacency. This ULNDiscoveryReq
         <bcp14>MUST</bcp14> be answered by a ULNDiscoveryRsp to
         establish an adjacency.  The protocol exchange ensures that
         bidirectional communication is possible between directly
         adjacent nodes. ULNs may be put into the <em>ULNTable</em>
         either after receiving a ULNDiscoveryReq as answer to a
         transmitted ULNHello or after receiving a ULNDiscoveryRsp as
         answer to a transmitted ULNDiscoveryReq. The ULNTable contains
         a mapping from NodeID to the link-local unicast address of
         the ULN. This address is either taken from the source address
         of the ULNDiscoveryReq or the ULNDiscoveryRsp
         respectively.
        </t>
        <t>
          KIRA nodes also discover all nodes in their 3-hop underlay
          neighborhood to populate their routing table, but the 2-hop
          vicinity is fully stored in a local graph structure
          ("vicinity graph").  The latter is used to precompute
          PathIDs for the 2-hop vicinity. ULNDiscoveryReq and
          ULNDiscoveryRsp messages contain a list of underlay
          neighbors so that all ULNs of ULNs will be learned, i.e.,
          the 2-hop vicinity. However, possibly not all nodes in the
          2-hop vicinity will be stored in the RT, therefore the
          vicinity graph structure is used to keep track of the 2-hop
          vicinity (new nodes and links). Especially, the state
          sequence numbers of all the nodes should be stored in the
          vicinity graph as well. All nodes
          in the 2-hop vicinity are queried for their ULNs by using a
          QueryRouteReq.  QueryRouteReq/QueryRouteRsp messages are
          used to get ULNs or routing table information from nodes
          in the vicinity. Depending on their NodeID and other criteria
	        (e.g., NodeDegree), nodes from the 3-hop
          vicinity will be stored as contacts into the routing table.
	        The vicinity graph structure is also used to determine
	        whether a new QueryRouteReq must be initiated according
	        to the state-seq-num of the nodes in the vicinity.
          The vicinity graph can also be used to quickly calculate
          alternative paths, e.g., when direct links to ULNs break.
        </t>
        <t>
          A KIRA node continues to populate its routing table by
          sending FindNodeReq messages to certain nodes
          (especially those in the own ID-wise neighborhood) and also to
          randomly chosen destinations. The "Random Probing" procedure
          uses a randomly chosen ID from the NodeID space as destination
          for a FindNodeReq, however, a KIRA node does not need to exist
          for the chosen ID. The FindNodeReq will simply end at the
          KIRA node that is ID-wise closest to the destination ID.
          FindNodeRsp messages return a set of contacts that are
          ID-wise closest to the destination NodeID from the viewpoint
          of the responding KIRA node. The returned information is
          analyzed whether it can improve the local routing table,
          e.g., new and 'better' contacts or 'better' paths to already
          known contacts.
        </t>
      </section>
      <section anchor="sec-join-procedure">
        <name>Join Procedure</name>
        <!--  ++++++++++++++ -->
        <t>
          As a result of the vicinity discovery, all ULNs of X and some
          nodes within its 3-hop radius will populate X’s RT.
          However, in order to get network connectivity and to
          contribute to connectivity, the node needs to find its
          ID-wise closest overlay neighbors and make itself known to
          them. Thus, to join the network KIRA node X simply
          "searches" for the k closest nodes to its own NodeID: X
          sends a FindNodeReq for its own NodeID X and the closest
          neighbor replies with FindNodeRsp. Join requests can be
          detected by seeing that the source NodeID (src-node-id)
          and destination ID (dest-id) are identical. In this case
          the closest neighbors may know X, but they will exclude
          X from the result list and also answer the FindNodeReq
          instead of forwarding it to X.
        </t>
        <t>
          This is repeated with a limited exponential backoff
          in order to detect or heal any
          network partitioning. If node X finds itself in
          situations where it needs to respond with "Dead End" Error
          messages to FindNodeReqs, it <bcp14>SHOULD</bcp14> reset the backoff
          timer, because it may be a hint for network partitioning or
          other inconsistencies.  In order to let a joining node X
          quickly learn all existing ID-wise closest overlay
          neighbors, X <bcp14>SHOULD</bcp14> send a QueryRouteReq to every newly learned
          contact that enters X’s currently deepest k-bucket. The
          queried contact replies with a QueryRouteRsp returning
          its RT entries for the k closest contacts to node X. The
          contacts returned in this manner will very likely also fall into X’s
          deepest bucket, possibly leading to a further split of its
          deepest bucket. Therefore, X will quickly populate its set
          of ID-wise closest overlay neighbors, which are needed for
          consistent overlay connectivity.
        </t>
      </section>
      <section anchor="sec-path-discovery">
        <name>Path Discovery</name>
        <!--  ++++++++++++++ -->
        <t>
          Consider the example topology in <xref target="example-topo"/>.
          Assume node X needs to send a message to node Z.  If Z
          is a known contact of X, a path vector is stored already in
          the routing table that can be used for strict source routing
          in order to reach Z. Otherwise, a path to Z must be
          discovered using ID-based overlay routing. R²/Kad uses a
          recursive version of Kademlia (hence its name Routing with
          Recursive Kademlia – R²/Kad). The Path Discovery procedure
          uses a request/response message pair,
          FindNodeReq/FindNodeRsp.  In this example, assume that X
          identifies its contact Y (learned from ULN A) as next
          (ID-wise closest) overlay hop toward Z. In order to discover
          a path to Z, X creates a FindNodeReq message that
          contains destination NodeID Z and source route r=⟨X, A, Y⟩
          using path vector ⟨A⟩ of contact Y. The FindNodeReq
          is forwarded along r (strict source route). Message
          forwarding between overlay neighbors requires source
          routing, because the path in the underlay may lead via nodes
          that are (ID-wise) further away from the destination (e.g.,
          Y routes via ⟨A, Q, M⟩ to Z in <xref target="example-topo"/>):
          using the ID-based overlay routing scheme on a hop-by-hop basis
          (i.e., between directly adjacent nodes in the underlay) would
          inevitably lead to forwarding loops in most cases.
        </t>
        <figure anchor="example-topo">
          <name>An example topology. Letters represent
          NodeIDs. Letters closer in the alphabet have smaller
          distance in ID space.</name>
          <artwork type="ascii-art" align="left">
                Y
               /
           X--A--Q--M--Z
            \      /
             B----/
</artwork>
        </figure>
        <t>
          When the FindNodeReq arrives at Y, the same procedure is
          repeated (since it is a recursive variant of Kademlia).
          Node Y tries to find a contact closer to Z than Y itself.
          If this contact exists, source route r is appended by the
          corresponding path vector and the FindNodeReq is forwarded
          to this contact. In the given example of <xref target="example-topo"/>, we assume that Y knows Z as its
          contact with path vector ⟨A, Q, M⟩. It extends source route
          r of the FindNodeReq by ⟨A, Q, M, Z⟩ and forwards it to A as
          next hop in the source route. If routing information has
          converged, this ID-based routing scheme guarantees
          progress in the ID space <xref target="Kademlia2002"/>
          during forwarding and eventually finds node Z.
        </t>
        <t>
          The destination node Z responds with a FindNodeRsp message
          along the reversed source path with any cycles removed
          (⟨Z, M, Q, A, X⟩). Due to XOR’s symmetry, the responding node Z
          also learns the new contact X as neighbor.  The FindNodeRsp
          returned to X not only provides a path to Z, but also a list
          of k closest contacts to Z together with their path
          vectors. This list is used to improve X’s routing table.
        </t>
        <t>
          If the FindNodeReq arrives at Y and it cannot find
          a contact closer to Z, the FindNodeReq is terminated at Y
          and a response is sent back depending on the "ExactFlag"
          <xref target="flags"/> in the FindNodeReq. If the ExactFlag
          was not set, Y sends a FindNodeRsp back to originator X that
          contains an RT excerpt of Y’s (at most) k closest contacts
          to Z in a so called RTable object. This enables finding the
          responsible node for a destination ID Z if used as object
          key. This enables so called key-based routing that
          is used to realize DHTs. If exact was set, X assumed that a
          node with ID Z must exist, but the current node is the
          ID-wise closest node to Z and does not know Z as
          contact. Consequently, the node cannot forward the
          FindNodeReq closer to Z and returns a "Dead End" Error
          message (which may happen occasionally during convergence).
          If source route r contains a broken link or unreachable
          node, a "Segment Failure" Error message will be sent back
          to X along the reversed source route (with any cycles removed).
        </t>
      </section>
      <section anchor="sec-overhearing">
        <name>Overhearing of R²/Kad Messages</name>
        <!--  ++++++++++++++++++++++++++++++ -->
        <t>
          KIRA nodes use overhearing mechanisms for R²/Kad
          messages. This is an important mechanism for KIRA to learn
          new contacts and better or improved paths.
        </t>
        <t>
          Nodes that forward R²/Kad messages <bcp14>SHOULD</bcp14> use
          the contained source route to improve their own routing
          information: they may learn new contacts or shortcut routes
          to known contacts. However, only the so far traversed path
          is considered as it can be assumed that all traversed links
          worked recently. Additionally, NotViaList information (see <xref target="sec-notvialist"/>) is used to invalidate contacts that
          have an active path vector containing a link from the
          NotViaList.
        </t>
        <t>
         The source routing path of incoming requests and responses is
         also considered for improving the RT. Some messages like
         FindNodeRsp, QueryRouteRsp or UpdateRouteReq contain RTable
         objects that are evaluated likewise. However, in contrast to
         the source route information that can be considered as being
         most recent information, RTable information may be less
         recent (and also less trustworthy) and needs to be validated
         first before it can be used.
         Therefore, in case a path from the RTable is considered
         being of interest (improvement over an existing path), it
         needs to be checked by sending a ProbeReq message and
         successfully receiving the corresponding ProbeRsp.
         See <xref target="sec-routing-info-validity"/> for more details.
        </t>
        <t>
          Bypassing QueryRouteRsp messages contain RTable objects (as
          requested by QueryRouteReq) and <bcp14>SHOULD</bcp14> be
          inspected for interesting contacts and paths.
        </t>
      </section>
      <section anchor="sec-path-probing">
        <name>Periodic Path Probing</name>
        <!--  +++++++++++++++++++++ -->
        <t>
          <em>Periodic Path Probing</em> aims at reliably detecting
          any RT inconsistencies (e.g., seemingly valid contacts with
          paths that contain recently failed links). Each node
          periodically checks the path validity for all of its
          contacts by sending a ProbeReq message to them. ID-wise
          closest neighbors are probed more often than other contacts
          and those recently contacted (≤ 2s) are not probed. If
          a path has a link or node failure, the ProbeReq will elicit
          a "Segment Failure" Error message from an intermediate node
          along the broken path, notifying about the failed link. The
          contact’s state will be set to <em>invalid</em> and a
          rediscovery process is scheduled (see <xref target="sec-path-rediscovery"/>).
        </t>
      </section>
      <section anchor="sec-dynamics">
        <name>Dynamics: Recovery from Failures</name>
        <!--  ++++++++++++++++++++++++++++++++ -->

        <t>
          In order to improve R²/Kad’s robustness against link or node
          failures KIRA specifies a recovery procedure that notifies
          about failures and actively tries to find alternative paths
          that route around the failure. This procedure is highly
          robust and achieves a fast convergence. R²/Kad nodes detect
          link and node failures of ULNs by link layer notifications,
          missing ULNHello or ULNDiscoveryRsp messages as well as "Segment
          Failure" errors anytime during forwarding along source
          routes. To recover from such failures, R²/Kad’s recovery
          procedure uses the following mechanisms:
        </t>
        <ul>
          <li>
            Notify own nearest overlay neighbors about failed links or
            unreachable nodes ("bad news") by sending UpdateRouteReqs
            via a non-impacted underlay link.
          </li>
          <li>
            Rediscover a feasible alternative route to the affected
            node using FindNodeReqs. These carry NotViaList information
            about failed links that <bcp14>MUST NOT</bcp14> be considered for
            routing the FindNodeReq. Rediscovery is not performed for
            nodes that lost their only link, which can be deduced by
            the node’s degree information that is conveyed in R²/Kad
            messages.
          </li>
          <li>
            Per contact <em>state sequence numbers</em> avoid using
            obsolete information for path rediscovery. Additionally,
            an <em>aging</em> mechanism is used to avoid
            dissemination of obsolete routing information. It uses
            time periods to assess the currentness of the related
            path.
          </li>
          <li>
            Overhearing of NotViaList information and UpdateRouteReqs
            about failed links during forwarding R²/Kad messages
            informs nodes about failed links, which initiates a path
            rediscovery. Overhearing is also used to update obsolete
            path information.
          </li>
          <li>
            When an alternative path has been found for a prior
            affected contact or a link comes back up again, an
            UpdateRouteReq is sent to own ID-wise closest overlay
            neighbors for disseminating the "good news".
          </li>
        </ul>
        <t>The ID-based overlay routing scheme is used for rediscovery
        of a route, because NodeIDs are randomly distributed all over
        the underlying topology. Therefore, a rediscovery uses
        different paths that are likely not affected by the
        failure. However, if overlay nodes still have obsolete routing
        information, i.e., they would normally route via the failed
        link, they can detect the need to update their routes as well
        by seeing the more current NotViaList information.
        </t>
        <section anchor="sec-path-rediscovery">
          <name>Path Rediscovery</name>
          <!--  ++++++++++++++++ -->

          <t>A node X that detects its ULN B (cf. <xref target="example-topo"/>)
          or the corresponding link ⟨X, B⟩ has failed, reacts as follows
          (unless isolated by that failure):
          </t>
          <ol>
            <li>Set the state of the corresponding contact to <em>invalid</em>
            (in <xref target="example-topo"/> contact B). Invalid
            contacts will temporarily not be considered for routing.
            </li>
            <li>
              Set the state of all contacts whose paths contain the
              failed link ⟨X, B⟩ to invalid (in <xref target="example-topo"/>
              contact Z with ⟨B, M, Z⟩ becomes invalid).
            </li>
            <li>
              Send UpdateRouteReq messages indicating the failure to
              four of its ID-wise nearest neighbors (e.g., Y and Z in
              <xref target="example-topo"/>) via non-affected contacts.
              The UpdateRouteReq will also carry a NotViaList that contains
              ⟨X, B⟩.
            </li>
            <li>
              Trigger a rediscovery process (described below) for B
              (sets state to rediscovery) and for other invalid
              contacts.
            </li>
            <li>
              If the rediscovery process is successful for a contact,
              its state is set to <em>valid</em> and UpdateRouteReq
              messages are sent to notify ID-wise closest neighbors
              about the change.
            </li>
          </ol>
          <t>
            Since UpdateRouteReqs have notification character only,
            they do not create any responses (even no error messages
            if dropped).  The rediscovery process simply sends a
            FindNodeReq for all invalid contacts (all invalid contacts
            will be ignored in finding the next hop). This FindNodeReq
            for rediscovery (also denoted as rediscovery message)
            contains a set ExactFlag and the failed link ⟨X, B⟩ as
            additional NotViaList information. It is sent to X’s
            currently known ID-wise closest neighbors of the invalid
            contact (e.g., A in the example), which will then try to
            forward the FindNodeReq further toward the failed
            contact. The NotViaList information prevents nodes from
            using obsolete routing information when forwarding the
            rediscovery message, i.e., paths that contain the failed
            link will not be used for forwarding. Node A may not have
            heard yet about the broken link and thus will invalidate
            contact B if its prior preferred path is via ⟨X, B⟩.  In
            order to ensure that only current NotViaList information
            is considered, every link contained in the NotViaList is
            also accompanied by a related age value ∆T, specifying in
            milliseconds how long ago the sender heard about the
            failed link. When a FindNodeRsp is returned by B, a
            valid path has been discovered and the contact’s state is
            set to valid (triggering subsequent UpdateRouteReqs with
            the new path as mentioned before).
          </t>
          <t>
            Nodes receiving UpdateRouteReqs or FindNodeReqs containing
            the failed link also set their corresponding affected
            contacts to invalid and trigger a rediscovery process of
            the routes (like Z in the example). The actual rediscovery
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  