IETF MANET Working Group Josh Broch INTERNET-DRAFT David B. Johnson David A. Maltz Carnegie Mellon University13 March8 December 1998 The Dynamic Source Routing Protocol for Mobile Ad Hoc Networks<draft-ietf-manet-dsr-00.txt><draft-ietf-manet-dsr-01.txt> Status of This Memo This document is a submission to the Mobile Ad-hoc Networks (manet) Working Group of the Internet Engineering Task Force (IETF). Comments should be submitted to the Working Group mailing list at "manet@itd.nrl.navy.mil". Distribution of this memo is unlimited. This document is an Internet-Draft. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." To view the entire list of current Internet-Drafts, please check the "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe), munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast). Abstract Dynamic Source Routing (DSR) is a routing protocol designed specifically for use in mobile ad hoc networks. The protocol allows nodes to dynamically discover a source route across multiple network hops to any destination in the ad hoc network. When using source routing, each packet to be routed carries in its header the complete, ordered list of nodes through which the packet must pass. A key advantage of source routing is that intermediate hops do not need to maintain routing information in order to route the packets they receive, since the packets themselves already contain all of the necessary routing information. This, coupled with the dynamic, on-demand nature of DSR's Route Discovery, completely eliminates the need for periodic router advertisements and link status packets, significantly reducing the overhead of DSR, especially during periods when the network topology is stable and these packets serve only as keep-alives. Contents Status of This Memo i Abstract i 1. Introduction 1 2. Assumptions 1 3. Terminology 2 3.1. General Terms . . . . . . . . . . . . . . . . . . . . . . 2 3.2. Specification Language . . . . . . . . . . . . . . . . . 4 4. Protocol Overview 5 4.1. Route Discovery and Route Maintenance . . . . . . . . . . 5 4.2. Packet Forwarding . . . . . . . . . . . . . . . . . . . . 6 4.3.Conceptual Data StructuresMulticast Routing . . . . . . . . . . . . . . .6 4.3.1.. . . . . 7 5. Conceptual Data Structures 7 5.1. Route Cache . . . . . . . . . . . . . . . . . . .6 4.3.2. Node Information Cache. . . . 7 5.2. Route Request Table . . . . . . . . .8 4.3.3.. . . . . . . . . . 9 5.3. Send Buffer . . . . . . . . . . . . . . . . . . .8 4.3.4.. . . . 9 5.4. Retransmission Buffer . . . . . . . . . . . . . .8 5.. . . . 9 6. Packet Formats10 5.1.11 6.1. Destination Options Headers . . . . . . . . . . . . . . .10 5.1.1.11 6.1.1. DSR Route Request Option . . . . . . . . . . . .11 5.1.2.12 6.2. Hop-by-Hop Options Headers . . . . . . . . . . . . . . . 14 6.2.1. DSR Route Reply Option . . . . . . . . . . . . .13 5.1.3.15 6.2.2. DSR Route Error Option . . . . . . . . . . . . .14 5.1.4.17 6.2.3. DSR Acknowledgment Option . . . . . . . . . . . .15 5.2.18 6.3. DSR Routing Header . . . . . . . . . . . . . . . . . . .17 6.20 7. Detailed Operation19 6.1.23 7.1. Originating a Data Packet . . . . . . . . . . . . . . . . 23 7.2. Originating a Packet with a DSR Routing Header . . . . . 23 7.3. Processing a Routing Header . . . . . . . . . . . . . . . 24 7.4. Route Discovery . . . . . . . . . . . . . . . . . . . . .19 6.1.1.25 7.4.1. Originating a Route Request . . . . . . . . . . .19 6.1.2.25 7.4.2. Processing a Route Request Option . . . . . . . .19 6.1.3.26 7.4.3. Generating Route Replies using the Route Cache . 27 7.4.4. Originating a Route Reply . . . . . . . . . . . .20 6.1.4.28 7.4.5. Processing a Route Reply Option . . . . . . . . .21 6.2.29 7.5. Route Maintenance . . . . . . . . . . . . . . . . . . . .21 6.2.1. Originating a Route Error30 7.5.1. Using Network-Layer Acknowledgments . . . . . . . 30 7.5.2. Using Link Layer Acknowledgments . . . . .21 6.2.2. Processing. . . 32 7.5.3. Originating a Route ErrorOption. . . . . . . . .21 6.2.3.. . . 32 7.5.4. Processing aDSR AcknowledgmentRoute Error Option . . . . .22 6.3. Processing. . . . 33 7.5.5. Salvaging aRouting HeaderPacket . . . . . . . . . . . . . . .22 7.33 8. Optimizations24 7.1.35 8.1. Leveraging the Route Cache . . . . . . . . . . . . . . .24 7.1.1.35 8.1.1. Promiscuous Learning of Source Routes . . . . . .24 7.1.2. Answering Route Requests using the Route Cache . 25 7.2. Route Discovery Using Expanding Ring Search . . . . . . . 25 7.3.35 8.2. Preventing Route Reply Storms . . . . . . . . . . . . . .26 7.4.36 8.3. Piggybacking on Route Discoveries . . . . . . . . . . . .27 7.5.37 8.4. Discovering Shorter Routes . . . . . . . . . . . . . . .27 7.6.37 8.5. Rate Limiting the Route Discovery Process . . . . . . . .28 7.7.38 8.6. Improved Handling of Route Errors . . . . . . . . . . . .29 8. Constants 3039 9. Constants 40 10. IANA Considerations31 10.41 11. Security Considerations3242 Location of DSR Functions in the ISO Model3343 Implementation Status3444 Acknowledgments35 Areas for Refinement 3645 References3746 Chair's Address3948 Authors' Addresses4049 1. Introduction This document describes Dynamic Source Routing (DSR) [6, 7], a protocol developed by the Monarch Project [8, 14] at Carnegie Mellon University for routing packets in a mobile ad hoc network [3]. Source routing is a routing technique in which the sender of a packet determines the complete sequence of nodes through which to forward the packet; the sender explicitly lists this route in the packet's header, identifying each forwarding "hop" by the address of the next node to which to transmit the packet on its way to the destinationhost.node. DSR offers a number of potential advantages over other routing protocols for mobile ad hoc networks. First, DSR uses no periodic routing messages of any kind (e.g., no router advertisements and no link-level neighbor status messages), thereby significantly reducing network bandwidth overhead, conserving battery power, reducing the probability of packet collision, and avoiding the propagation of potentially large routing updates throughout the ad hoc network. Our Dynamic Source Routing protocol is able to adapt quickly to changes such ashostnode movement, yet requires no routing protocol overhead during periods in which no such changes occur. In addition, DSR has been designed to compute correct routes in the presence of asymmetric (uni-directional) links. In wireless networks, links may at times operate asymmetrically due to sources of interference, differing radio or antenna capabilities, or the intentional use of asymmetric communication technology such as satellites. Due to the existence of asymmetric links, traditional link-state or distance vector protocols may compute routes that do not work. DSR, however, will always find a correct route even in the presence of asymmetric links. 2. Assumptions We assume that allhostsnodes wishing to communicate with otherhostsnodes within the ad hoc network are willing to participate fully in the protocols of the network. In particular, eachhostnode participating in the network should also be willing to forward packets for otherhostsnodes in the network. We refer to the minimum number of hops necessary for a packet to reach from anyhostnode located at one extreme edge of the network to anotherhostnode located at the opposite extreme, as the diameter of the network. We assume that the diameter of an ad hoc network will be small (e.g., perhaps 5 or 10 hops), but may often be greater than 1. Packets may be lost or corrupted in transmission on the wireless network. Ahostnode receiving a corrupted packet can detect the error and discard the packet. We assume thathostsnodes can enableapromiscuous receive mode on their wireless network interface hardware, causing the hardware to deliver every received packet to the network driver software without filtering based on link-layer destination address. Although we do not require this facility, it is for example common in current LAN hardware for broadcast media including wireless, and some of our optimizations take advantage ofit if available.its availability. Use of promiscuous mode does increase the software overhead on the CPU, but we believe that wireless network speeds are more the inherent limiting factor to performance in current and future systems. We also believe that portions of the protocol are also suitable for implementation directly within a programmable network interface unit to avoid this overhead on the CPU. 3. Terminology 3.1. General Termsnode A device that implements IP. router A node that forwards IP packets not explicitly addressed to itself. host Any node that is not a router.link A communication facility or medium over which nodes can communicate at the link layer, such as an Ethernet (simple or bridged). A link is the layer immediately below IP. interface A node's attachment to a link. prefix A bit string that consists of some number of initial bits of an address. interface index An8-bit7-bit quantity which uniquely identifies an interface among a given node's interfaces. Each node can assign interface indices to its interfaces using any scheme it wishes. The index IF_INDEX_MA is reserved for use by Mobile IP [9] mobility agents (home or foreign agents) to indicate that they believe they can reach a destination via a connected internet infrastructure. The index IF_INDEX_ROUTER is reserved for use by routers not acting as Mobile IP mobility agents to indicate that they believe they can reach the destination via a connected internet infrastructure. The distinction between the index for mobility agents and the index for routers, allows mobility agents to advertise their existence ``for free''. A node that processes a routing header listing the interface index IF_INDEX_MA, can then send a unicast Agent Solicitation to the corresponding address in the routing header to obtain complete information about the mobility services being provided. link-layer address A link-layer identifier for an interface, such as IEEE 802 addresses on Ethernet links. packet An IP header plus payload. piggybacking Including two or more conceptually different types of data in the same packet so that all data elements move through the network together. home address An IP address that is assigned for an extended period of time to a mobile node. It remains unchanged regardless of where the node is attached to the Internet [9]. If a node has more than one home address, it SHOULD select and use a single home address when participating in the ad hoc network. source route A source route from a nodeAS to some nodeBD is an ordered list of homeaddresses, starting with the home address of node Aaddresses andending withinterface indexes that contains all thehome address ofinformation that would be needed to forward a packet through the ad hoc network. For each nodeB. Between A and B,that will transmit the packet, the source routeincludes an ordered list of all the intermediate hops between A and B, as well asprovides theinterfaceindex of the interfacethroughover which the packet should betransmitted to reachtransmitted, and thenext hop. Note thataddress of thepacket formats defined in Section 5.1 encodenode which is intended to receive theTarget Address (node B) separately, instead ofpacket. DSR Routing Headers as described in Section 6.3 use a more compact encoding of the source route and do not explicitly list address S in the Routing Header`, since it is carried as thelast hop onIP Source Address of the packet. A sourceroute.route is described as ``broken'' when the specific path it describes through the network is not actually viable. Route Discovery The method in DSR by which a nodeAS dynamically obtains a source route to some nodeBD that willcarrybe used by S to route packets through the networkfrom AtoB.D. Performing aroute discoveryRoute Discovery involves sending one or more Route Request packets. Route Maintenance The process in DSR of monitoring the status of a source route while in use, so that any link-failures along the source route can be detected and the brokensource routelink removed from use. 3.2. Specification Language The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [2]. 4. Protocol Overview 4.1. Route Discovery and Route Maintenance A source routing protocol must solve two challenges, which DSR terms Route Discovery and Route Maintenance. Route Discovery is the mechanism whereby a node S wishing to send a packet to a destination D obtains a source route to D. Route Maintenance is the mechanism whereby S is able to detect, while using a source route to D, if the network topology has changed such that it can no longer use its route to D because ahoplink along the route no longer works. When Route Maintenance indicates a source route is broken, S can attempt to use any other route it happens to know to D, or can invoke Route Discovery again to find a new route. To perform Route Discovery, the source node S link-layer broadcasts a Route Requestpacket withpacket. Here, node S is termed the initiator of the Route Discovery, and the node to which S is attempting to discover arecordedsourceroute listing only itself.route, say D, is termed the target of the Discovery. Each node that hears the Route Request packet forwards a copy of theRequestRequest, if appropriate, by adding its own address tothe recordeda source route being recorded inthis copy ofthe Request packet andrebroadcaststhen rebroadcasting thepacket.Route Request. The forwarding of Route Requests is constructed so that copies of the Request propagate hop-by-hop outward from the node initiating the Route Discovery, until either the target of the Request is found or until another node is found that can supply a route to the target. The basic mechanism of forwarding Route Requests forwards the Request if the node (1) is not the target of theRequest andRequest, (2) is not already listed in the recorded source route in this copy of theRequest. In addition, however,Request, and (3) has not recently seen another Route Request packet belonging to this same Route Discovery. A node can determine if it has recently seen such a Route Request, since each Route Request packet contains a unique identifier for this Route Discovery, generated by the initiator of the Discovery. Each node maintains an LRU cache of the unique identifier from each recently received RouteRequests and doesRequest. By notpropagatepropagating any copies of a Request after the first,avoidingthe overhead of forwarding additional copies that reach this node along differentpaths. Also,paths is avoided. In addition, the Time-to-Live field in the IP header of the packet carrying the Route Request MAY be used to limit the scope over which the Request will propagate, using the normal behavior of Time-to-Live defined by IP [12, 1]. Additional optimizations on the handling and forwarding of Route Requests are also used to further reduce the Route Discovery overhead. When the target of the Request (e.g., node D) receives the Route Request,it copiesthe recorded source route in the Request identifies the sequence of hops over which this copy of the Request reached D. Node D copies this recorded source route into a Route Reply packetwhich it thenand sends this Route Reply back to the initiator of the Route Request (e.g., node S). All source routes learned by a node are kept in a Route Cache, which is used to further reduce the cost of Route Discovery. When a node wishes to send a packet, it examines its own Route Cache and performs Route Discovery only if no suitable source route is found in its Cache. Further, whenasome intermediate node B receives a Route Request from S foranothersome target node D, Bsearches its ownnot equal D, B searches its own Route Cache for a route to D. If B finds such a route, itdoesmight not have to propagate the Route Request, but insteadreturnsreturn a Route Reply to node S based on the concatenation of the recorded source route from S to B in the Route Request and the cached route from B to D. The details of replying from a Route Cache in this way are discussed in Section7.1.8.1. As a node overhears routes being used by others, eitherby promiscuously snoopingonthemdata packets orwhen forwarding packets,on control packets used by Route Discovery or Route Maintenance, the node MAY insert those routes into its Route Cache, leveraging the Route Discovery operations of the othernodes.nodes in the network. Such route information MAY be learned either by promiscuously snooping on packets or when forwarding packets. 4.2. Packet Forwarding To represent a source route within a packet's header, DSR uses a Routing Headerthat conformssimilar to the Routing Header format specified for IPv6, adapted to the needs of DSR and to the use oftheDSR in IPv4 (or in IPv6 in the future). The DSR Routing Header uses a unique Routing Type field value to distinguish it from the existing Type 0 Routing Header defined within IPv6 [4]. To forward a packet, a receiving node N simply processes the Routing Header as specified inthe IPv6 [4]Section 7.3 and transmits the packet to the next hop. If a forwarding error occurs along the link to the next hop in the route, this node N sends a Route Error back to the originator S ofthethis packet informing S that this link is "broken". If node N's Route Cache contains a different route to thedestination,destination of the original packet, then the packet isretransmittedsalvaged using the new sourceroute.route (Section 7.5.5). Otherwise, the packet is dropped. Each node overhearing or forwarding a Route Error packet also removes from its Route Cache the link indicated to be broken, thereby cleaning the stale cache data from the network. 4.3.Conceptual Data Structures AllMulticast Routing At this time DSR does not support true multicasting. However, it does support the controlled flooding of a data packet to all nodes in the network that are within some number of hops of the originator. While this mechanism does not support pruning of the broadcast tree to conserve network resources, it can be used to distribute information to nodes in the network. When an application on a DSR nodeneeds for participationsends a packet to a multicast address, DSR piggybacks the data from the packet inside a Route Request packet targeted at the multicast address. The normal Route Request distribution scheme described inan ad hocSections 4.1 and 7.4.2 will result in this packet being efficiently distributed to all nodes in the networkusingwithin the specified TTL of the originator. The receiving nodes can then do destination address filtering on the packet, discarding it if they do not wish to receive multicast packets destined to this multicast address. 5. Conceptual Data Structures In order to participate in the Dynamic Source RoutingProtocol can be organized conceptually intoProtocol, a node needs four conceptual data structures: a Route Cache, aNode Information Cache,Route Request Table, a Send Buffer, and a Retransmission Buffer. These data structures MAY be implemented in any manner consistent with the external behavior described in this document.4.3.1.5.1. Route Cache All routing information needed by a node participating in an ad hoc network using DSR is stored in a Route Cache. Each node in the network maintains its own Route Cache. The node adds information to thecacheCache as it learns of new links between nodes in the ad hoc network, for example through packets carrying either a Route Reply or a Routing Header. Likewise, the node removes information from the cache as it learns existing links in the ad hoc network have broken, for example through packets carrying a Route Error or through the link-layer retransmission mechanism reporting a failure in forwarding a packet to its next-hop destination. The Route Cache is indexed logically by destinationnode,node address, and supports the following operations: void Insert(Route RT)InformationInserts information extracted from source route RTis insertedinto the Route Cache. Route Get(Node DEST)AReturns a source route from this node to DEST (ifit exists)one isreturned.known). void Delete(Node FROM, Interface INDEX, Node TO)Any routes inRemoves from the route cachethatany routes which assumethe existence ofthat aunidirectional link frompacket transmitted by node FROMto node TO are removed fromover its interface with thecache.given INDEX will be received by node TO. Each implementation MAY choose the cache replacement and cache search strategies for its Route Cache that are most appropriate for its particular network environment. For example, some environments may choose to return the shortest route to a node (the shortest sequence of hops), while others may select an alternate metric for the Get() operation. The Route Cache SHOULD support storing more than one source route for each destination. If there are multiple cached routes to a destination, the Route Get() operation SHOULD prefer routes that do not traverse a hop with an interface index of IF_INDEX_MA or IF_INDEX_ROUTER. This will prefer routes that lead directly to the target node over routes that attempt to reach the target via any internet infrastructure connected to the ad hoc network. If a node S is using a source route to some destination D that includes intermediate nodeI,N, S SHOULD shorten the route to destination D when it learns of a shorter route to nodeI.N than the one that is listed as the prefix of its current route to D. A node S using a source route to destination D through intermediate nodeI,N, MAY shorten the source route if it learns of a shorter path from nodeIN to node D. The Route Cache replacement policy SHOULD allow routes to be categorized based upon "preference", where routes with a higher preferences are less likely to be removed from the cache. For example, a node could prefer routes for which it initiated a Route Discovery over routes that it learned as the result of promiscuoussnooping.snooping on other packets. In particular, a node SHOULD prefer routes that it is presently using over those that it is not.The5.2. RouteCache SHOULD time-stamp each route as it is inserted into the cache. If the route is not used within ROUTE_CACHE_TIMEOUT seconds, it SHOULD be removed from the cache. 4.3.2. Node Information CacheRequest Table TheNode Information CacheRoute Request Table is a collection of records about Route Request packets that were recently originated or forwarded by this node. The table is indexed by the homeaddress.address of the target of the route discovery. A record maintained on nodeN1S for nodeN2D contains the following: - The time thatN1S lastbeganoriginated a Route Discovery forN2.D. - Theintervalremaining amount of time thatN1S must wait before the next attempt at a Route Discovery forN2.D. - The Time-to-live (TTL) field in the IP header of last Route Requesttransmittedoriginated byN1S forN2.D. - A FIFO cache of the last ID_FIFO_SIZE Identification valuesobserved infrom Route Request packetsinitiatedtargeted at node D that were forwarded byN2.this node. Nodes SHOULD use an LRU policy to manage the entries of in their Route Request Table. ID_FIFO_SIZE MUST NOT be set to an unlimited value, since, in theNode Information Cache. 4.3.3.worst case, when a node crashes and reboots the first ID_FIFO_SIZE Route Request packets it sends might appear to be duplicates to the other nodes in the network. 5.3. Send Buffer The Send Buffer of some node is a queue of packets that cannot be transmittedbecause the transmittingby that node because it does not yet have a source route tothe packets' destinations.each respective packet's destination. Each packet in the Send Buffer is stamped with the time that it is placed into the Buffer, and SHOULD be removed from the Send Buffer and discarded SEND_BUFFER_TIMEOUT seconds after initially being placed in the Buffer. If necessary, a FIFO strategy SHOULD be used to evict packets before they timeout to prevent the buffer from overflowing. Subject to the rate limiting defined in Section6.1,7.4, a Route Discovery SHOULD be initiated as often as possible for the destination address of any packets residing in the Send Buffer.4.3.4.5.4. Retransmission Buffer The Retransmission Buffer of a node is a queue of packets sent by this node that are awaiting the receipt of anexplicitacknowledgment from the next hop in the source route (Section5.2).6.3). For each packet in the Retransmission Buffer, a node maintains (1) a count of the number of retransmissions and (2) the time of the last retransmission. Packets are removed from the buffer when an acknowledgment is received, or when the number of retransmissions exceedsMAX_EXPLICIT_REXMIT.DSR_MAXRXTSHIFT. In the later case, the removal of the packet from the Retransmission BuffershouldSHOULD result in a Route Error being returned to the initial source of the packet (Section6.2). 5.7.5). 6. Packet Formats5.1. Destination Options HeadersDynamic Source Routing makes use of four options carrying control information that can be piggybacked in any existing IP packet. The mechanism used for these options is based on the design of the Hop-by-Hop and DestinationOption mechanismOptions mechanisms in IPv6 [4].This notion of a Destination OptionThe ability to generate and process such options must bebuild inadded toaan IPv4 protocol stack. Specifically, the Protocol field in the IP headershould beis used to indicate that a Hop-by-Hop Options or Destination Options extension header exists between the IP header and the remaining portion of a packet's payload (such as a transport layer header). The Next Header field inthe Destination Optionseach extension header will then indicate the type of header that follows it in a packet. 6.1. Destination Options Headers The Destination Options header is used to carry optional information that need be examined only by a packet's destination node(s). The Destination Options header is identified by a Next Header (or Protocol) value of 60 in the immediately preceding header, and has the following format: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | . . . Options . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Next Header 8-bit selector. Identifies the type of header immediately following the Destination Options header. Uses the same values as the IPv4 Protocol field [15]. Hdr Ext Len 8-bit unsigned integer. Length of the Destination Options header in 4-octet units, not including the first 8 octets. Options Variable-length field, of length such that the complete Destination Options header is an integer multiple of 4 octets long. Contains one or more TLV-encoded options. The following destinationoptions areoption is used by the Dynamic Source Routing protocol: - DSR Route Request option (Section5.1.1) - DSR Route Reply option (Section 5.1.2) - DSR Route Error option (Section 5.1.3) - DSR Acknowledgement option (Section 5.1.4) All of these6.1.1) This destinationoptions MAYoption MUST NOT appear multiple times within a single Destination Options header.5.1.1.6.1.1. DSR Route Request Option The DSR Route Request destination option is encoded in type-length-value (TLV) format as follows: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C| IN Index[1]||C| IN Index[2]||C| IN Index[3] |C| IN Index[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |C|OUT Index[1] |C|OUT Index[2] |C|OUT Index[3] |C|OUT Index[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[3] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C| IN Index[5]||C| IN Index[6]||C| IN Index[7] |C| IN Index[8]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |C|OUT Index[5] |C|OUT Index[6] |C| OUT Index[7] |C|OUT Index[8]| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Index[8]Address[5] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ IP fields: Source Address MUST be the home address of the nodetransmittingoriginating this packet. Intermediate nodes that repropagate the request do not change this field. Destination Address MUST be the limited broadcast address (255.255.255.255). Hop Limit (TTL) Can be varied from 1 to 255, for example to implement expanding-ring searches. Route Request fields: Option Type ???. A node that does not understand this option MUST discard the packet and the Option Data may change en-route (the toptwothree bitsmust be 01).are 011). Option Length 8-bit unsigned integer. Length of the option, in octets, excluding the Option Type and Option Length fields. Identification A unique value generated by the initiator (original sender) of the Route Request. This value allows a recipient to determine whether or not it has recently seen this a copy of this Request; if it has, the packet is simply discarded. When propagating a Route Request, this field MUST be copied from the received copy of the Request being forwarded. Target Address The home address of the node that is the target of the Route Request. Change Interface (C) bit[1..n] A flag associated with each interface index that indicates whether or not the corresponding node repropagated the Request over a different physical interface type than over which it received the Request. IN Index[1..n] IN Index[i] is theinterfaceindex of theith hop recorded in ininterface over which the node indicated by Address[i] received the Route Requestoption (in Address[i]).option. These are used to record a reverse route from the target of the request to the originator, over which a Route Reply MAY be sent. OUT Index[1..n] OUT Index[i] is the interface index that the node indicated by Address[i-1] used when rebroadcasting the Route Request option. Address[1..n] Address[i] is the home address of the ith hop recorded in the Route Request option.5.1.2. DSR6.2. Hop-by-Hop Options Headers The Hop-by-Hop Options header is used to carry optional information that must be examined by every node along a packet's delivery path. The Hop-by-Hop Options header is identified by a Next Header (or Protocol) value of ??? in the IP header, and has the following format: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | . . . Options . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Next Header 8-bit selector. Identifies the type of header immediately following the Hop-by-Hop Options header. Uses the same values as the IPv4 Protocol field [15]. Hdr Ext Len 8-bit unsigned integer. Length of the Hop-by-Hop Options header in 4-octet units, not including the first 8 octets. Options Variable-length field, of length such that the complete Hop-by-Hop Options header is an integer multiple of 4 octets long. Contains one or more TLV-encoded options. The following hop-by-hop options are used by the Dynamic Source Routing protocol: - DSR Route Reply option (Section 6.2.1) - DSR Route Error option (Section 6.2.2) - DSR Acknowledgment option (Section 6.2.3) All of these destination options MAY appear one or more times within a single Hop-by-Hop Options header. 6.2.1. DSR Route Reply Option The DSR Route Replydestinationhop-by-hop option is encoded in type-length-value (TLV) format as follows: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length|R|F|| Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C|OUT Index[1]||C|OUT Index[2]||C|OUT Index[3]||C|OUT Index[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[3] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C|OUT Index[5]||C|OUT Index[6]||C|OUT Index[7]||C|OUT Index[8] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[5] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type ???. A node that does not understand this option should ignore this option and continue processing thepacketpacket, and the Option Data does not change en-route (the toptwothree bitsshould be 00).are 000). Option Length 8-bit unsigned integer. Length of the option, in octets, excluding the Option Type and Option Length fields.Router (R) If the Router (R) bit is set, the last address recorded in this header is theReserved Sent as 0; ignored on reception. Target Address The home address ofa router that believes it can reachtheTarget Address specified innode to which the RouteRequest packet. Foreign Agent (F)Reply must be delivered. Change Interface (C) bit[1..n] If theForeign Agent (F)C bit associated with a node N is set,the last address recorded in this header is the home address of an IETF Mobile IP [9] Foreign Agent. The Router (R) bit and the Foreign Agent (F) bit are mutually exclusive as (F)it implies(R). Reserved Sent as 0; ignored on reception. Target Address The home address ofN will be forwarding thenode that ispacket out a different interface than theultimate destination ofone over which it was received (i.e., thesource route contained innode sending theRoute Reply.packet to N should not expect a passive acknowledgment). OUT Index[1..n] OUT Index[i] is the interface index of the ith hop listed in the Route Replyoption (in Address[i]).option. It denotes the interface that should be used by Address[i-1] to reach Address[i] when using the specified source route. Address[1..n] Address[i] is the home address of the ith hop listed in the Route Reply option.5.1.3.6.2.2. DSR Route Error Option The DSR Route Errordestinationhop-by-hop option is encoded in type-length-value (TLV) format as follows: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | Index | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |OriginatorError Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |From HopError Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Next HopUnreachable Node Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type ???. A node that does not understand this option should ignore the option and continue processing thepacketpacket, and the Option Data does not change en-route (the toptwothree bitsmust be 00).are 000). Option Length 8-bit unsigned integer. Length of the option, in octets, excluding the Option Type and Option Length fields. Index The interface index of the network interface over which thelink from the From Hop Addressnodeto the Next Hop Node is being reported as brokendesignated bythis RouteErroroption. This Index refersSource Address tried to forward a packet toan interface ontheFrom Hop Address node. Originatingnode designated by Unreachable Node Address. Error Source Address The home address of the nodewhich originatedoriginating thepacket that could not be forwarded. From Hop Address The home address ofRoute Error (e.g., the node that attempted to forward a packet and discovered the linkfailure. Next Hopfailure). Error Destination Address The home address of the node to which the Route Error must be delivered (e.g, the node that generated the routing information claiming that the hop Error Source Address to Unreachable Node Address was a valid hop). Unreachable Node Address The home address of the node that was found to be unreachable (the next hop neighbor to which the node atOriginating Address``Error Source Address'' was attempting to transmit the packet).5.1.4.6.2.3. DSR Acknowledgment Option The DSR Acknowledgmentdestinationhop-by-hop option is encoded in type-length-value (TLV) format as follows: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Address[1]ACK Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ACK Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type ???. A node that does not understand this option should ignore the option and continue processing thepacketpacket, and the Option Data does not change en-route (the toptwothree bitsmust be 00).are 000). Option Length 8-bit unsigned integer. Length of the option, in octets, excluding the Option Type and Option Length fields. Identification Aunique value assigned by the originator of the packet. This32-bit valueis used to match explicit acknowledgmentsthat when taken in conjunction with Data Source Address, uniquely identifies the packet being acknowledged. The Identification value is computed as ((ip_id << 16) | ip_off) where ip_id is the value of the 16-bit Identification field in the IP header of the packet being acknowledged, and ip_off is the value of the 13-bit Fragment Offset field in the IP header of the packet being acknowledged. When constructing the Identification, ip_id and ip_off MUST be in host byte-order. The entire Identification value MUST then be converted to network byte-order before being placed in thecorresponding packet. Address[1]Acknowledgment option. ACK Source Address The home address of theoriginal sourcenode originating the Acknowledgment. ACK Destination Address The home address of the node to which the Acknowledgment must be delivered. Data Source Address The IPpacket. 5.2.Source Address of the packet being acknowledged. 6.3. DSR Routing Header As specified for IPv6 [4], a Routing header is used by a source to list one or more intermediate nodes to be"visited"``visited'' on the way to a packet's destination. This function is similar to IPv4's Loose Source and Record Route option, but the Routing header does not record the route taken as the packet is forwarded. The specific processing steps required to implement the Routing header must be added to an IPv4 protocol stack. The Routing header is identified by a Next Header value of 43 in the immediately preceding header, and has the following format: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . . . type-specific data . . . | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The type specific data for a Routing Header carrying a DSR Source Route is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|R||R|S| Reserved |Identification |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C|OUT Index[1]||C|OUT Index[2]||C|OUT Index[3]||C|OUT Index[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[3] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[4] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+||C|OUT Index[5]||C|OUT Index[6]||C|OUT Index[7]||C|OUT Index[8] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[5] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Routing Header Fields: Next Header 8-bit selector. Identifies the type of header immediately following the RoutingRequestheader. Hdr Ext Len 8-bit unsigned integer. Length of the Routing header in8-octet4-octet units, not including the first 8 octets. Routing Type ??? Segments Left Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination. Type Specific Fields: Acknowledgment Request (R) The Acknowledgment Request (R) bit is set to request an explicit acknowledgment from the next hop. After processing the Routing Header, The IP Destination Address lists the address of the next hop. Salvaged Packet (S) The Salvaged Packet (S) bit indicates that this packet has been salvaged by an intermediate node, and thus that this Routing Header was generated by Address[1] and not the IP Source Address (Section 7.5.5). Reserved Sent as 0; ignored on reception.Identification A unique value assigned by the originator ofChange Interface (C) bit[1..n] If thepacket. This valueC bit associated with a node N isusedset, it implies N will be forwarding the packet out a different interface than the one over which it was received (i.e., the node sending the packet tomatch acknowledgments (passive or explicit)N should not expect a passive acknowledgment and MAY wish to set theappropriate packet.R bit). OUT Index[1..n] Index[i] is the interface indexof the ith hop inthat theRouting header. Address[1..n] Address[i] isnode indicated by Address[i-1] must use when transmitting thehome address ofpacket to Address[i]. Index[1] indicates which interface the node indicated by the IP Source Address uses to transmit the packet. Address[1..n] Address[i] is the home address of the ith hop in the Routing header.6. Detailed Operation 6.1. Route Discovery Route DiscoveryNote that Address[1] is thedemand-driven process by which nodes actively obtain source routes to destinations to which they are actively attempting to send packets.first intermediate hop along the route. Thedestinationaddress of the originating nodefor which a Route Discoveryisinitiatedthe IP Source Address. The only exception todiscover a routethis rule isknownfor packets that are salvaged, asthe "target" of the Route Discovery.described in Section 7.5.5. ARoute Discovery for a destination SHOULD NOT be initiated unless the initiating node has an unexpiredpacketto be delivered tothatdestination. A Route Discovery for a given targethas been salvaged has an alternate route placed on it by an intermediate nodeMUST NOT be initiated unless the difference betweenin thecurrent timenetwork, and in this case, thetime that a Route Discovery was last initiated for destination Daddress of the originating node (the salvaging node) isgreater thanAddress[1]. Salvaged packets are indicated by setting thebackoff interval currently listedS bit in theNode Information Cache forDSR Routing header. 7. Detailed Operation 7.1. Originating a Data Packet When nodeD. After each Route Discovery attempt,A originates a packet, theinterval between successive Route Discoverys mustfollowing steps MUST bedoubled, up to a maximum of MAX_RTDISCOV_INTERVAL. The basic Route Discovery algorithm is to originate a single Route Request packet as described below that targetstaken before transmitting the packet: 1. If thedesireddestinationand has a maximum hop limit set to MAX_ROUTE_LEN. 6.1.1. Originatingaddress is aRoute Request A node originatesmulticast address, piggyback the data packet on a Route Requestfor a particular host when it has no route to that host. The Option Length field in the Route Request option MUST be set to 6,targeting theIdentification fieldmulticast address. The following fields MUST beset to a unique number, and the Target Address field MUST contain theinitialized as specified: IP.Source_Address = HomeAddressaddress ofthenodefor which a route is being requested. 6.1.2. Processing a Route Request Option Let P1 be the received packet containing a Route Request option. Let P2 be a packet containing a corresponding Route Reply.ARoute Request optionIP.Destination_Address = 255.255.255.255 Request.Target_Address = Multicast destination address DONE. 2. Otherwise, call Route_Cache.Get() to determine if there isprocessed as follows: 1. Determine the originator ofa cached source route to theRoute Request.destination. 3. Ifno addresses are presently listed in P1.REQUEST.Address[], then P1.Source_Address identifies the originator of the Route Request. Otherwise, P1.REQUEST.Address[1] identifies the originator oftheRoute Request. 2. Ifcached route indicates that thecombination (Originator Address, P1.REQUEST.Identification)destination isin the node's cache of recently seen (Address, Identification) pairs, then discarddirectly reachable over one hop, no Routing Header should be added to the packet.DONE. 3. IfInitialize thehomefollowing fields: IP.Source_Address = Home address ofthisnodeis already listed in P1.REQUEST.Address[], then discardA IP.Destination_Address = Home address of thepacket.Destination DONE. 4.If P1.REQUEST.Target_Address matchesOtherwise, if thehome address of this node, then this packet contains a complete sourcecached routedescribing the path from the initiator of the Route Requestindicates that multiple hops are required tothis node. (a) Sendreach the destination, insert aRoute ReplyRouting Header into the packet as described in Section6.1.3. (b) If P1.REQUEST.Next_Header indicates No Next Header,7.2. DONE.(c)5. Otherwise,swap P1.REQUEST.Target_Address and P1.Source_Address and passif no cached route to the destination is found, insert the packetupinto theprotocol stack. DONE. 5. Set P1.REQUEST.Address[n+1] = home address of this node. Re-broadcast the Route Request packet jittered by T milliseconds, where T is a uniformly distributed, random number between 0Send Buffer andBROADCAST_JITTER. DONE. 6.1.3.initiate Route Discovery as described in Section 7.4. 7.2. Originating aRoute Reply Let P1 be the received packet containingPacket with aRoute Request option. Let P2 beDSR Routing Header When a node originates a packetcontainingwith acorresponding Route Reply. A Route Reply is transmittedRouting Header, the address of the first hop inresponse to a Route Requestthe source route MUST be listed asfollows: 1. If P1.REQUEST.Address[] does not contain any hops, then this nodethe IP Destination Address as well as Address[1] in the Routing Header. The final destination of the packet isonly a singlelisted as the last hopfromin theoriginator ofRouting Header (Address[n]). At each intermediate hop i, Address[i] is copied into theRoute Request. BuildIP Destination Address and the packet is retransmitted. For example, suppose node A originates aRoute Replaypacket destined for node D that should pass through intermediate hops B and C. The packet MUST be initialized as follows:P2.Destination_AddressIP.Source_Address =P1.Source_Address P2.Source_AddressHome address of node A IP.Destination_Address =P1.REQUEST.Target_Address GOTO 3. 2. Otherwise, build a Route Reply packet as follows: P2.Destination_AddressHome address of node B RT.Segments_Left = 2 RT.Out_Index[1] =P1.REQUEST.Address[1] P2.Source_AddressInterface index used by A to reach B RT.Out_Index[2] =P1.REQUEST.Target_Address P2.REPLY.Address[1..n]Interface index used by B to reach C RT.Out_Index[3] =P1.REQUEST.Address[1..n] 3. Transmit the Route Reply jitteredInterface index used byT milliseconds, where T is a uniformly distributed, random number between 0 and BROADCAST_JITTER. DONE. If sending a Route Reply packetC tothe originatorreach D RT.Address[1] = Home address of node B RT.Address[2] = Home address of node C RT.Address[3] = Home address of node D 7.3. Processing a Routing Header Excluding theRoute Request requires performing a Route Discovery, the Route Reply destination option MUST be piggybacked on the packet that contains the Route Request. This preventsexceptions listed here, aloop whereinDSR Routing Header is processed using thetarget ofsame rules as outlined for Type 0 Routing Headers in IPv6 [4]. The Routing Header is only processed by theRoute Request (which was itselfnode whose address appears as theoriginatorIP destination of theoriginal Route Request) must do another Route Request in order to return its Route Reply. If sending the Route Replypacket. The following additional rules apply to processing theoriginatortype specific data ofthe Route Request does not require performing Route Discovery, nodes SHOULD send a unicast Route Reply in response to every Route Request targeted at them. 6.1.4. ProcessingaRoute Reply Option Upon receiptDSR Source Route: Let SegLft = the value ofa Route Reply, a node should extractSegments Left when thesource route (Address[1..n] + Target Address) and insert this route into its Route Cache. Any packetspacket was received NumAddrs = the total number of addresses in theSend Buffer that are addressed to Target Address SHOULD be processed. 6.2. Route Maintenance 6.2.1. Originating a Route Error If while forwarding a packet with aRoutingHeader,Header 1. The address of the nexthop specified in the source routehop, Address[NumAddrs - SegLft + 1], isfound to be unreachable, a Route Error packet (Section 5.1.3) MUST be returned tocopied into theoriginator (Address[1])IP.Destination_Address of the packet. Theforwarding node SHOULD considerexisting IP.Destination_Address is NOT copied back into thenext hop to be unreachable if anyAddress list of thefollowing conditions occurs: -Routing Header. 2. Thefailureinterface used toreceive a passive acknowledgment when such passive acknowledgments had been received previously. - The failuretransmit the packet toreceive an explicitly requested acknowledgment after MAX_EXPLICIT_REXMIT retransmissions. - In link layers providing retransmissions and acknowledgments (e.g., 802.11), a signalits next hop from this node MUST be thelink layer that itinterface denoted by Index[NumAddrs - SegLft + 1]. 3. If the Acknowledgment Request (R) bit isunable to deliverset, thepacket. 6.2.2. Processing a Route Error Option Upon receipt of a Route Error via any mechanism, anodeSHOULD remove any route from its Route Cache that usesMUST transmit a packet containing thehop (From Hop Address, Next Hop Address). WhenDSR Acknowledgment option to the previous hop, Address[NumAddrs - SegLft - 1], performing RouteErrorDiscovery if necessary. (Address[0] isreturned to the Originator Address,taken as theoriginator must verifyIP.Source_Address) 4. Perform Route Maintenance by verifying that thesource route in the Route Errorpacket(From Hop Address...Originator Address) includes the same hops as the working prefix ofwas received by theoriginal packet's source route (Originator Address...From Hop Address). If anynext hoplisted in the working prefix is not includedas described intheSection 7.5. 7.4. RouteError's source route, then the originator must transmit theDiscovery RouteError back alongDiscovery is theworking prefix (Originator Address...From Hop Address) so that eachon-demand process by which nodes actively obtain source routes to destinations to which they are actively attempting to send packets. The destination nodealongfor which a Route Discovery is initiated is known as theworking prefix will remove"target" of theinvalid route from itsRouteCache. IfDiscovery. A Route Discovery for a destination SHOULD NOT be initiated unless the initiating nodeprocessinghas aRoute Error option discovers its home address equalspacket in theRouter Error's Originator Address and the packet contains an additional nestedSend Buffer requiring delivery to that destination. A RouteError, theDiscovery for a given target node MUSTperformNOT be initiated unless permitted by thefollowing steps: 1. Removerate-limiting information contained in the RouteError being processed from the packet. 2. Copy the Originator Address fromRequest Table. After each Route Discovery attempt, thenext nestedinterval between successive RouteErrorDiscoveries for this target must be doubled, up tothe IP destination fielda maximum ofthe packet. 3. AttachMAX_REQUEST_PERIOD. Route Discoveries for asource routemulticast address SHOULD NOT be rate limited, andsend the packet to the IP destination, performingSHOULD always be permitted. 7.4.1. Originating a Route Request The basic Route Discoveryif needed. 6.2.3. Processing a DSR Acknowledgment Option Upon receipt of a DSR Acknowledgment,algorithm for anode should remove any packet in its Retransmission Buffer matching the (Address, Identification) pair found in the Acknowledgment option. If no matchunicast destination isfound, the Acknowledgment should be silently discarded. [I'm supposed to say something intelligent here, but I can't remember what... -josh] 6.3. Processingas follows: 1. Originate aRouting Header A DSR Routing Header should be processed in accordanceRoute Request packet with thesteps outlined for Routing Headers in [4]. The Routing HeaderIP header Time-to-Live field initialized to 1. This type of Route Request isonly processed by the node whose address appears ascalled a non-propagating Route Request and allows theIP destinationoriginator of thepacket. A few additional rules applyRequest toprocessinginexpensively query thetype specific dataroute caches of each of its neighbors for aDSR Source Route: 1. The interface usedroute totransmit the packet MUST be the interface denoted by Index[n] where Address[n] isthehome address of this node.destination. 2. Ifthe Acknowledgment Request (R) bita Route Reply isset, the node MUST create and transmit a packet containing the DSR Acknowledgment optionreceived in response to theIP Source of the packet, performing Route Discovery if necessary. 3. Ifnon-propagating Request, use thenode choosesreturned source route tosettransmit all packets for theAcknowledgment Request (R) bitdestination that are in thepacket when it forwards it, it must first makeSend Buffer. DONE. 3. Otherwise, if no Route Reply is received within RING0_REQUEST_TIMEOUT seconds, transmit acopy ofRoute Request with thepacket and insert this copy into its Retransmission Buffer. 4. IfIP header Time-to-Live field initialized to MAX_ROUTE_LEN. This type of Route Request is called anode findspropagating Route Request. Update thenext hopinformation in theRouting Header to be unreachable, it MUST send aRouteError packetRequest Table, to double theoriginatoramount of time before any subsequent Route Discovery attempt to this target. 4. If no Route Reply is received within thepacket, denotedtime interval indicated byROUTING.Address[1]. 7. Optimizations A number of optimizations canthe Route Request Table, GOTO step 1. The Route Request option SHOULD beaddedinitialized as follows: IP.Source_Address = This node's home address IP.Destination_Address = 255.255.255.255 Request.Target = Home address of intended destination Request.OUT_Index[1] = Index of interface used to transmit thebasic operationRequest The behavior of a node processing a packet containing both a Routing Header and a RouteDiscoveryRequest Destination option is unspecified. Packets SHOULD NOT contain both a Routing Header androute maintenance as describeda Route Request Destination option. [This is not exactly true: A Route Request option appearing inSection 4.1the second Destination Options header thatcan reduceIPv6 allows after thenumber of overhead packets and improveRouting Header would probably do-what-you-mean, though we have not triple-checked it yet. Namely, it would allow theaverage efficiencyoriginator of a route discovery to unicast theroutes used on data packets. This section discussesrequest to someof those optimizations. 7.1. Leveragingother node, where it would be released and begin the flood fill. We call this a RouteCache The data inRequest Blossom since the unicast portion of the path looks like a stem on the blossoming flood-fill of the request.] Packets containing anode'sRouteCache mayRequest Destination option SHOULD NOT bestored in any format, butretransmitted, SHOULD NOT request an explicit DSR Acknowledgment by setting theactive routes in its cache formR bit, SHOULD NOT expect atree of routes, rooted at this node, to other nodespassive acknowledgment, and SHOULD NOT be placed in thead hoc network. For example, the illustration below shows an ad hoc networkRetransmission Buffer. The repeated transmission ofsix mobile nodes,packets containing a Route Request Destination option is controlled solely by the logic described inwhich mobile node A has earlier completedthis section. 7.4.2. Processing a RouteDiscovery for mobile node D and has cachedRequest Option When aroute to D through B and C: B->C->D +---+ +---+ +---+ +---+ | A |---->| B |---->| C |---->| D | +---+ +---+ +---+ +---+ +---+ | F | +---+ +---+ | E | +---+ Since nodes B and C are on the route to D,node Aalso learnsreceives a packet containing a Route Request option, theroute to both of these nodes from itsRouteDiscovery for D.Request option is processed as follows: 1. IfA later performs a Route Discovery and learnsRequest.Target_Address matches theroute to E through B and C, it can representhome address of thisin itsnode, then the RouteCache withRequest option contains a complete source route describing theaddition ofpath from thesingle new hop from C to E. If A then learns it can reach C in a single hop (without needinginitiator of the Route Request togo through B), A SHOULD usethisnew route to C to also shortennode. (a) Send a Route Reply as described in Section 7.4.4. (b) Continue processing theroutes to D and Epacket initsaccordance with the Next Header value contained in the Destination Option extension header. DONE. 2. Otherwise, if the combination (IP.Source_Address, Request.Identification) is found in the RouteCache. 7.1.1. Promiscuous LearningRequest Table, then discard the packet, since this is a copy ofSource Routes A node can add entries to its Route Cache any time it learnsanew route. In particular, whenrecently seen Route Request. DONE. 3. Otherwise, if Request.Target_Address is a multicast address then: (a) If nodeforwardsA is adata packet as an intermediate hop onmember of the multicast group indicated by Request.Target_Address, then create a copy of theroute in thatpacket, setting IP.Destination_Address = REQUEST.Target_Address, and continue processing theforwarding node is able to observecopy of theentire routepacket in accordance with the Next Header field of the Destination option. (b) If IP.TTL is non-zero, decrement IP.TTL, and retransmit the packet.Thus, for example, whenDONE. (c) Otherwise, discard the packet. DONE. 4. Otherwise, if the home address of nodeB forwards packets fromAto D, B SHOULD addis already listed in theroute information from that packet to its own Route Cache. If a node forwards aRouteReply packet, it SHOULD also add the route information fromRequest (IP.Source_Address or Request.Address[]), then discard theroute record being returnedpacket. DONE. 5. Let m = number of addresses currently in the RouteReply, to its own Route Cache. Finally, since all wireless network transmissions are inherently broadcast, aRequest option n = m + 1 6. Otherwise, append the home address of nodeMAY configure its networkA to the Route Request option (Request.Address[n]). 7. Set Request.IN_Index[n] = index of interfaceinto promiscuous receive mode, and addpacket was received on. 8. If a source route toitsRequest.Target_Address is found in our Route Cache and theroute informationrules of Section 7.4.3 permit it, return a Cached Route Reply as described in Section 7.4.3. DONE. 9. Otherwise, for each interface on which the node is configured to participate in a DSR ad hoc network: (a) Make a copy of the packet containing the Route Request. (b) Set Request.OUT_Index[n+1] = index of the interface. (c) If the outgoing interface is different fromanythe incoming interface, then set the C bit on both Request.OUT_Index[n+1] and Request.IN_Index[n] (d) Link-layer re-broadcast the packetit can overhear. 7.1.2. Answeringcontaining the RouteRequestsRequest on the interface jittered by T milliseconds, where T is a uniformly distributed, random number between 0 and BROADCAST_JITTER. DONE. 7.4.3. Generating Route Replies using the Route Cache A node SHOULD use its Route Cache to avoid propagating a Route Request packet received from another node. In particular, suppose a node receives a Route Request packet for which it is not the target and which it does not discardonbased on the logic ofsection 6.1.1.Section 7.4.2. If the node has a Route Cache entry for the target of therequest,Request, itmaySHOULD append this cached route to the accumulated route record in thepacket,packet andmayreturn this route in a Route Reply packet to the initiator without propagating (re-broadcasting) the Route Request. Thus, for example, if node F in the example network shown inSection 7.1Figure 7.4.3 needs to send a packet to node D, it will initiate a Route Discovery and broadcast a Route Request packet. If this broadcast is received by node A, node A can simply return a Route Reply packet to F containing the complete route to D consisting of the sequence ofhopshops: A, B, C, and D. Before transmitting a Route Reply packet that was generated using information from its Route Cache, a node MUST verify that: 1. The resulting routedoes not contain anycontains no loops. 2. The node issuing the Route Reply is listed in the route that itis replying with.specifies in its Reply. This increases the probability that the route is valid, since the node in question should have received a Route Error if this route stopped working.7.2. Route Discovery Using Expanding Ring Search The propagating nature of a basic Route Request packetAdditionally, this requirement means thatpotentially every node ina Route Error traversing thead hoc networkroute willbe disturbed whenever onepass through the node that issued the Reply based on stale cache data, which isoriginated. To reducecritical for ensuring stale data is removed from caches in a timely manner. Without thisnetwork-wide cost, all nodes SHOULD limitrequirement, themaximum propagation of theirnext RouteRequests in some way, and MAY use the following algorithm. 1. Whenever the backoff algorithm permitsDiscovery initiated by theinitiation of a Route Discovery, initially sendoriginal requester might also be contaminated by a RouteRequest with a hop limit of one (we refer toReply from thisasnode containing the same stale route. 7.4.4. Originating anon-propagating Route Request). 2. If noRoute ReplyisLet REQPacket denote a packet receivedfrom the non-propagating Route Request after RING0_TIMEOUT seconds, sendby node A that contains anewRoute Requestwithoption which lists node A as thehop limit set to MAX_ROUTE_LEN.REQPacket.Request.Target_Address. Let REPPacket be a packet transmitted by node Asingle attempt atthat contains a corresponding RouteDiscovery for destination node D may therefore involve sending twoReply. The RouteRequest packets. Nodes MUST not backoff between the sendingReply option transmitted in response to a Route RequestwithMUST be initialized as follows: B->C->D +---+ +---+ +---+ +---+ | A |---->| B |---->| C |---->| D | +---+ +---+ +---+ +---+ +---+ | F | +---+ +---+ | E | +---+ Figure 1: An example network where A knows ahop limit of oneroute to D via B andthe subsequent sending of Route Request withC. 1. If REQPacket.Request.Address[] does not contain any hops, then node A is only a single hoplimit of MAX_ROUTE_LEN. This procedure usesfrom thehop limit onoriginator of the RouteRequestRequest. Build a Route Reply packetto inexpensively check if the target is currently within wireless transmitter rangeas follows: REPPacket.IP.Source_Address = REQPacket.Request.Target_Address REPPacket.Reply.Target = REQPacket.IP.Source_Address REPPacket.Reply.OUT_Index[1] = REQPacket.Request.OUT_index[1] REPPacket.Reply.OUT_C_bit[1] = REQPacket.Request.OUT_C_bit[1] REPPacket.Reply.Address[1] = The home address ofthe initiator, or if anothernodewithin range hasA GOTO step 3. 2. Otherwise, build a RouteCache entry for this target (effectively using the caches of this node's neighborsReply packet asan extensionfollows: REPPacket.IP.Source_Address = The home address ofits own cache). Sincenode A REPPacket.Reply.Target = REQPacket.IP.Source_Address REPPacket.Reply.OUT_Index[1..n]= REQPacket.Request.OUT_index[1..n] REPPacket.Reply.OUT_C_bit[1..n]= REQPacket.Request.OUT_C_bit[1..n] REPPacket.Reply.Address[1..n] = REQPacket.Request.Address[1..n] 3. Send theinitial request is limited to one network hop, the timeout period before sending the propagating request can be quite small. 7.3. PreventingRoute ReplyStorms The ability for nodes to reply tojittered by T milliseconds, where T is aRoute Request not targeted at them using their Route Caches can result inuniformly distributed random number between 0 and BROADCAST_JITTER. DONE. If sending a Route Replystorm. If a node broadcasts apacket to the originator of the Route Requestforrequires performing anodeRoute Discovery, the Route Reply hop-by-hop option MUST be piggybacked on the packet thatits neighbors have in theircontains the RouteCaches, each neighbor may attempt to sendRequest. This prevents a loop wherein the target of the new RouteReply thereby wasting bandwidth and increasingRequest (which was itself therateoriginator ofcollisions inthearea. For example,original Route Request) must do another Route Request in order to return its Route Reply. If sending thenetwork shown in Section 7.1, if both A and B receive F'sRouteRequest, they will both attemptReply toreply from theirthe originator of the RouteCaches. Both willRequest does not require performing Route Discovery, a node SHOULD sendtheir repliesa unicast Route Reply in response to every Route Request targeted ataboutit. 7.4.5. Processing a Route Reply Option Upon receipt of a Route Reply, a node should extract thesame time since they receivesource route (Target_Address, OUT_Index[1]:Address[1], .. OUT_Index[n]:Address[n] ) and insert this route into its Route Cache. All thebroadcast at aboutpackets in thesame time. Particularly when more thanSend Buffer SHOULD be checked to see whether thetwo mobile nodesinformation inthis example are involved, these simultaneous replies from the mobile nodes receivingthebroadcast may create packet collisions among some or all of these replies and may cause local congestion in the wireless network. In addition, it will oftenReply allows them to bethe casesent immediately. 7.5. Route Maintenance Route Maintenance requires thatthe different replies will indicate routes of different lengths. For example, A's reply will indicatewhenever aroute to Dnode transmits a data packet, a Route Reply, or a Route Error, it must verify thatis onethe next hoplonger than that in B's reply. For interfaces which can promiscuously listen to(indicated by thechannel, mobile nodes SHOULD useDestination IP Address) correctly receives thefollowing algorithm to reducepacket. If thenumber of simultaneous replies by slightly delaying their Route Reply: 1. Pick a delay period d = H * (h - 1 + r) where h issender cannot verify that thelength in number of network hops fornext hop received theroutepacket, it MUST decide that its link tobe returned in this node's reply, rthe next hop isa random number between 0 and 1,broken andH isMUST send asmall constant delayRoute Error tobe introduced per hop. 2. Delay transmittingtheRoute Reply from thisnode responsible fora period of d. 3. Within the delay period, promiscuously receive all packets at this node. If a packet is received by this node duringgenerating thedelay periodRouting Header thatis addressedcontains the broken link (Section 7.5.3). The following ways may be used to verify that thetargetnext hop correctly received a packet: - The receipt ofthis Route Discovery (the target is the final destination address for the packet, through any sequencea passive acknowledgment (Section 7.5.1). - The receipt ofintermediate hops), and ifan explicitly requested acknowledgment (Section 7.5.1). - By thelengthpresence of positive feedback from the link layer indicating that theroute on thispacketis less than h, then cancelwas acknowledged by thedelay and do not transmitnext hop (Section 7.5.2). - By theRoute Replyabsence of explicit failure notification fromthis node; this node may infer thattheinitiator of thislink layer that provides reliable hop-by-hop delivery such as MACAW or 802.11 (Section 7.5.2). Nodes MUST NOT perform RouteDiscovery has already receivedMaintenance for packets containing a RouteReply, giving an equalRequest option orbetter route. 7.4. Piggybacking on Route Discoveries As described in Section 4.1, when onepackets containing only an Acknowledgment option. Sending Acknowledgments for packets containing only an Acknowledgment option would create an infinite loop whereby acknowledgments would be sent for acknowledgments. Acknowledgments should be always sent for packets containing a Routing Header with the R bit set (e.g., packets which contain only an Acknowledgment and a Routing Header for which the last forwarding hop requires an explicit acknowledgment of receipt by the final destination). 7.5.1. Using Network-Layer Acknowledgments For link layers that do not provide explicit failure notification, the following steps SHOULD be used by a nodeneedsA tosendperform Route Maintenance. When receiving a packet: - If the packetto another, ifcontains a Routing Header with thesenderR bit set, send an explicit acknowledgment as described in Section 7.3. - If the packet does nothavecontain aRoute Cached toRouting Header, thedestination node, it must initiatenode MUST transmit aRoute Discovery, either buffering the originalpacketuntilcontaining theRoute Reply is returned, or discarding it and relying on a higher-layer protocol to retransmit it if needed. The delay for Route Discovery andDSR Acknowledgment option to thetotal number of packets transmitted can be reducedprevious hop as indicated byallowing data to be piggybacked on Route Request packets.the IP.Source_Address. Sincesome Route Requests maythe receiving node is the final destination, there will bepropagated widely withinno opportunity for thead hoc network, though,originator to obtain a passive acknowledgment, and theamount of data piggybackedreceiving node mustbe limited. We currently use piggybacking wheninfer the originator's request for an explicit acknowledgment. When sending aRoute Reply orpacket: 1. Before sending aRoute Errorpacket,since both are naturally small in size,insert a copy of the packet into the Retransmission Buffer andsmall data packets such asupdate theinitial SYNinformation maintained about this packetopening a TCP connection [13] could easily be piggybacked. One problem, however, arises when piggybacking on Route Request packets.in the Retransmission Buffer. 2. Ifa Route Requestafter processing the Routing Header, RH.Segments_Left isreceived by a node that repliesequal to 0, then node A MUST set therequest based on its Route Cache without propagatingAcknowledgment Request (R) bit in therequest (Section 7.1),Routing Header before transmitting thepiggybacked data will be lost ifpacket over its final hop. 3. If after processing the Routing Header and copying RH.Address[n] to IP.Destination_Address, nodesimply discardsA determines that RH.OUT_C_bit[n+1] is set, then node A MUST set theRoute Request. In this case,Acknowledgment Request (R) bit in the Routing Header beforediscardingtransmitting thepacket,packet (since the C bit was set during Route Discovery by the nodemust construct a new packet containingnow listed as thepiggybacked data fromIP.Destination_Address to indicate that it will propagate theRoute Request packet. The source route in this packet MUST be constructed to appear as if the newpackethad been sent byout a different interface, and that node A will not receive a passive acknowledgment). 4. Set theinitiator ofretransmission timer for theRoute Discovery and had been forwarded normally to this node. Hence,packet in thefirst portion ofRetransmission Buffer. 5. Transmit theroutepacket. 6. If a passive or explicit acknowledgment istaken fromreceived before theaccumulated route record inretransmission timer expires, then remove theRoute Requestpacket from the Retransmission Buffer and disable theremainder ofretransmission timer. DONE. 7. Otherwise, when theroute is taken from this node's Route Cache. The sender address inRetransmission Timer expires, remove the packetshould also be set tofrom theinitiator ofRetransmission Buffer. 8. If DSR_MAXRXTSHIFT transmissions have been done, then attempt to salvage the packet (Section 7.5.5). Also, generate a RouteDiscovery. SinceError. DONE. 9. GOTO step 1. 7.5.2. Using Link Layer Acknowledgments If explicit failure notifications are provided by thereplying node will be unablelink layer, then all packets are assumed to be correctlyrecompute an Authentication header for the split off piggybacked data, data coveredreceived byan Authentication header SHOULD NOT be piggybacked onthe next hop and a RouteRequest packets. 7.5. Discovering Shorter Routes OnceError is sent only when aroute betweenexplicit failure notification is made from the link layer. Nodes receiving a packetsource andwithout adestination has been discovered, the basic DSR protocol MAY continueRouting Header do not need touse that route for all traffic from the sourcesend an explicit Acknowledgment to thedestination, evenpacket's originator, since the link layer will notify the originator if thenodes move such thatpacket was not received properly. 7.5.3. Originating ashorter route becomes possible. In many cases, the basic route maintenance procedure will discoverRoute Error If theshorter route, since ifnext hop of anode moves enoughpacket is found tocreate a shorter route, it will likely also move out of transmission range of at least one hop on the existing route. When operatingbe unreachable as described inpromiscuous receive mode,Section 7.5, a Route Error packet (Section 6.2.2) MUST be returned to the nodeSHOULD usewhose cache generated thefollowing algorithminformation used toprocess a receivedroute the packet.Whenever possible, this algorithm shortens routes that already existWhen a node A generates a Route Error for packet P, it MUST initialize the fields in the RouteCache. 1.Error as follows: Error.Source_Address = Home address of node A Error.Unreachable_Address = Home address of the unreachable node - If the packetis not a data packet containingcontains a DSR RoutingHeader, drop the packet. DONE. 2. IfHeader and theIP destinationS bit is NOT set, thehome address of this node, then followpacket has been forwarded without thenormal stepsneed for salvaging up toprocess the packet. DONE. 3. If the home address ofthisnode does not appear inpoint. Error.Destination_Address = P.IP.Source_Address - Otherwise, if theportion ofpacket contains a DSR Routing Header and thesource route thatS bit IS set, the packet hasnot yetbeenprocessed (indicatedsalvaged bySegments Left), then drop the packet. DONE. 4. The node S indicatedan intermediate node, and thus this Routing Header was placed there by theSource Address field insalvaging node. Error.Destination_Address = P.RoutingHeader.Address[1] - Otherwise, if theIP header can communicated directly with this node N. Createpacket does not contain aRoute Reply. The Route Reply MUST listDSR Routing Header, theentire source routing contained in the receivedpacketwith the exception of the intermediate nodes betweenmust have been originated by this nodeS andA. Error.Destination_Address = Home address of nodeN. 7.6. Rate LimitingA Send the packet containing the Route Error to Error.Destination_Address, performing Route DiscoveryProcess One common error condition that must be handled inif necessary. As anad hoc network is the case in which the network effectively becomes partitioned. That is, two nodesoptimization, Route Errors thatwish to communicate are not within transmission range of each other, and therearenot enough other mobile nodes between themdiscovered by the packet's originator (such that Error.Source_Address is equal toform a sequence of hops through which they can forward packets. IfError.Destination_Address) SHOULD be processed internally. Such processing should invoke all the steps that would be taken if anewRouteDiscoveryError option wasinitiated for eachcreated, transmitted, received, and processed, but an actual packetsent by a node in this situation,containing alarge number of unproductiveRouteRequest packets wouldError option SHOULD NOT bepropagated throughout the subsettransmitted. 7.5.4. Processing a Route Error Option Upon receipt ofthe ad hoc network reachablea Route Error via any mechanism, a node SHOULD remove any route fromthis node. In order to reduceits Route Cache that uses theoverhead from such route discoveries, we use exponential backoffhop (Error.Source_Address, Error.Index tolimitError.Unreachable_Address). This includes all Route Errors overheard, and those processed internally as described in Section 7.5.3. When therate at which new route discoveries may be initiated from anynode identified by Error.Destination_Address receives the Route Error, it SHOULD verify that the source route responsible for delivering the Route Error includes the sametarget. Ifhops as thenode attemptsworking prefix of the original packet's source route (Error.Destination_Address tosend additional data packets to this same node more frequently than this limit, the subsequent packets SHOULD be bufferedError.Source_Address). If any hop listed in theSend Buffer until a Route Replyworking prefix isreceived, but it MUST NOT initiate a newnot included in the RouteDiscovery untilError's source route, then theminimum allowable interval between new route discoveries for this target has been reached. This limitation onoriginator SHOULD forward themaximum rate of route discoveries forRoute Error back along thesame target is similarworking prefix (Error.Destination_Address to Error.Source_Address) so that each node along themechanism required by Internet nodes to limitworking prefix will remove therate at which ARP requests are sent to any single IP address [1]. 7.7. Improved Handling ofinvalid route from its RouteErrors All nodes SHOULD process all ofCache. If the node processing a Route Errormessages they receive, regardless of whether the nodeoption discovers its home address is Error.Destination_Address and thedestinationpacket contains additional Route Error option(s) later on the inside of theRoute Error, is forwardingHop by Hop options header, we call the additional RouteError, or promiscuously overhearsErrors nested Route Errors. The node MUST deliver the first nested RouteError. Since aError to Nested_Error.Destination_Address, performing Route Discovery if needed. It does this by removing the Route Errorpacket names both ends ofoption listing itself as thehop that is no longer valid, any ofError.Destination_Address, finding thenodes receivingfirst nested Route Error option, and originating theerrorremaining packetmay update their Route CachestoreflectNested_Error.Destination_Address. This mechanism allows for thefactproper handling of Route Errors thatthe two nodes indicated in the packet can no longer directly communicate. A node receivingare discovered while delivering a RouteError packet simply searches its Route Cache for any routes using this hop. For each such route found, the route is truncatedError. 7.5.5. Salvaging a Packet When node A attempts to salvage a packet originated atthis hop. All nodes onnode S and destined for node D, it MUST perform the following steps: 1. Generate and send a Route Error to A as explained in Section 7.5.3. 2. Call Route_Cache.Get() to determine if it has a cached source routebefore this hop are still reachable on this route, but subsequent nodes are not. An experimental optimizationtoimprovethehandling of errorspacket's ultimate destination D (which isto supportthecaching of "negative" informationlast Address listed in the Routing Header). 3. If node A does not have anode'scached route for node D, it MUST discard the packet. DONE. 4. Otherwise, let Salvage_Address[1] through Salvage_Address[m] be the sequence of hops returned from the Route Cache. Initialize the following fields in the packet's header: RT.Segments_Left = m - 2; RT.S = 1 RT.Address[1] = Home address of Node A RT.Address[2] = Salvage.Address[1] ... RT.Address[n] = Salvage.Address[m] ThegoalIP Source Address ofnegative information is to record that a given route was tried and found not to work, so that ifthesame routepacket MUST remain unchanged. When the Routing Header in the outgoing packet isdiscovered again shortly afterprocessed, RT.Address[2], will be copied to thefailure,IP Destination Address field. 8. Optimizations A number of optimizations can be added to the basic operation of RouteCacheDiscovery and Route Maintenance as described in Sections 7.4 and 7.5 that canignore or downgradereduce themetricnumber of overhead packets and improve thefailed route. We have not currently included this cachingaverage efficiency ofnegative information in our simulations, since it appears to be unnecessary if nodes also promiscuously receive Route Error packets. 8.the routes used on data packets. This section discusses some of those optimizations. 8.1. Leveraging the Route Cache The data in a node's Route Cache may be stored in any format, but the active routes in its cache form a tree of routes, rooted at this node, to other nodes in the ad hoc network. For example, the illustration below shows an ad hoc network of six mobile nodes, in which mobile node A has earlier completed a Route Discovery for mobile node D and has cached a route to D through B and C: B->C->D +---+ +---+ +---+ +---+ | A |---->| B |---->| C |---->| D | +---+ +---+ +---+ +---+ +---+ | F | +---+ +---+ | E | +---+ Since nodes B and C are on the route to D, node A also learns the route to both of these nodes from its Route Discovery for D. If A later performs a Route Discovery and learns the route to E through B and C, it can represent this in its Route Cache with the addition of the single new hop from C to E. If A then learns it can reach C in a single hop (without needing to go through B), A SHOULD use this new route to C to also shorten the routes to D and E in its Route Cache. 8.1.1. Promiscuous Learning of Source Routes A node can add entries to its Route Cache any time it learns a new route. In particular, when a node forwards a data packet as an intermediate hop on the route in that packet, the forwarding node is able to observe the entire route in the packet. Thus, for example, when any intermediate node B forwards packets from A to D, B SHOULD add the source route information from that packet's Routing Header to its own Route Cache. If a node forwards a Route Reply packet, it SHOULD also add the source route information from the route record being returned in the Route Reply, to its own Route Cache. In addition, since all wireless network transmissions at the physical layer are inherently broadcast, it may be possible for a node to configure its network interface into promiscuous receive mode, such that the node is able to receive all packets without link layer address filtering. In this case, the node MAY add to its Route Cache the route information from any packet it can overhear. 8.2. Preventing Route Reply Storms The ability for nodes to reply to a Route Request not targeted at them by using their Route Caches can result in a Route Reply storm. If a node broadcasts a Route Request for a node that its neighbors have in their Route Caches, each neighbor may attempt to send a Route Reply, thereby wasting bandwidth and increasing the rate of collisions in the area. For example, in the network shown in Section 8.1, if both node A and node B receive F's Route Request, they will both attempt to reply from their Route Caches. Both will send their Replies at about the same time since they receive the broadcast at about the same time. Particularly when more than the two mobile nodes in this example are involved, these simultaneous replies from the mobile nodes receiving the broadcast may create packet collisions among some or all of these replies and may cause local congestion in the wireless network. In addition, it will often be the case that the different replies will indicate routes of different lengths. For example, A's Route Reply will indicate a route to D that is one hop longer than that in B's reply. For interfaces which can promiscuously listen to the channel, mobile nodes SHOULD use the following algorithm to reduce the number of simultaneous replies by slightly delaying their Route Reply: 1. Pick a delay period d = H * (h - 1 + r) where h is the length in number of network hops for the route to be returned in this node's Route Reply, r is a random number between 0 and 1, and H is a small constant delay to be introduced per hop. 2. Delay transmitting the Route Reply from this node for a period of d. 3. Within the delay period, promiscuously receive all packets at this node. If a packet is received by this node during the delay period that is addressed to the target of this Route Discovery (the target is the final destination address for the packet, through any sequence of intermediate hops), and if the length of the route on this packet is less than h, then cancel the delay timer and do not transmit the Route Reply from this node; this node may infer that the initiator of this Route Discovery has already received a Route Reply, giving an equally good or better route. 8.3. Piggybacking on Route Discoveries As described in Section 4.1, when one node needs to send a packet to another, if the sender does not have a route cached to the destination node, it must initiate a Route Discovery, buffering the original packet until the Route Reply is returned. The delay for Route Discovery and the total number of packets transmitted can be reduced by allowing data to be piggybacked on Route Request packets. Since some Route Requests may be propagated widely within the ad hoc network, though, the amount of data piggybacked must be limited. We currently use piggybacking when sending a Route Reply or a Route Error packet, since both are naturally small in size. Small data packets such as the initial SYN packet opening a TCP connection [13] could easily be piggybacked. One problem, however, arises when piggybacking on Route Request packets. If a Route Request is received by a node that replies to the request based on its Route Cache without propagating the Request (Section 8.1), the piggybacked data will be lost if the node simply discards the Route Request. In this case, before discarding the packet, the node must construct a new packet containing the piggybacked data from the Route Request packet. The source route in this packet MUST be constructed to appear as if the new packet had been sent by the initiator of the Route Discovery and had been forwarded normally to this node. Hence, the first portion of the route is taken from the accumulated route record in the Route Request packet and the remainder of the route is taken from this node's Route Cache. The sender address in the packet MUST also be set to the initiator of the Route Discovery. Since the replying node will be unable to correctly recompute an Authentication header for the split off piggybacked data, data covered by an Authentication header SHOULD NOT be piggybacked on Route Request packets. 8.4. Discovering Shorter Routes Once a route between a packet source and a destination has been discovered, the basic DSR protocol MAY continue to use that route for all traffic from the source to the destination as long as it continues to work, even if the nodes move such that a shorter route becomes possible. In many cases, the basic Route Maintenance procedure will discover the shorter route, since if a node moves enough to create a shorter route, it will likely also move out of transmission range of at least one hop on the existing route. Furthermore, when a data packet is received as the result of operating in promiscuous receive mode, the node checks if the Routing Header packet contains its address in the unprocessed portion of the source route (Address[NumAddrs - SegLft] to Address[NumAddrs]). If so, the node knows that packet could bypass the unprocessed hops preceding it in the source route. The node then sends what is called a gratuitous Route Reply message to the packet's source, giving it the shorter route without these hops. The following algorithm describes how a node A should process packets with an IP.Destination_Address not addressed to A or the IP broadcast address or a multicast address that are received as a result of A being in promiscuous receive mode: 1. If the packet is not a data packet containing a Routing Header, drop the packet. DONE. 2. If the home address of this node does not appear in the portion of the source route that has not yet been processed (indicated by Segments Left), then drop the packet. DONE. 3. Otherwise, the node B that just transmitted the packet (indicated by Address[NumAddrs - SegLft - 1]) can communicate directly with this node A. Create a Route Reply. The Route Reply MUST list the entire source route contained in the received packet with the exception of the intermediate nodes between node B and node A. 4. Send this gratuitous Route Reply to the node listed as the IP.Source_Address of the received packet. If Route Discovery is required it MAY be initiated, or the gratuitous Route Reply packet MAY be dropped. 8.5. Rate Limiting the Route Discovery Process One common error condition that must be handled in an ad hoc network is the case in which the network effectively becomes partitioned. That is, two nodes that wish to communicate are not within transmission range of each other, and there are not enough other mobile nodes between them to form a sequence of hops through which they can forward packets. If a new Route Discovery was initiated for each packet sent by a node in this situation, a large number of unproductive Route Request packets would be propagated throughout the subset of the ad hoc network reachable from this node. In order to reduce the overhead from such Route Discoveries, we use exponential back-off to limit the rate at which new Route Discoveries may be initiated from any node for the same target. If the node attempts to send additional data packets to this same node more frequently than this limit, the subsequent packets SHOULD be buffered in the Send Buffer until a Route Reply is received, but it MUST NOT initiate a new Route Discovery until the minimum allowable interval between new Route Discoveries for this target has been reached. This limitation on the maximum rate of Route Discoveries for the same target is similar to the mechanism required by Internet nodes to limit the rate at which ARP requests are sent to any single IP address [1]. 8.6. Improved Handling of Route Errors All nodes SHOULD process all of the Route Error messages they receive, regardless of whether the node is the destination of the Route Error, is forwarding the Route Error, or promiscuously overhears the Route Error. Since a Route Error packet names both ends of the hop that is no longer valid, any of the nodes receiving the error packet may update their Route Caches to reflect the fact that the two nodes indicated in the packet can no longer directly communicate. A node receiving a Route Error packet simply searches its Route Cache for any routes using this hop. For each such route found, the route is effectively truncated at this hop. All nodes on the route before this hop are still reachable on this route, but subsequent nodes are not. An experimental optimization to improve the handling of errors is to support the caching of "negative" information in a node's Route Cache. The goal of negative information is to record that a given route was tried and found not to work, so that if the same route is discovered again shortly after the failure, the Route Cache can ignore or downgrade the metric of the failed route. We have not currently included this caching of negative information in our simulations, since it appears to be unnecessary if nodes also promiscuously receive Route Error packets. 9. Constants BROADCAST_JITTER 10 millisecondsID_FIFO_SIZE 8 identifiers INVALID_INTERFACE_INDEX 0xFF MAX_EXPLICIT_REXMIT 3 attempts MAX_RTDISCOV_INTERVAL 120 secondsMAX_ROUTE_LEN 15 nodesRING0_TIMEOUT 30 millisecondsInterface Indexes IF_INDEX_INVALID 0x7F IF_INDEX_MA 0x7E IF_INDEX_ROUTER 0x7D Route Cache ROUTE_CACHE_TIMEOUT 300 seconds Send Buffer SEND_BUFFER_TIMEOUT 30 seconds9.Request Table MAX_REQUEST_ENTRIES 32 nodes MAX_REQUEST_IDS 8 identifiers MAX_REQUEST_REXMT 16 retransmissions MAX_REQUEST_PERIOD 10 seconds REQUEST_PERIOD 500 milliseconds RING0_REQUEST_TIMEOUT 30 milliseconds Retransmission Buffer DSR_RXMT_BUFFER_SIZE 50 packets Retransmission Timer DSR_MAXRXTSHIFT 2 10. IANA Considerations This document proposes the use of the Destination Options header and the Hop-by-Hop Options header, originally defined for IPv6, in IPv4. The Next Header values indicating these two extension headers thus must be reserved within the IPv4 Protocol number space. Furthermore, this document defines four new types ofIPv6destinationoption,options, each of which must be assigned an Option Type value: - The DSR Route Request option, described in Section5.1.16.1.1 - The DSR Route Reply option, described in Section5.1.26.2.1 - The DSR Route Error option, described in Section5.1.36.2.2 - The DSR Acknowledgment option, described in Section5.1.46.2.3 DSR also requires a routing header Routing Type be allocated for the DSR Source Route defined insection 5.2.Section 6.3. In IPv4, we require two new protocol numbers be issued to identify the next header as either an IPv6-style destination option, or an IPv6-style routing header. Other protocols can make use of these protocol numbers as nodes that support them will processes any included destination options or routing headers according to the normal IPv6 semantics.10.11. Security Considerations This document does not specificallyaddress security concerns. This document does assume that all nodes participating in the DSR protocol do so in good faith and with out malicious intent to corrupt the routing ability of the network. In mission-oriented environments where all the nodes participating in the DSR protocol share a common goal that motivates their participation in the protocol, the communications between the nodes can be encrypted at the physical channel or link layer to prevent attack by outsiders. Location of DSR Functions in the ISO Model When designing DSR, we had to determine at what level within the protocol hierarchy to implement source routing. We considered two different options: routing at the link layer (ISO layer 2) and routing at the network layer (ISO layer 3). Originally, we opted to route at the link layer for the following reasons: - Pragmatically, running the DSR protocol at the link layer maximizes the number of mobile nodes that can participate in ad hoc networks. For example, the protocol can route equally well between IP [12], IPv6 [4], and IPX [5] nodes. - Historically, DSR grew from our contemplation of a multihop ARP protocol [6, 7] and source routing bridges [10]. ARP [11] is a layer 2protocol. - Technically, we designed DSR to be simple enough thataddress security concerns. This document does assume thatit could be implemented directlyall nodes participating innetwork interface cards, well belowthelayer 3 software within a mobile node. We see great potential forDSRrunning between cloudsprotocol do so in good faith and with out malicious intent to corrupt the routing ability ofmobilethe network. In mission-oriented environments where all the nodesaround fixed base stations.participating in the DSRwould act to transparently fillprotocol share a common goal that motivates their participation in thecoverage gapsprotocol, the communications betweenbase stations. Mobilethe nodesthat would otherwisecan beunable to communicate withencrypted at thebase station due to factors such as distance, fading,physical channel orlocal interference sources could then reach the base station through their peers. Ultimately, however, we decidedlink layer todesignprevent attack by outsiders. Location of DSRas a layer 3 protocol since this isFunctions in theonly layer at whichISO Reference Model When designing DSR, wecould realistically support nodes with multiple interfaces of different types. Implementation Status We have implemented Dynamic Source Routing (DSR) under the FreeBSD 2.2.2 operating system running on Intel x86 platforms. FreeBSD is based on a variety of free software, including 4.4 BSD Lite from the University of California, Berkeley. Acknowledgments The protocol described in this draft has been designedhad to determine at what level within theCMU Monarch Project, a research project at Carnegie Mellon University which is developing adaptive networking protocols andprotocolinterfaceshierarchy toallow truly seamless wirelessimplement source routing. We considered two different options: routing at the link layer (ISO layer 2) andmobile host networking [8, 14]. The current members ofrouting at theCMU Monarch Project include: - Josh Broch - Yih-Chun Hu - Jorjeta Jetcheva - David B. Johnson - David A. Maltz Areas for Refinement We are currently workingnetwork layer (ISO layer 3). Originally, we opted torefineroute at theDSR protocol inlink layer for the followingways:reasons: -ImprovePragmatically, running thealgorithms and data structures used byDSR protocol at theRoute Cache. We currently representlink layer maximizes theRoute Cache as a directed acyclic treenumber ofpaths branching out from a rootmobile nodes thatrepresents the node owningcan participate in ad hoc networks. For example, theRoute Cache. However, each sourceprotocol can routelearned by the Route Cache effectively describes the interconnectedness of all the hops listed on the route,equally well between IPv4 [12], IPv6 [4], andcan be treated as a typeIPX [5] nodes. - Historically, DSR grew from our contemplation ofpartial information Link State Packet as one would find inaLink Statemulti-hop ARP protocol [6, 7] and source routingalgorithm. By generalizing the Route Cache tobridges [10]. ARP [11] is agraph of all known links between all known nodes,layer 2 protocol. - Technically, we designed DSR to be simple enough that that itmaycould bepossible to better leverageimplemented directly in network interface cards, well below theinformationlayer 3 software within anode overhears. - Supportmobile node. We see great potential forbetter route selection. In orderDSR running between clouds of mobile nodes around fixed base stations. DSR would act toselecttransparently fill in thebest source route to send a packet with,coverage gaps between base stations. Mobile nodesneedthat would otherwise beableunable to communicate with the base station due toevaluatefactors such as distance, fading, or local interference sources could then reach thecosts/benefits of each ofbase station through theircached routespeers. Ultimately, however, we decided to specify DSR as a layer 3 protocol since this is thedestination. If those routes involve forwarding throughonly layer at which we could realistically support nodes withmore than one interface, some routes may be better suited to the traffic type because the bandwidth/range/latency/error-rate characteristics of of themultiple interfacesused on those routes best match the needs of the traffic type. The Route Request and Route Reply option format must be extended to enable node to report the propertiesof different types. Implementation Status We have implemented Dynamic Source Routing (DSR) under theinterfacesFreeBSD 2.2.7 operating system running on Intel x86 platforms. FreeBSD is based onthe route, as well as the interface index used in basic DSR forwarding. - Improved Route Discovery algorithms. We are investigating ways to cancelapropagating Route Request if the targetvariety of free software, including 4.4 BSD Lite from therequestUniversity of California, Berkeley. Acknowledgments The protocol described in this draft hasalreadybeenfound in another part ofdesigned within thenetwork. Similarly, we are studying various ring-search algorithms in caseCMU Monarch Project, amore sophisticated algorithm might perform better thanresearch project at Carnegie Mellon University which is developing adaptive networking protocols and protocol interfaces to allow truly seamless wireless and mobile node networking [8, 14]. The current members of the2-step algorithm we currently use.CMU Monarch Project include: - Josh Broch - Yih-Chun Hu - Jorjeta Jetcheva - David B. Johnson - Qifa Ke - David A. Maltz References [1] R. Braden, editor. Requirements for Internet Hosts -- Communication Layers. RFC 1122, October 1989. [2] Scott Bradner. Key words for use in RFCs to Indicate Requirement Levels. RFC 2119, March 1997. [3] Scott Corson and Joseph Macker. Mobile Ad Hoc Networking (MANET): Routing Protocol Performance Issues and Evaluation Considerations. Internet-Draft, draft-ietf-manet-issues-00.txt, September 1997. Work in progress. [4] Stephen E. Deering and Robert M. Hinden. Internet Protocol, Version 6 (IPv6) Specification. Internet-Draft, draft-ietf-ipngwg-ipv6-spec-v2-01.txt, November 1997. Work in progress. [5] IPX Router Specification. Novell Part Number 107-000029-001, Document Version 1.30, March 1996. [6] David B. Johnson. Routing in ad hoc networks of mobile hosts. In Proceedings of the IEEE Workshop on Mobile Computing Systems and Applications, pages 158--163, December 1994. [7] David B. Johnson and David A. Maltz. Dynamic source routing in ad hoc wireless networks. In Mobile Computing, edited by Tomasz Imielinski and Hank Korth, chapter 5, pages 153--181. Kluwer Academic Publishers, 1996. [8] David B. Johnson and David A. Maltz. Protocols for adaptive wireless and mobile networking. IEEE Personal Communications, 3(1):34--42, February 1996. [9] Charles Perkins, editor. IP Mobility Support. RFC 2002, October 1996. [10] Radia Perlman. Interconnections: Bridges and Routers. Addison-Wesley, Reading, Massachusetts, 1992. [11] David C. Plummer. An Ethernet Address Resolution Protocol: Or Converting Network Protocol Address to 48.bit Ethernet Addresses for Transmission on Ethernet Hardware. RFC 826, November 1982. [12] J. Postel, editor. Internet Protocol. RFC 791, September 1981. [13] J. Postel, editor. Transmission Control Protocol. RFC 793, September 1981. [14] The CMU Monarch Project. http://www.monarch.cs.cmu.edu/. Computer Science Department, Carnegie Mellon University. [15] J. Reynolds and J. Postel. Assigned Numbers. RFC 1700, October 1994. Chair's Address The Working Group can be contacted via its current chairs: M. Scott Corson Institute for Systems Research University of Maryland College Park, MD 20742 USA Phone: +1 301 405-6630 Email: corson@isr.umd.edu Joseph Macker Information Technology Division Naval Research Laboratory Washington, DC 20375 USA Phone: +1 202 767-2001 Email: macker@itd.nrl.navy.mil Authors' Addresses Questions about this document can also be directed to the authors: Josh Broch Carnegie Mellon University Electrical and Computer EngineeringDepartment5000 Forbes Avenue Pittsburgh, PA15213-389115213-3890 USA Phone: +1 412 268-3056 Fax: +1 412 268-7196 Email:broch@andrew.cmu.edubroch@cs.cmu.edu David B. Johnson Carnegie Mellon University Computer Science Department 5000 Forbes Avenue Pittsburgh, PA 15213-3891 USA Phone: +1 412 268-7399 Fax: +1 412 268-5576 Email: dbj@cs.cmu.edu David A. Maltz Carnegie Mellon University Computer Science Department 5000 Forbes Avenue Pittsburgh, PA 15213-3891 USA Phone: +1 412 268-3621 Fax: +1 412 268-5576 Email: dmaltz@cs.cmu.edu