view Side-By-Side changes
IETF MANET Working Group David B. Johnson, Rice University INTERNET-DRAFT David A. Maltz,AON Networks 21Carnegie Mellon University 24 February20022003 Yih-Chun Hu, Rice UniversityJorjeta G. Jetcheva, Carnegie Mellon UniversityThe Dynamic Source Routing Protocol for Mobile Ad Hoc Networks (DSR)<draft-ietf-manet-dsr-07.txt><draft-ietf-manet-dsr-08.txt> Status of This Memo This document is an Internet-Draft and is subject to all provisions of Section 10 of RFC 2026. 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". The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft is a submission to the IETF Mobile Ad Hoc Networks (MANET) Working Group. Comments on this draft may be sent to the Working Group at manet@itd.nrl.navy.mil, or may be sent directly to the authors. Johnson, et al Expires2124 August20022003 [Page i] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 Abstract The Dynamic Source Routing protocol (DSR) is a simple and efficient routing protocol designed specifically for use in multi-hop wireless ad hoc networks of mobile nodes. DSR allows the network to be completely self-organizing and self-configuring, without the need for any existing network infrastructure or administration. The protocol is composed of the two main mechanisms of "Route Discovery" and "Route Maintenance", which work together to allow nodes to discover and maintainsourceroutes to arbitrary destinations in the ad hoc network.The use of source routing allows packet routing to be trivially loop-free, avoids the need for up-to-date routing information in the intermediate nodes through which packets are forwarded, and allows nodes forwarding or overhearing packets to cache the routing information in them for their own future use.All aspects of the protocol operate entirely on-demand, allowing the routing packet overhead of DSR to scale automatically to only that needed to react to changes in the routes currently in use.This document specifiesThe protocol allows multiple routes to any destination and allows each sender to select and control theoperationroutes used in routing its packets, for example for use in load balancing or for increased robustness. Other advantages of the DSR protocol include easily guaranteed loop-free routing, support forrouting unicast IPv4 packetsuse inmulti-hop wireless ad hoc networks.networks containing unidirectional links, use of only "soft state" in routing, and very rapid recovery when routes in the network change. The DSR protocol is designed mainly for mobile ad hoc networkswithof up toaroundabout two hundred nodes, and is designed tocopework well withrelativelyeven very high rates of mobility. This document specifies the operation of the DSR protocol for routing unicast IPv4 packets. Johnson, et al Expires2124 August20022003 [Page ii] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 Contents Status of This Memo i Abstract ii 1. Introduction 1 2. Assumptions 3 3. DSR Protocol Overview 5 3.1. Basic DSR Route Discovery . . . . . . . . . . . . . . . . 5 3.2. Basic DSR Route Maintenance . . . . . . . . . . . . . . .78 3.3. Additional Route Discovery Features . . . . . . . . . . .910 3.3.1. Caching Overheard Routing Information . . . . . .910 3.3.2. Replying to Route Requests using Cached Routes .1011 3.3.3. Preventing Route Reply Storms . . . . . . . . . .1112 3.3.4. Route Request Hop Limits . . . . . . . . . . . .1314 3.4. Additional Route Maintenance Features . . . . . . . . . .1415 3.4.1. Packet Salvaging . . . . . . . . . . . . . . . .1415 3.4.2. Queued Packets Destined over a Broken Link . . .1415 3.4.3. Automatic Route Shortening . . . . . . . . . . .1516 3.4.4. Increased Spreading of Route Error Messages . . .16 4. Conceptual Data Structures174.1. Route Cache .3.5. Optional DSR Flow State Extension . . . . . . . . . . . . 17 3.5.1. Flow Establishment . . . . . . . . . .17 4.2. Send Buffer. . . . . 18 3.5.2. Receiving and Forwarding Establishment Packets . 19 3.5.3. Sending Packets Along Established Flows . . . . . 19 3.5.4. Receiving and Forwarding Packets Sent Along Established Flows . . . . . . . . . . . . 204.3.3.5.5. Processing RouteRequest TableErrors . . . . . . . . . . . . . 21 3.5.6. Interaction with Automatic Route Shortening . . . 21 3.5.7. Loop Detection . . .21 4.4. Gratuitous Route Reply Table. . . . . . . . . . . . . . 224.5. Network Interface Queue and Maintenance Buffer3.5.8. Acknowledgement Destination . . . . .23 4.6. Blacklist. . . . . . 22 3.5.9. Crash Recovery . . . . . . . . . . . . . . . . . 22 3.5.10. Rate Limiting .24 5. DSR Header Format 25 5.1. Fixed Portion of DSR Header. . . . . . . . . . . . . . .26 5.2. Route Request Option. . 22 3.5.11. Interaction with Packet Salvaging . . . . . . . . 23 4. Conceptual Data Structures 24 4.1. Route Cache . . . . . . . .28 5.3. Route Reply Option. . . . . . . . . . . . . . . 24 4.2. Send Buffer . . . .30 5.4. Route Error Option. . . . . . . . . . . . . . . . . . .32 5.5. Acknowledgment27 4.3. Route RequestOption . .Table . . . . . . . . . . . .35 5.6. Acknowledgment Option. . . . . . . 28 4.4. Gratuitous Route Reply Table . . . . . . . . . . .36 5.7. DSR Source Route Option. . . 29 4.5. Network Interface Queue and Maintenance Buffer . . . . . 30 Johnson, et al Expires 24 August 2003 [Page iii] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 4.6. Blacklist . . . . . . . . .37 5.8. Pad1 Option. . . . . . . . . . . . . . . 31 5. Additional Conceptual Data Structures for Flow State Extension 32 5.1. Flow Table . . . . . . . .39 5.9. PadN Option. . . . . . . . . . . . . . . 32 5.2. Automatic Route Shortening Table . . . . . . . .40 Johnson, et al Expires 21 August 2002 [Page iii] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 6. Detailed Operation 41 6.1. General Packet Processing. . . . 33 5.3. Default Flow ID Table . . . . . . . . . . . .41 6.1.1. Originating a Packet. . . . . . 33 6. DSR Options Header Format 35 6.1. Fixed Portion of DSR Options Header . . . . . . . .41 6.1.2. Adding a DSR Header to a Packet. . . 36 6.2. Route Request Option . . . . . .41 6.1.3. Adding a DSR Source Route Option to a Packet. .42 6.1.4. Processing a Received Packet. . . . . . . . . .43 6.1.5. Processing a Received DSR Source39 6.3. Route Reply Option . .45 6.2. Route Discovery Processing .. . . . . . . . . . . . . .48 6.2.1. Originating a Route Request .. . . 41 6.4. Route Error Option . . . . . . .48 6.2.2. Processing a Received Route Request Option. . .50 6.2.3. Generating a Route Reply using the Route Cache.52 6.2.4. Originating a Route Reply. . . . . . . . 43 6.4.1. Node Unreachable Type-Specific Information . . . 45 6.4.2. Flow State Not Supported Type-Specific Information 45 6.4.3. Option Not Supported Type-Specific Information .54 6.2.5. Processing a Received Route Reply45 6.5. Acknowledgement Request Option . . . .56 6.3. Route Maintenance Processing. . . . . . . . . 46 6.6. Acknowledgement Option . . . . .57 6.3.1. Using Link-Layer Acknowledgments. . . . . . . .57 6.3.2. Using Passive Acknowledgments. . . . 47 6.7. DSR Source Route Option . . . . . .58 6.3.3. Using Network-Layer Acknowledgments. . . . . . .59 6.3.4. Originating a Route Error. . . . 48 6.8. Pad1 Option . . . . . . . .62 6.3.5. Processing a Received Route Error Option. . . .63 6.3.6. Salvaging a Packet. . . . . . . . . . . 50 6.9. PadN Option . . . .64. . . . . . . . . . . . . . . . . . . 51 7.Multiple Interface Support 66 8. Fragmentation and Reassembly 67 9. Protocol ConstantsAdditional Header Formats andConfiguration Variables 68 10. IANA Considerations 69 11. Security Considerations 70 Appendix A. Link-MaxLife Cache Description 71 Appendix B. Location ofOptions for Flow State Extension 52 7.1. DSR Flow State Header . . . . . . . . . . . . . . . . . . 53 7.2. Options and Extensions inthe ISO Network Reference Model 73 Appendix C. ImplementationDSR Options Header . . . . . . 54 7.2.1. Timeout Option . . . . . . . . . . . . . . . . . 54 7.2.2. Destination andEvaluation Status 74 Changes fromFlow ID Option . . . . . . . . . 55 7.2.3. New Error Type Value for Unknown Flow . . . . . . 56 7.2.4. New Error Type Value for Default Flow Unknown . . 57 7.2.5. Acknowledgement Request Option PreviousVersion of the Draft 75 Acknowledgements 76 References 77 Chair'sHop Address80 Authors' Addresses 81 Johnson, et al Expires 21 August 2002 [Page iv] INTERNET-DRAFT The DynamicExtension . . . . . . 58 8. Detailed Operation 59 8.1. General Packet Processing . . . . . . . . . . . . . . . . 59 8.1.1. Originating a Packet . . . . . . . . . . . . . . 59 8.1.2. Adding a DSR Options Header to a Packet . . . . . 59 8.1.3. Adding a DSR SourceRouting Protocol 21 February 2002 1. IntroductionRoute Option to a Packet . . 60 8.1.4. Processing a Received Packet . . . . . . . . . . 61 8.1.5. Processing a Received DSR Source Route Option . . 63 8.1.6. Handling an Unknown DSR Option . . . . . . . . . 65 8.2. Route Discovery Processing . . . . . . . . . . . . . . . 67 8.2.1. Originating a Route Request . . . . . . . . . . . 67 8.2.2. Processing a Received Route Request Option . . . 69 8.2.3. Generating a Route Reply using the Route Cache . 71 8.2.4. Originating a Route Reply . . . . . . . . . . . . 73 8.2.5. Processing a Received Route Reply Option . . . . 75 8.3. Route Maintenance Processing . . . . . . . . . . . . . . 76 Johnson, et al Expires 24 August 2003 [Page iv] INTERNET-DRAFT The Dynamic Source Routingprotocol (DSR) [13, 14]Protocol 24 February 2003 8.3.1. Using Link-Layer Acknowledgements . . . . . . . . 76 8.3.2. Using Passive Acknowledgements . . . . . . . . . 77 8.3.3. Using Network-Layer Acknowledgements . . . . . . 78 8.3.4. Originating a Route Error . . . . . . . . . . . . 81 8.3.5. Processing a Received Route Error Option . . . . 82 8.3.6. Salvaging a Packet . . . . . . . . . . . . . . . 83 8.4. Multiple Interface Support . . . . . . . . . . . . . . . 85 8.5. Fragmentation and Reassembly . . . . . . . . . . . . . . 86 8.6. Flow State Processing . . . . . . . . . . . . . . . . . . 87 8.6.1. Originating a Packet . . . . . . . . . . . . . . 87 8.6.2. Inserting a DSR Flow State Header . . . . . . . . 89 8.6.3. Receiving a Packet . . . . . . . . . . . . . . . 89 8.6.4. Forwarding a Packet Using Flow IDs . . . . . . . 94 8.6.5. Promiscuously Receiving a Packet . . . . . . . . 94 8.6.6. Operation where the Layer below DSR Decreases the IP TTL Non-Uniformly . . . . . . . . . 95 8.6.7. Salvage Interactions with DSR . . . . . . . . . . 95 9. Protocol Constants and Configuration Variables 96 10. IANA Considerations 97 11. Security Considerations 98 Appendix A. Link-MaxLife Cache Description 99 Appendix B. Location of DSR in the ISO Network Reference Model 101 Appendix C. Implementation and Evaluation Status 102 Changes from Previous Version of the Draft 104 Acknowledgements 105 References 106 Chair's Address 110 Authors' Addresses 111 Johnson, et al Expires 24 August 2003 [Page v] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 1. Introduction The Dynamic Source Routing protocol (DSR) [15, 16] is a simple and efficient routing protocol designed specifically for use in multi-hop wireless ad hoc networks of mobile nodes. Using DSR, the network is completely self-organizing and self-configuring, requiring no existing network infrastructure or administration. Network nodes cooperate to forward packets for each other to allow communication over multiple "hops" between nodes not directly within wireless transmission range of one another. As nodes in the network move about or join or leave the network, and as wireless transmission conditions such as sources of interference change, all routing is automatically determined and maintained by the DSR routing protocol. Since the number or sequence of intermediate hops needed to reach any destination may change at any time, the resulting network topology may be quite rich and rapidly changing. In designing DSR, we sought to create a routing protocol that had very low overhead yet was able to react very quickly to changes in the network. The DSR protocol provides highly reactive service in order to help ensure successful delivery of data packets in spite of node movement or other changes in network conditions. The DSR protocol is composed of two main mechanisms that work together to allow the discovery and maintenance of source routes in the ad hoc network: - Route Discovery is the mechanism by which a node S wishing to send a packet to a destination node D obtains a source route to D. Route Discovery is used only when S attempts to send a packet to D and does not already know a route to D. - Route Maintenance is the mechanism by which node 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 a link 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 for subsequent packets to D. Route Maintenance for this route is used only when S is actually sending packets to D. In DSR, Route Discovery and Route Maintenance each operate entirely "on demand". In particular, unlike other protocols, DSR requires no periodic packets of any kind at any layer within the network. For example, DSR does not use any periodic routing advertisement, link status sensing, or neighbor detection packets, and does not rely on these functions from any underlying protocols in the network. This entirely on-demand behavior and lack of periodic activity allows the number of overhead packets caused by DSR to scale all the way Johnson, et al Expires 24 August 2003 [Page 1] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 down to zero, when all nodes are approximately stationary with respect to each other and all routes needed for current communication have already been discovered. As nodes begin to move more or as communication patterns change, the routing packet overhead of DSR automatically scales to only that needed to track the routes currently in use. Network topology changes not affecting routes currently in use are ignored and do not cause reaction from the protocol. All state maintained by DSR is "soft state" [6], in that the loss of any state will not interfere with the correct operation of the protocol; all state is discovered as needed and can easily and quickly be rediscovered if needed after a failure without significant impact on the protocol. This use of only soft state allows the routing protocol to be very robust to problems such as dropped or delayed routing packets or node failures. In particular, a node in DSR that fails and reboots can easily rejoin the network immediately after rebooting; if the failed node was involved in forwarding packets for other nodes as an intermediate hop along one or more routes, it can also resume this forwarding quickly after rebooting, with no or minimal interruption to the routing protocol. In response to a single Route Discovery (as well as through routing information from other packets overheard), a node may learn and cache multiple routes to any destination. This support for multiple routes allows the reaction to routing changes to be much more rapid, since a node with multiple routes to a destination can try another cached route if the one it has been using should fail. This caching of multiple routes also avoids the overhead of needing to perform a new Route Discovery each time a route in use breaks. The sender of a packet selects and controls the route used for its own packets, which together with support for multiple routes also allows features such as load balancing to be defined. In addition, all routes used are easily guaranteed to be loop-free, since the sender can avoid duplicate hops in the routes selected. The operation of both Route Discovery and Route Maintenance in DSR are designed to allow unidirectional links and asymmetric routes to be easily supported. In particular, as noted in Section 2, in wireless networks, it is possible that a link between two nodes may not work equally well in both directions, due to differing antenna or propagation patterns or sources of interference. DSR allows such unidirectional links to be used when necessary, improving overall performance and network connectivity in the system. This document specifies the operation of the DSR protocol for routing unicast IPv4 packets in multi-hop wireless ad hoc networks. Advanced, optional features, such as Quality of Service (QoS) support and efficient multicast routing, and operation of DSR with IPv6 [7], are covered in other documents. The specification of DSR in this Johnson, et al Expires 24 August 2003 [Page 2] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 document provides a compatible base on which such features can be added, either independently or by integration with the DSR operation specified here. 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 [4]. 2. Assumptions The DSR protocol as described here is designed mainly for mobile ad hoc networks of up to about two hundred nodes, and is designed to work well with even very high rates of mobility. Other protocol features and enhancements that may allow DSR to scale to larger networks are outside the scope of this document. We assume in this document that all nodes wishing to communicate with other nodes within the ad hoc network are willing to participate fully in the protocols of the network. In particular, each node participating in the ad hoc network SHOULD also be willing to forward packets for other nodes in the network. The diameter of an ad hoc network is the minimum number of hops necessary for a packet to reach from any node located at one extreme edge of the ad hoc network to another node located at the opposite extreme. We assume that this diameter will often 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. We assume that a node receiving a corrupted packet can detect the error and discard the packet. Nodes within the ad hoc network MAY move at any time without notice, and MAY even move continuously, but we assume that the speed with which nodes move is moderate with respect to the packet transmission latency and wireless transmission range of the particular underlying network hardware in use. In particular, DSR can support very rapid rates of arbitrary node mobility, but we assume that nodes do not continuously move so rapidly as to make the flooding of every individual data packet the only possible routing protocol. A common feature of many network interfaces, including most current LAN hardware for broadcast media such as wireless, is the ability to operate the network interface in "promiscuous" receive mode. This mode causes 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, some of our optimizations can take advantage of its availability. Use of promiscuous mode does increase the software overhead on the CPU, Johnson, et al Expires 24 August 2003 [Page 3] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 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 suitable for implementation directly within a programmable network interface unit to avoid this overhead on the CPU [16]. Use of promiscuous mode may also increase the power consumption of the network interface hardware, depending on the design of the receiver hardware, and in such cases, DSR can easily be used without the optimizations that depend on promiscuous receive mode, or can be programmed to only periodically switch the interface into promiscuous mode. Use of promiscuous receive mode is entirely optional. Wireless communication ability between any pair of nodes may at times not work equally well in both directions, due for example to differing antenna or propagation patterns or sources of interference around the two nodes [1, 20]. That is, wireless communications between each pair of nodes will in many cases be able to operate bidirectionally, but at times the wireless link between two nodes may be only unidirectional, allowing one node to successfully send packets to the other while no communication is possible in the reverse direction. Although many routing protocols operate correctly only over bidirectional links, DSR can successfully discover and forward packets over paths that contain unidirectional links. Some MAC protocols, however, such as MACA [19], MACAW [2], or IEEE 802.11 [13], limit unicast data packet transmission to bidirectional links, due to the required bidirectional exchange of RTS and CTS packets in these protocols and due to the link-layer acknowledgement feature in IEEE 802.11; when used on top of MAC protocols such as these, DSR can take advantage of additional optimizations, such as the ability to reverse a source route to obtain a route back to the origin of the original route. The IP address used by a node using the DSR protocol MAY be assigned by any mechanism (e.g., static assignment or use of DHCP for dynamic assignment [8]), although the method of such assignment is outside the scope of this specification. Johnson, et al Expires 24 August 2003 [Page 4] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 3. DSR Protocol Overview This section provides an overview of the operation of the DSR protocol. The basic version of DSR uses explicit "source routing", in which each data packet sent carries in its header the complete, ordered list of nodes through which the packet will pass. This use of explicit source routing allows the sender to select and control the routes used for its own packets, supports the use of multiple routes to any destination (for example, for load balancing), and allows a simple guarantee that the routes used are loop-free; by including this source route in the header of each data packet, other nodes forwarding or overhearing any of these packets can also easily cache this routing information for future use. Section 3.1 describes this basic operation of Route Discovery, Section 3.2 describes basic Route Maintenance, and Sections 3.3 and 3.4 describe additional features of these two parts of DSR's operation. Section 3.5 then describes an optional, compatible extension to DSR, known as "flow state", that allows the routing of most packets without an explicit source route header in the packet, while still preserves the fundamental properties of DSR's operation. 3.1. Basic DSR Route Discovery When some source node originates a new packet addressed to some destination node, the source node places in the header of the packet a "source route" giving the sequence of hops that the packet is to follow on its way to the destination. Normally, the sender will obtain a suitable source route by searching its "Route Cache" of routes previously learned; if no route is found in its cache, it will initiate the Route Discovery protocol to dynamically find a new route to this destination node. In this case, we call the source node the "initiator" and the destination node the "target" of the Route Discovery. For example, suppose a node A is attempting to discover a route to node E. The Route Discovery initiated by node A in this example would proceed as follows: ^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D" | id=2 | id=2 | id=2 | id=2 +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |---->| D |---->| E | +-----+ +-----+ +-----+ +-----+ +-----+ | | | | v v v v To initiate the Route Discovery, node A transmits a "Route Request" as a single local broadcast packet, which is received by (approximately) all nodes currently within wireless transmission Johnson, et al Expires 24 August 2003 [Page 5] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 range of A, including node B in this example. Each Route Request identifies the initiator and target of the Route Discovery, and also contains a unique request identification (2, in this example), determined by the initiator of the Request. Each Route Request also contains a record listing the address of each intermediate node through which this particular copy of the Route Request has been forwarded. This route record is initialized to an empty list by the initiator of the Route Discovery. In this example, the route record initially lists only node A. When another node receives this Route Request (such as node B in this example), if it is the target of the Route Discovery, it returns a "Route Reply" to the initiator of the Route Discovery, giving a copy of the accumulated route record from the Route Request; when the initiator receives this Route Reply, it caches this route in its Route Cache for use in sending subsequent packets to this destination. Otherwise, if this node receiving the Route Request has recently seen another Route Request message from this initiator bearing this same request identification and target address, or if this node's own address is already listed in the route record in the Route Request, this node discards the Request. Otherwise, this node appends its own address to the route record in the Route Request and propagates it by transmitting it as a local broadcast packet (with the same request identification). In this example, node B broadcast the Route Request, which is received by node C; nodes C and D each also, in turn, broadcast the Request, resulting in a copy of the Request being received by node E. In returning the Route Reply to the initiator of the Route Discovery, such as in this example, node E replying back to node A, node E will typically examine its own Route Cache for a route back to A, and if found, will use it for the source route for delivery of the packet containing the Route Reply. Otherwise, E SHOULD perform its own Route Discovery for target node A, but to avoid possible infinite recursion of Route Discoveries, it MUST piggyback this Route Reply on the packet containing its own Route Request for A. It is also possible to piggyback other small data packets, such as a TCP SYN packet [31], on a Route Request using this same mechanism. Node E could instead simply reverse the sequence of hops in the route record that it is trying to send in the Route Reply, and use this as the source route on the packet carrying the Route Reply itself. For MAC protocols such as IEEE 802.11 that require a bidirectional frame exchange as part of the MAC protocol [13], the discovered source route MUST be reversed in this way to return the Route Reply since it tests the discovered route to ensure it is bidirectional before the Route Discovery initiator begins using the route; this route reversal also avoids the overhead of a possible second Route Discovery. Johnson, et al Expires 24 August 2003 [Page 6] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 However, this route reversal technique will prevent the discovery of routes using unidirectional links, and in wireless environments where the use of unidirectional links is permitted, such routes may in some cases be more efficient than those with only bidirectional links, or they may be the only way to achieve connectivity to the target node. When initiating a Route Discovery, the sending node saves a copy of the original packet (that triggered the Discovery) in a local buffer called the "Send Buffer". The Send Buffer contains a copy of each packet that cannot be transmitted by this node because it does not yet have a source route to the packet's destination. Each packet in the Send Buffer is logically associated with the time that it was placed into the Send Buffer and is discarded after residing in the Send Buffer for some timeout period; if necessary for preventing the Send Buffer from overflowing, a FIFO or other replacement strategy MAY also be used to evict packets even before they expire. While a packet remains in the Send Buffer, the node SHOULD occasionally initiate a new Route Discovery for the packet's destination address. However, the node MUST limit the rate at which such new Route Discoveries for the same address are initiated, since it is possible that the destination node is not currently reachable. In particular, due to the limited wireless transmission range and the movement of the nodes in the network, the network may at times become partitioned, meaning that there is currently no sequence of nodes through which a packet could be forwarded to reach the destination. Depending on the movement pattern and the density of nodes in the network, such network partitions may be rare or may be common. If a new Route Discovery was initiated for each packet sent by a node in such a partitioned network, 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, a node SHOULD use an exponential back-off algorithm to limit the rate at which it initiates new Route Discoveries for the same target, doubling the timeout between each successive Discovery initiated for the same target. If the node attempts to send additional data packets to this same destination node more frequently than this limit, the subsequent packets SHOULD be buffered in the Send Buffer until a Route Reply is received giving a route to this destination, but the node 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 for any single target IP address [3]. Johnson, et al Expires 24 August 2003 [Page 7] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 3.2. Basic DSR Route Maintenance When originating or forwarding a packet using a source route, each node transmitting the packet is responsible for confirming that data can flow over the link from that node to the next hop. For example, in the situation shown below, node A has originated a packet for node E using a source route through intermediate nodes B, C, and D: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |-->? | D | | E | +-----+ +-----+ +-----+ +-----+ +-----+ In this case, node A is responsible for the link from A to B, node B is responsible for the link from B to C, node C is responsible for the link from C to D, node D is responsible for the link from D to E. An acknowledgement can provide confirmation that a link is capable of carrying data, and in wireless networks, acknowledgements are often provided at no cost, either as an existing standard part of the MAC protocol in use (such as the link-layer acknowledgement frame defined by IEEE 802.11 [13]), or by a "passive acknowledgement" [18] (in which, for example, B confirms receipt at C by overhearing C transmit the packet when forwarding it on to D). If a built-in acknowledgement mechanism is not available, the node transmitting the packet can explicitly request a DSR-specific software acknowledgement be returned by the next node along the route; this software acknowledgement will normally be transmitted directly to the sending node, but if the link between these two nodes is unidirectional, this software acknowledgement could travel over a different, multi-hop path. After an acknowledgement has been received from some neighbor, a node MAY choose to not require acknowledgements from that neighbor for a brief period of time, unless the network interface connecting a node to that neighbor always receives an acknowledgement in response to unicast traffic. When a software acknowledgement is used, the acknowledgement request SHOULD be retransmitted up to a maximum number of times. A retransmission of the acknowledgement request can be sent as a separate packet, piggybacked on a retransmission of the original data packet, or piggybacked on any packet with the same next-hop destination that does not also contain a software acknowledgement. After the acknowledgement request has been retransmitted the maximum number of times, if no acknowledgement has been received, then the sender treats the link to this next-hop destination as currently "broken". It SHOULD remove this link from its Route Cache and SHOULD return a "Route Error" to each node that has sent a packet Johnson, et al Expires 24 August 2003 [Page 8] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 routed over that link since an acknowledgement was last received. For example, in the situation shown above, if C does not receive an acknowledgement from D after some number of requests, it would return a Route Error to A, as well as any other node that may have used the link from C to D since C last received an acknowledgement from D. Node A then removes this broken link from its cache; any retransmission of the original packet can be performed by upper layer protocols such as TCP, if necessary. For sending such a retransmission or other packets to this same destination E, if A has in its Route Cache another route to E (for example, from additional Route Replies from its earlier Route Discovery, or from having overheard sufficient routing information from other packets), it can send the packet using the new route immediately. Otherwise, it SHOULD perform a new Route Discovery for this target (subject to the back-off described in Section 3.1). Johnson, et al Expires 24 August 2003 [Page 9] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 3.3. Additional Route Discovery Features 3.3.1. Caching Overheard Routing Information A node forwarding or otherwise overhearing any packet SHOULD add all usable routing information from that packet to its own Route Cache. The usefulness of routing information in a packet depends on the directionality characteristics of the physical medium (Section 2), as well as the MAC protocol being used. Specifically, three distinct cases are possible: - Links in the network frequently are capable of operating only unidirectionally (not bidirectionally), and the MAC protocol in use in the network is capable of transmitting unicast packets over unidirectional links. - Links in the network occasionally are capable of operating only unidirectionally (not bidirectionally), but this unidirectional restriction on any link is not persistent, almost all links are physically bidirectional, and the MAC protocol in use in the network is capable of transmitting unicast packets over unidirectional links. - The MAC protocol in use in the network is not capable of transmitting unicast packets over unidirectional links; only bidirectional links can be used by the MAC protocol for transmitting unicast packets. For example, the IEEE 802.11 Distributed Coordination Function (DCF) MAC protocol [13] is capable of transmitting a unicast packet only over a bidirectional link, since the MAC protocol requires the return of a link-level acknowledgement packet from the receiver and also optionally requires the bidirectional exchange of an RTS and CTS packet between the transmitter and receiver nodes. In the first case above, for example, the source route used in a data packet, the accumulated route record in a Route Request, or the route being returned in a Route Reply SHOULD all be cached by any node in the "forward" direction; any node SHOULD cache this information from any such packet received, whether the packet was addressed to this node, sent to a broadcast (or multicast) MAC address, or overheard while the node's network interface is in promiscuous mode. However, the "reverse" direction of the links identified in such packet headers SHOULD NOT be cached. Johnson, et al Expires 24 August 2003 [Page 10] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 For example, in the situation shown below, node A is using a source route to communicate with node E: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |---->| D |---->| E | +-----+ +-----+ +-----+ +-----+ +-----+ As node C forwards a data packet along the route from A to E, it SHOULD add to its cache the presence of the "forward" direction links that it learns from the headers of these packets, from itself to D and from D to E. Node C SHOULD NOT, in this case, cache the "reverse" direction of the links identified in these packet headers, from itself back to B and from B to A, since these links might be unidirectional. In the second case above, in which links may occasionally operate unidirectionally, the links described above SHOULD be cached in both directions. Furthermore, in this case, if node X overhears (e.g., through promiscuous mode) a packet transmitted by node C that is using a source route from node A to E, node X SHOULD cache all of these links as well, also including the link from C to X over which it overheard the packet. In the final case, in which the MAC protocol requires physical bidirectionality for unicast operation, links from a source route SHOULD be cached in both directions, except when the packet also contains a Route Reply, in which case only the links already traversed in this source route SHOULD be cached, but the links not yet traversed in this route SHOULD NOT be cached. 3.3.2. Replying to Route Requests using Cached Routes A node receiving a Route Request for which it is not the target, searches its own Route Cache for a route to the target of the Request. If found, the node generally returns a Route Reply to the initiator itself rather than forwarding the Route Request. In the Route Reply, this node sets the route record to list the sequence of hops over which this copy of the Route Request was forwarded to it, concatenated with the source route to this target obtained from its own Route Cache. However, before transmitting a Route Reply packet that was generated using information from its Route Cache in this way, a node MUST verify that the resulting route being returned in the Route Reply, after this concatenation, contains no duplicate nodes listed in the route record. For example, the figure below illustrates a case in Johnson, et al Expires 24 August 2003 [Page 11] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 which a Route Request for target E has been received by node F, and node F already has in its Route Cache a route from itself to E: +-----+ +-----+ +-----+ +-----+ | A |---->| B |- >| D |---->| E | +-----+ +-----+ \ / +-----+ +-----+ \ / \ +-----+ / >| C |- +-----+ | ^ v | Route Request +-----+ Route: A - B - C - F | F | Cache: C - D - E +-----+ The concatenation of the accumulated route record from the Route Request and the cached route from F's Route Cache would include a duplicate node in passing from C to F and back to C. Node F in this case could attempt to edit the route to eliminate the duplication, resulting in a route from A to B to C to D and on to E, but in this case, node F would not be on the route that it returned in its own Route Reply. DSR Route Discovery prohibits node F from returning such a Route Reply from its cache; this prohibition increases the probability that the resulting route is valid, since node F in this case should have received a Route Error if the route had previously stopped working. Furthermore, this prohibition means that a future Route Error traversing the route is very likely to pass through any node that sent the Route Reply for the route (including node F), which helps to ensure that stale data is removed from caches (such as at F) in a timely manner; otherwise, the next Route Discovery initiated by A might also be contaminated by a Route Reply from F containing the same stale route. If node F, due to this restriction on returning a Route Reply based on information from its Route Cache, does not return such a Route Reply, node F propagates the Route Request normally. 3.3.3. Preventing Route Reply Storms The ability for nodes to reply to a Route Request based on information in their Route Caches, as described in Section 3.3.2, could result in a possible Route Reply "storm" in some cases. In particular, if a node broadcasts a Route Request for a target node for which the node's neighbors have a route in their Route Caches, each neighbor may attempt to send a Route Reply, thereby wasting bandwidth and possibly increasing the number of network collisions in the area. Johnson, et al Expires 24 August 2003 [Page 12] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 For example, the figure below shows a situation in which nodes B, C, D, E, and F all receive A's Route Request for target G, and each has the indicated route cached for this target: +-----+ +-----+ | D |< >| C | +-----+ \ / +-----+ Cache: C - B - G \ / Cache: B - G \ +-----+ / -| A |- +-----+\ +-----+ +-----+ | | \--->| B | | G | / \ +-----+ +-----+ / \ Cache: G v v +-----+ +-----+ | E | | F | +-----+ +-----+ Cache: F - B - G Cache: B - G Normally, each of these nodes would attempt to reply from its own Route Cache, and they would thus all send their Route Replies at about the same time, since they all received the broadcast Route Request at about the same time. Such simultaneous Route Replies from different nodes all receiving the Route Request may cause local congestion in the wireless network and may create packet collisions among some or all of these Replies if the MAC protocol in use does not provide sufficient collision avoidance for these packets. In addition, it will often be the case that the different replies will indicate routes of different lengths, as shown in this example. In order to reduce these effects, if a node can put its network interface into promiscuous receive mode, it MAY delay sending its own Route Reply for a short period, while listening to see if the initiating node begins using a shorter route first. Specifically, this node MAY delay sending its own Route Reply for a random 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 floating point number between 0 and 1, and H is a small constant delay (at least twice the maximum wireless link propagation delay) to be introduced per hop. This delay effectively randomizes the time at which each node sends its Route Reply, with all nodes sending Route Replies giving routes of length less than h sending their Replies before this node, and all nodes sending Route Replies giving routes of length greater than h sending their Replies after this node. Johnson, et al Expires 24 August 2003 [Page 13] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 Within the delay period, this node promiscuously receives all packets, looking for data packets from the initiator of this Route Discovery destined for the target of the Discovery. If such a data packet received by this node during the delay period uses a source route of length less than or equal to h, this node may infer that the initiator of the Route Discovery has already received a Route Reply giving an equally good or better route. In this case, this node SHOULD cancel its delay timer and SHOULD NOT send its Route Reply for this Route Discovery. 3.3.4. Route Request Hop Limits Each Route Request message contains a "hop limit" that may be used to limit the number of intermediate nodes allowed to forward that copy of the Route Request. This hop limit is implemented using the Time-to-Live (TTL) field in the IP header of the packet carrying the Route Request. As the Request is forwarded, this limit is decremented, and the Request packet is discarded if the limit reaches zero before finding the target. This Route Request hop limit can be used to implement a variety of algorithms for controlling the spread of a Route Request during a Route Discovery attempt. For example, a node MAY use this hop limit to implement a "non-propagating" Route Request as an initial phase of a Route Discovery. A node using this technique sends its first Route Request attempt for some target node using a hop limit of 1, such that any node receiving the initial transmission of the Route Request will not forward the Request to other nodes by re-broadcasting it. This form of Route Request is called a "non-propagating" Route Request; it provides an inexpensive method for determining if the target is currently a neighbor of the initiator or if a neighbor node has a route to the target cached (effectively using the neighbors' Route Caches as an extension of the initiator's own Route Cache). If no Route Reply is received after asimple and efficient routing protocol designed specificallyshort timeout, then the node sends a "propagating" Route Request (i.e., with no hop limit) for the target node. As another example, a node MAY usein multi-hop wireless ad hoc networks of mobile nodes. Using DSR,this hop limit to implement an "expanding ring" search for thenetworktarget [16]. A node using this technique sends an initial non-propagating Route Request as described above; if no Route Reply iscompletely self-organizing and self-configuring, requiringreceived for it, the node originates another Route Request with a hop limit of 2. For each Route Request originated, if noexisting network infrastructure or administration. Network nodes cooperateRoute Reply is received for it, the node doubles the hop limit used on the previous attempt, toforward packetsprogressively explore foreach otherthe target node without allowing the Route Request toallow communicationpropagate overmultiple "hops" between nodes not directly within wireless transmission range of one another. As nodes inthenetwork move about or join or leaveentire network. However, this expanding ring search approach could have thenetwork, and as wireless transmission conditions such as sourceseffect ofinterference change, all routing is automatically determined and maintained by the DSR routing protocol. Sinceincreasing thenumber or sequenceaverage latency ofintermediate hops needed to reach any destination may change at any time, the resulting network topology may be quite richRoute Discovery, since multiple Discovery attempts andrapidly changing. The DSR protocol allows nodes to dynamically discovertimeouts may be needed before discovering asourcerouteacross multiple network hopstoany destination inthead hoc network. Each datatarget node. Johnson, et al Expires 24 August 2003 [Page 14] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 3.4. Additional Route Maintenance Features 3.4.1. Packet Salvaging When an intermediate node forwarding a packetsent then carries in its header the complete, ordered list of nodesdetects throughwhichRoute Maintenance that the next hop along the route for that packetwill pass, allowing packet routingis broken, if the node has another route tobe trivially loop-free and avoidingtheneed for up-to-date routing informationpacket's destination in its Route Cache, theintermediate nodes through whichnode SHOULD "salvage" the packetis forwarded. By including thisrather than discarding it. To salvage a packet, the node replaces the original source routeinon theheader of each data packet, other nodes forwarding or overhearing any of these packets can also easily cache this routing information for future use. In designing DSR, we sought to create a routing protocol that had very low overhead yet was able to react very quickly to changes inpacket with thenetwork.route from its Route Cache. TheDSR protocol provides highly reactive service in ordernode then forwards the packet tohelp ensure successful delivery of data packets in spite ofthe next nodemovement or other changesindicated along this source route. For example, innetwork conditions. The DSR protocol is composedthe situation shown in the example oftwo main mechanisms that work togetherSection 3.2, if node C has another route cached toallownode E, it can salvage the packet by replacing thediscovery and maintenance of source routesoriginal route in thead hoc network: -packet with this new route from its own RouteDiscovery isCache, rather than discarding themechanism by whichpacket. When salvaging anode S wishing to sendpacket, a count is maintained in the packet of the number of times that it has been salvaged, to prevent adestination node D obtains a source route to D. Route Discovery is used only when S attemptssingle packet from being salvaged endlessly. Otherwise, it could be possible for the packet tosendenter a routing loop, as different nodes repeatedly salvage the packetto Danddoes not already know areplace the source route on the packet with routes toD. -each other. As described in Section 3.2, an intermediate node, such as in this case, that detects through Route Maintenance that the next hop along the route for a packet that it is forwarding is broken, themechanism by whichnodeS is able to detect, while usingalso SHOULD return asource routeRoute Error toD, ifthenetwork topology has changed such that it can no longer use its route to D because aoriginal sender of the packet, identifying the linkalongover which theroute no longer works.packet could not be forwarded. If the node sends this Route Error, it SHOULD originate the Route Error before salvaging the packet. 3.4.2. Queued Packets Destined over a Broken Link When an intermediate node forwarding a packet detects through Route Maintenanceindicates a source route is broken, S can attempt to use any other route it happens to knowthat the next-hop link along the route for that packet is broken, in addition toD, or can invokehandling that packet as defined for RouteDiscovery again to findMaintenance, the node SHOULD also handle in a similar way any pending packets that it has queued that are destined over this newroutebroken link. Specifically, the node SHOULD search its Network Interface Queue and Maintenance Buffer (Section 4.5) forsubsequentpacketsto D.for which the next-hop link is this new broken link. For each such packet currently queued at this node, the node SHOULD process that packet as follows: - Remove the packet from the node's Network Interface Queue and Maintenance Buffer. Johnson, et al Expires2124 August20022003 [Page1]15] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 - Originate a RouteMaintenanceError for thisroute is used only when S is actually sending packetspacket toD. In DSR, Route Discovery and Route Maintenance each operate entirely "on demand". In particular, unlike other protocols, DSR requires no periodic packets of any kind at any layer within the network. For example, DSR does not use any periodic routing advertisement, link status sensing, or neighbor detection packets, and does not rely on these functions from any underlying protocols inthenetwork. This entirely on-demand behavior and lackoriginal sender ofperiodic activity allowsthenumber of overhead packets caused by DSR to scale allpacket, using theway down to zero, when all nodes are approximately stationary with respect to each other and all routes needed for current communication have already been discovered. As nodes begin to move more orprocedure described in Section 8.3.4, ascommunication patterns change,if the node had already reached therouting packet overheadmaximum number ofDSR automatically scales to onlyretransmission attempts for thatneeded to track the routes currentlypacket for Route Maintenance. However, inuse. Network topology changes not affecting routes currentlysending such Route Errors for queued packets inuse are ignored and do not cause reaction from the protocol. Inresponse to a singleRoute Discovery (as well as through routing information from other packets overheard), anew broken link detected, the nodemay learn and cache multiple routesSHOULD send no more than one Route Error to each original sender of anydestination. This allowsof these packets. - If thereaction to routing changes to be much more rapid, since anodewith multiple routes to a destination can tryhas anothercachedrouteif the one it has been using should fail. This caching of multiple routes also avoids the overhead of needingtoperform a new Route Discovery each time a routethe packet's IP Destination Address inuse breaks. The operation of both Route Discovery andits RouteMaintenance in DSR are designed to allow unidirectional links and asymmetric routes to be easily supported. In particular,Cache, the node SHOULD salvage the packet asnoteddescribed in Section2,8.3.6. Otherwise, the node SHOULD discard the packet. 3.4.3. Automatic Route Shortening Source routes inwireless networks, it is possible that a link between twouse MAY be automatically shortened if one or more intermediate nodesmay not work equally wellinboth directions, duethe route become no longer necessary. This mechanism of automatically shortening routes in use is somewhat similar todiffering antenna or propagation patterns or sourcesthe use ofinterference. DSR allows such unidirectional linkspassive acknowledgements [18]. In particular, if a node is able tobe used when necessary, improving overall performance andoverhear a packet carrying a source route (e.g., by operating its networkconnectivityinterface in promiscuous receive mode), then this node examines thesystem. This document specifies the operationunexpended portion of that source route. If this node is not theDSR protocolintended next-hop destination forrouting unicast IPv4 packetsthe packet but is named inmulti-hop wireless ad hoc networks. Advanced, optional features, such as Quality of Service (QoS) support and efficient multicast routing, and operationthe later unexpended portion ofDSR with IPv6 [6],the packet's source route, then it can infer that the intermediate nodes before itself in the source route arecoveredno longer needed inother documents. The specification of DSRthe route. For example, the figure below illustrates an example in which node D has overheard a data packet being transmitted from B to C, for later forwarding to D and to E: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C | | D | | E | +-----+ +-----+ +-----+ +-----+ +-----+ \ ^ \ / --------------------- In thisdocument providescase, this node (node D) SHOULD return acompatible base on which such features can be added, either independently or by integration"gratuitous" Route Reply to the original sender of the packet (node A). The Route Reply gives the shorter route as the concatenation of the portion of the original source route up through the node that transmitted the overheard packet (node B), plus the suffix of the original source route beginning with theDSR operation specified here. The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" innode returning the gratuitous Route Reply (node D). In thisdocument areexample, the route returned in the gratuitous Route Reply message sent from D tobe interpretedA gives the new route asdescribed in RFC 2119 [4].the sequence of hops from A to B to D to E. Johnson, et al Expires2124 August20022003 [Page2]16] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 2. Assumptions We assume in this document that all nodes wishing to communicate with other nodes within the ad hoc network are willing to participate fully in the protocols of the network. In particular, each node participating in the ad hoc network SHOULD also be willing2003 When deciding whether toforward packets for other nodes in the network. The diameter of an ad hoc network is the minimum number of hops necessary forreturn apacket to reach from any node located at one extreme edge of the ad hoc network to another node located at the opposite extreme. We assume that this diameter will often be small (e.g., perhaps 5 or 10 hops), but may often be greater than 1. Packets may be lost or corruptedgratuitous Route Reply intransmission on the wireless network. We assume thatthis way, a nodereceiving a corrupted packet can detect the error and discard the packet. Nodes within the ad hoc network MAY move at any time without notice, andMAYeven move continuously, but we assumefactor in additional information beyond the fact that it was able to overhear thespeed with which nodes move is moderate with respectpacket. For example, the node MAY decide to return thepacket transmission latency and wireless transmission range ofgratuitous Route Reply only when theparticular underlying network hardware in use.overheard packet is received with a signal strenth or signal-to-noise ratio above some specific threshold. Inparticular, DSR can support very rapid rates of arbitraryaddition, each nodemobility, but we assume that nodes do not continuously move so rapidlymaintains a Gratuitous Route Reply Table, as described in Section 4.4, tomakelimit thefloodingrate at which it originates gratuitous Route Replies for the same returned route. 3.4.4. Increased Spreading ofevery individualRoute Error Messages When a source node receives a Route Error for a data packet that it originated, this source node propagates this Route Error to its neighbors by piggybacking it on its next Route Request. In this way, stale information in theonly possible routing protocol. A common featurecaches ofmany network interfaces, including most current LAN hardwarenodes around this source node will not generate Route Replies that contain the same invalid link forbroadcast media such as wireless, iswhich this source node received theability to operateRoute Error. For example, in thenetwork interfacesituation shown in"promiscuous" receive mode. This mode causesthehardwareexample of Section 3.2, node A learns from the Route Error message from C, that the link from C todeliver every received packetD is currently broken. It thus removes this link from its own Route Cache and initiates a new Route Discovery (if it has no other route to E in its Route Cache). On thenetwork driver software without filtering based on link-layer destination address. Although we do not requireRoute Request packet initiating thisfacility, some of our optimizations can take advantage of its availability. UseRoute Discovery, node A piggybacks a copy ofpromiscuous mode does increase the software overhead on the CPU, but we believethis Route Error, ensuring thatwireless network speeds are moretheinherent limiting factorRoute Error spreads well toperformance in currentother nodes, andfuture systems; we also believeguaranteeing thatportions of the protocol are suitable for implementation directly within a programmable network interface unitany Route Reply that it receives (including those from other node's Route Caches) in response toavoidthisoverhead onRoute Request does not contain a route that assumes theCPU [14]. Useexistence ofpromiscuous mode may also increasethis broken link. 3.5. Optional DSR Flow State Extension This section describes an optional, compatible extension to thepower consumptionDSR protocol, known as "flow state", that allows the routing of most packets without an explicit source route header in thenetwork interface hardware, depending onpacket. The DSR flow state extension further reduces thedesignoverhead of thereceiver hardware, and inprotocol yet still preserves the fundamental properties of DSR's operation. Once a sending node has discovered a source route suchcases, DSR can easily be used withoutas through DSR's Route Discovery mechanism, theoptimizations that dependflow state mechanism allows the sending node to establish hop-by-hop forwarding state within the network, based onpromiscuous receive mode, or can be programmedthis source route, to enable each node along the route to forward the packet toonly periodically switchtheinterface into promiscuous mode. Usenext hop based on the node's own local knowledge ofpromiscuous receive modethe flow along which this packet isentirely optional. Wireless communication ability between any pair of nodes may at times not work equally well in both directions, due for examplebeing routed. Flow state is dynamically initialized by the first packet using a source route and is then able todiffering antenna or propagation patterns or sourcesroute subsequent packets along the same flow without use ofinterferencea source route header in the packet. The state established at each hop along a flow is "soft state" and Johnson, et al Expires2124 August20022003 [Page3]17] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 around the two nodes [1, 18]. That is, wireless communications between each pair of nodes will in many cases be able to operate bidirectionally, but at times the wireless link between two nodes may be only unidirectional, allowing one node to successfully send packets to the other while2003 thus automatically expires when nocommunication is possible in the reverse direction. Although many routing protocols operate correctly only over bidirectional links, DSR can successfully discoverlonger needed andforward packets over paths that contain unidirectional links. Some MAC protocols, however, suchcan be quickly recreated asMACA [17], MACAW [2], or IEEE 802.11 [11], limit unicast datanecessary. Extending DSR's basic operation based on an explicit source route in the header of each packettransmission to bidirectional links, due torouted, therequired bidirectional exchangeflow state extension operates as a form ofRTS and CTS"implicit source routing" by preserving DSR's basic operation but removing the explicit source route from packets. 3.5.1. Flow Establishment A source node sending packetsin these protocols and dueto some destination node MAY use thelink-layer acknowledgment feature in IEEE 802.11; when used on top of MAC protocols such as these,DSRcan take advantage of additional optimizations, such as the abilityflow state extension described here toreverseestablish asourceroute toobtainthat destination as a flow. A "flow" is a routebackfrom the source to theorigin ofdestination represented by hop-by-hop forwarding state within the nodes along theoriginalroute.The IP address usedEach flow is uniquely identified by a combination of the source node address, the destination node address, and a flow identifier (flow ID) chosen by the source node. Each flow ID is a 16-bit unsigned integer. Comparison between different flow IDs MUST be performed modulo 2**16. For example, using an implementation in the C programming language, a flow ID value (a) is greater than another flow ID value (b) if ((short)((a) - (b)) > 0), if a C language "short" data type is implemented as a 16-bit signed integer. A DSRprotocol MAYFlow State header in a packet identifies the flow ID to beassigned byfollowed in forwarding that packet. From a given source to some destination, anymechanism (e.g., static assignment or usenumber ofDHCPdifferent flows MAY exist and be in use, fordynamic assignment [7]), although the methodexample following different sequences ofsuch assignment is outsidehops to reach thescopedestination. One ofthis specification. Johnson, et al Expires 21 August 2002 [Page 4] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 3. DSR Protocol Overview 3.1. Basic DSR Route Discovery When some source node originates a new packet addressedthese flows may be considered tosome destination node,be the "default" flow from that source to that destination. A nodeplaces in thereceiving a packet with neither a DSR Options headerofspecifying thepacket a sourceroutegivingto be taken (with a Source Route option in thesequence of hops thatDSR Options header) nor a DSR Flow State header specifying thepacket is to follow on its wayflow ID to be followed, is forwarded along thedestination. Normally,default flow for thesender will obtain a suitablesourceroute by searching its "Route Cache" of routes previously learned; if no route is foundand destination addresses specified inits cache, it will initiatetheRoute Discovery protocol to dynamically findpacket's IP header. In establishing a newroute to this destination node. In this case, we callflow, the source node generates a nonzero 16-bit flow ID greater than any unexpired flow IDs for this (source, destination) pair. If the"initiator" andsource wishes for this flow to become thedestination nodedefault flow, the"target"low bit of theRoute Discovery. For example, suppose a node Aflow ID MUST be set (the flow ID isattempting to discover a route to node E.an odd number); otherwise, the low bit MUST NOT be set (the flow ID is an even number). TheRoute Discovery initiated bysource nodeA in this example would proceed as follows: ^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D" | id=2 | id=2 | id=2 | id=2 +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |---->| D |---->| E | +-----+ +-----+ +-----+ +-----+ +-----+ | | | | v v v v To initiateestablishing theRoute Discovery, node Anew flow then transmits a"Route Request" aspacket containing asingle local broadcast packet, which is received by (approximately) all nodes currently within wireless transmission range of A, includingDSR Options header with a Source Route option; to establish the flow, the source nodeBalso MUST include inthis example. Each Route Request identifiestheinitiator and target ofpacket a DSR Flow State header, with theRoute Discovery,Flow ID field set to the chosen flow ID for the new flow, andalso containsMUST include aunique request identification (2,Timeout option in the DSR Options header, giving the lifetime after which state information Johnson, et al Expires 24 August 2003 [Page 18] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 about thisexample), determined byflow is to expire. This packet will generally be a normal data packet being sent from this sender to theinitiator ofreceiver (for example, theRequest. Each Route Requestfirst packet sent after discovering the new route) but is alsocontainstreated as arecord listing the address of each intermediate"flow establishment" packet. The source nodethrough whichrecords thisparticular copy offlow in its Flow Table for future use, setting theRoute Request has been forwarded. This route record is initializedTTL in this Flow Table entry toan empty list bybe theinitiator ofvalue used in theRoute Discovery. In this example,TTL field in theroute record initially lists only node A. When another node receivespacket's IP header and setting the Lifetime in thisRoute Request (such as node Bentry to be the lifetime specified in the Timeout option in the DSR Options header. Any further packets sent with thisexample), if it isflow ID before thetarget oftimeout that also contain a DSR Options header with a Source Route option MUST use this same source route in the Source RouteDiscovery, it returnsoption. 3.5.2. Receiving and Forwarding Establishment Packets Packets intended to establish a flow, as described in Section 3.5.1, contain a DSR Options header with a"Route Reply" to the initiator of theSource RouteDiscovery, giving a copy ofoption, and are forwarded along theaccumulated route record fromindicated route. A node implementing theRoute Request;DSR flow state extension, whenthe initiator receives this Route Reply, it caches this routereceiving and forwarding such a DSR packet, also keeps some state in itsRoute Cache for use in sending subsequent packetsown Flow Table to enable it to forward future packets that are sent along thisdestination. Otherwise,flow with only the flow ID specified. Specifically, ifthis node receivingtheRoute Request has recently seen another Route Request message frompacket also contains a DSR Flow State header, thisinitiator bearingpacket SHOULD cause an entry to be established for thissame Johnson, et al Expires 21 August 2002 [Page 5] INTERNET-DRAFTflow in the Flow Table of each node along the packet's route. TheDynamic Source Routing Protocol 21 February 2002 request identification and target address, or if this node's own addressHop Count field of the DSR Flow State header isalready listedalso stored in theroute recordFlow Table, as is Lifetime option specified in theRoute Request, this node discards the Request. Otherwise, this node appends its own address toDSR Options header. If theroute recordFlow ID is odd and there is no flow in theRoute Request and propagates it by transmitting it as a local broadcast packet (withFlow Table with Flow ID greater than thesame request identification). Inreceived Flow ID, set the default Flow ID for thisexample, node B broadcast(IP Source Address, IP Destination Address) pair to theRoute Request, which isreceivedby node C; nodes CFlow ID, andD each also, in turn, broadcasttheRequest, resulting in a copyTTL of theRequest being received bypacket is recorded. The Flow ID option is removed before final delivery of the packet. 3.5.3. Sending Packets Along Established Flows When a flow is established as described in Section 3.5.1, a packet is sent which establishes state in each nodeE. In returningalong theRoute Reply toroute. This state is soft; that is, theinitiatorprotocol contains mechanisms for recovering from the loss of this state. However, theRoute Discovery, such asuse of these mechanisms may result inthis example, node E replying back to node A, node E will typically examine its own Route Cachereduced performance for packets sent along flows with forgotten state. As aroute back to A, and if found, will useresult, itfor the source route for delivery ofis desirable to differentiate behavior based on whether or not thepacket containingsender is Johnson, et al Expires 24 August 2003 [Page 19] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 reasonably certain that theRoute Reply. Otherwise, E SHOULD perform its own Route Discovery for targetflow state exists on each nodeA, butalong the route. We define a flow's state toavoid possible infinite recursionbe "established end-to-end" if the Flow Tables ofRoute Discoveries, it MUST piggyback this Route Replyall nodes on thepacket containing its own Route Requestroute contains forwarding information forA. Itthat flow. While it isalso possibleimpossible topiggyback other small data packets, such as a TCP SYN packet [28], ondetect whether or not aRoute Request using this same mechanism. Node E could instead simply reverseflow's state has been established end-to-end without sending packets, implementations may make reasonable assumptions about thesequenceretention ofhops inflow state and theroute recordprobability thatit is tryingan establishment packet has been seen by all nodes on the route. A source wishing to sendina packet along an established flow determines if the flow state has been established end-to-end. If it has not, a DSR Options header with Source RouteReply, and useoption with thisas the sourceflow's routeonis added to thepacket carryingpacket. The source SHOULD set theRoute Reply itself. For MAC protocols such as IEEE 802.11 that require a bidirectional frame exchange as partFlow ID field of theMAC protocol [11],DSR Flow State header either to thediscovered source route MUST be reversed inflow ID previously associated with thiswayflow's route or toreturn the Route Reply sincezero. If ittestssets thediscovered routeFlow ID field toensureany other value, itis bidirectional before the Route Discovery initiator begins usingMUST follow theroute; this route reversal also avoidsprocessing steps in Section 3.5.1 for establishing a new flow ID. If it sets theoverhead ofFlow ID field to apossible second Route Discovery. However, this route reversal technique will preventnonzero value, it MUST include a Timeout option with a value not greater than thediscovery of routes using unidirectional links, andtimeout remaining inwireless environments wheretheuse of unidirectional linksnode's Flow Table, and if its TTL ispermitted, such routes maynot equal to that specified insome cases be more efficient than those with only bidirectional links, or they maythe Flow Table, the flow MUST NOT be used as a default flow in the future. Once flow state has been established end-to-end for non-default flows, a source adds a DSR Flow State header to each packet it wishes to send along that flow, setting theonly way to achieve connectivityFlow ID field to thetarget node. When initiating aflow ID of that flow. A Source RouteDiscovery,option SHOULD NOT be added to thesending node saves a copy ofpacket, though if one is, then theoriginal packet (that triggeredsteps for processing flows that have not been established end to end MUST be followed. Once flow state has been established end-to-end for default flows, sources sending packets with IP TTL equal to theDiscovery)TTL value inathe localbuffer calledFlow Table entry for this flow then transmit the"Send Buffer". The Send Buffer contains a copy of eachpacketthat cannot be transmitted byto the next hop. In thisnode because it does not yet havecase, asource routeDSR Flow State header SHOULD NOT be added to thepacket's destination. Eachpacketinand a DSR Options header likewise SHOULD NOT be added to theSend Buffer is logically associated withpacket; though if one is, thetime that it was placed intosteps for sending packets along non-default flows MUST be followed. If theSend Buffer andIP TTL isdiscarded after residingnot equal to the TTL value in theSend Buffer for some timeout period; if necessary for preventinglocal Flow Table, then theSend Buffer from overflowing,steps for processing aFIFO or other replacement strategy MAY alsonon-default flow MUST beusedfollowed. 3.5.4. Receiving and Forwarding Packets Sent Along Established Flows The handling of packets containing a DSR Options header with both a nonzero Flow ID and a Source Route option is described in Section 3.5.2. The Flow ID is ignored when it is equal toevictzero. This section only describes handling of packetseven before they expire. Whilewithout a Source Route option. If a node receives a packetremains in the Send Buffer, the node SHOULD occasionally initiatewith anew Route Discovery for the packet's destination address. However,Flow ID in thenode MUST limitDSR Options header that indicates an unexpired flow in therate at whichnode's Flow Table, it Johnson, et al Expires2124 August20022003 [Page6]20] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 such new Route Discoveries for2003 increments thesame address are initiated, since it is possible thatHop Count in thedestinationDSR Options header and forwards the packet to the next hop indicated in the Flow Table. If a nodeisreceives a packet with a Flow ID that indicates a flow not currentlyreachable. In particular, due toin thelimited wireless transmission rangenode's Flow Table, it returns a Route Error of type UNKNOWN_FLOW with Error Destination and IP Destination addresses copied from themovementIP Source of thenodes in the network,packet triggering thenetwork may at times become partitioned, meaning that there is currently no sequence of nodes through which aerror. This error packetcouldSHOULD beforwardedMAC-destined toreachthedestination. Depending onnode from which it was received; if it cannot confirm reachability of themovement pattern andprevious node using Route Maintenance, it MUST send thedensity of nodeserror as described in Section 8.1.1. The node sending the error SHOULD attempt to salvage thenetwork, such network partitions may be rare or may be common. If a new Route Discovery was initiated for eachpacketsent bytriggering the Route Error. If it does salvage the packet, it MUST zero the Flow ID. If a node receives a packet with no DSR Options header and no DSR Flow State header, it checks the Default Flow Table. If there is an entry, it forwards to the next hop indicated insuch a partitioned network,the Flow Table for the default flow. Otherwise, it returns alarge number of unproductiveRouteRequest packets would be propagated throughoutError of type DEFAULT_FLOW_UNKNOWN with Error Destination and IP Destination addresses copied from thesubsetIP Source of thead hoc network reachable from this node. In order to reducepacket triggering theoverhead from such Route Discoveries, a nodeerror. This error packet SHOULDuse an exponential back-off algorithmbe MAC-destined tolimittherate atnode from which itinitiates new Route Discoveries for the same target, doubling the timeout between each successive Discovery initiated for the same target. Ifwas received; if it cannot confirm reachability of the previous nodeattempts tousing Route Maintenance, it MUST sendadditional data packets to this same destination node more frequently than this limit,thesubsequent packets SHOULD be bufferederror as described in Section 8.1.1. The node sending theSend Buffer until a Route Reply is received giving a routeerror SHOULD attempt tothis destination, but the node MUST NOT initiate a new Route Discovery untilsalvage theminimum allowable interval between new Route Discoveries for this target has been reached. This limitation onpacket triggering themaximum rate ofRouteDiscoveries for the same target is similar toError. If it does salvage themechanism required by Internet nodes to limitpacket, it MUST zero therate at which ARP Requests are sent for any single target IP address [3]. 3.2. Basic DSRFlow ID. 3.5.5. Processing RouteMaintenanceErrors Whenoriginating or forwarding a packet usingasource route, eachnodetransmittingreceives a Route Error of type Unknown Flow, it marks thepacket is responsible for confirming that data canflowover the link from that nodetothe next hop. For example, in the situation shown below, node Aindicate that it hasoriginatednot been established end-to-end. When apacket fornodeE usingreceives a Route Error of type Default Flow Unknown, it marks the default flow to indicate that it has not been established end-to-end. 3.5.6. Interaction with Automatic Route Shortening Because a full source routethrough intermediate nodes B, C, and D: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |-->? | D | | E | +-----+ +-----+ +-----+ +-----+ +-----+ In this case, node Aisresponsiblenot carried in every packet, an alternative method forthe link from A to B, node Bperforming automatic route shortening isresponsiblenecessary for packets using thelink from Bflow state extension. Instead, nodes promiscuously listen toC,packets, and if a nodeCreceives a packet with (IP Source, IP Destination, Flow ID) found in the Flow Table but the MAC-layer (next hop) destination address of the packet isresponsible fornot this node, thelink from C to D,nodeD is responsible fordetermines whether thelink from D to E. An acknowledgment can provide confirmation that a link is capable of carrying data, and in wireless networks, acknowledgments are often provided at no cost, either aspacket was sent by anexisting standard part ofupstream or downstream node by examining theMAC protocolHop Count field inuse (such asthelink-layer acknowledgment frame defined by IEEE 802.11 [11]), orDSR Flow State header. If the Hop Count field is less than the expected Hop Count at this node, the node assumes that the packet was sent bya "passive acknowledgment" [16] (inan upstream node, and adds an entry for the packet to Johnson, et al Expires2124 August20022003 [Page7]21] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 which,2003 its Automatic Route Shortening Table, possibly evicting an earlier entry added to this table. When the packet is then sent to that node forexample, B confirms receipt at Cforwarding, the node finds that it has previously received the packet byoverhearing C transmitchecking its Automatic Route Shortening Table, and returns a gratuitous Route Reply to the source of the packet. 3.5.7. Loop Detection If a node receives a packetwhenfor forwarding with adjusted TTL lower than expected and default flow forwarding is being used, itonsends a Route Error of type Default Flow Unknown back toD). Ifthe IP source. It can attempt delivery of the packet by normal salvaging (subject to constraints described in Section 8.6.7) or by inserting abuilt-in acknowledgment mechanismFlow ID option with Special TTL extension based on what that node's understanding of the default Flow ID and TTL. 3.5.8. Acknowledgement Destination In packets sent using Flow State, the previous hop is notavailable,necessarily known. In order to allow nodes that have lost flow state to determine thenode transmittingprevious hop, thepacketaddress of the previous hop canexplicitly request a DSR-specific software acknowledgmentoptionally bereturned by the next node alongstored in theroute; this software acknowledgment will normallyAcknowledgement Request. This extension SHOULD NOT betransmitted directly to the sending node, but ifused when a Source Route option is present, MAY be used when flow state routing is used without a Source Route option, and SHOULD be used before Route Maintenance determines that thelink between these two nodesnext-hop destination isunidirectional, this software acknowledgment could travel overunreachable. 3.5.9. Crash Recovery Each node has a maximum Timeout value that it can possibly generate. This can be based on the largest number that can be set in adifferent, multi-hop path. After an acknowledgment has been received from some neighbor,timeout option (2**16 - 1 seconds) or set in system software. When a nodeMAY choose tocrashes, it does notrequire acknowledgments from that neighborestablish new flows for abriefperiodof time, unless the network interface connecting a nodeequal tothat neighbor always receives an acknowledgmentthis maximum Timeout value, inresponse to unicast traffic. When a software acknowledgment is used, the acknowledgment request SHOULD be retransmitted uporder toa maximum number of times. A retransmission of the acknowledgment requestavoid colliding with its old Flow IDs. 3.5.10. Rate Limiting Flow IDs can besent asassigned with aseparate packet, piggybacked oncounter. More specifically, the "Current Flow ID" is kept. When aretransmission ofnew default Flow ID needs to be assigned, if theoriginal data packet, or piggybacked on any packet withCurrent Flow ID is odd, thesame next-hop destination that does not also contain a software acknowledgment. AfterCurrent Flow ID is assigned as theacknowledgment request has been retransmittedFlow ID and themaximum number of times,Current Flow ID is incremented by one; ifno acknowledgment has been received, thenthesender treatsCurrent Flow ID is even, one plus thelink to this next-hop destinationCurrent Flow ID is assigned ascurrently "broken". It SHOULD remove this link from its Route Cachethe Flow ID andSHOULD return a "Route Error" to each node that has sent a packet routed over that link since an acknowledgment was last received. For example, inthesituation shown above, if C does not receive an acknowledgment from D after some number of requests, it would return a Route ErrorCurrent Flow ID is incremented by two. Johnson, et al Expires 24 August 2003 [Page 22] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 If Flow IDs are assigned in this way, one algorithm for avoiding duplicate, unexpired Flow IDs is toA, as well as any other node that may have used the link from Crate limit new Flow IDs toD since C last receivedanacknowledgment from D. Node A then removes this broken link from its cache; any retransmissionaverage rate of n assignments per second, where n is 2**15 divided by theoriginal packetmaximum Timeout value. This can beperformed by upper layer protocols such as TCP, if necessary. For sending such a retransmission or other packetsaveraged over any period not exceeding the maximum Timeout value. 3.5.11. Interaction with Packet Salvaging Salvaging is modified to zero the Flow ID field. Also, any time the thissame destination E, if A has in its Route Cache another routedocument refers toE (for example, from additional Route Replies from its earlier Route Discovery, or from having overheard sufficient routing information from other packets), it can sendthepacket usingSalvage field in thenew route immediately. Otherwise, it SHOULD performSource Route option in anewDSR Options header, packets without a Source RouteDiscovery for this target (subjectoption are considered to have theback-off describedvalue zero inSection 3.1).the Salvage field. Johnson, et al Expires2124 August20022003 [Page8]23] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 3.3. Additional Route Discovery Features 3.3.1. Caching Overheard Routing Information A node forwarding or otherwise overhearing any packet SHOULD add all usable routing information from that packet to its own Route Cache. The usefulness of routing information in a packet depends on the directionality characteristics of the physical medium (Section 2), as well as the MAC protocol being used. Specifically, three distinct cases are possible: - Links in2003 4. Conceptual Data Structures This document describes thenetwork frequently are capableoperation ofoperating only unidirectionally (not bidirectionally), andtheMACDSR protocol in terms of a number of conceptual data structures. This section describes each of these data structures and provides an overview of its use in thenetwork is capableprotocol. In an implementation oftransmitting unicast packets over unidirectional links. - Links inthenetwork occasionally are capable of operating only unidirectionally (not bidirectionally), but this unidirectional restriction onprotocol, these data structures MAY be implemented in anylink is not persistent, almost all links are physically bidirectional, andmanner consistent with theMAC protocol in useexternal behavior described inthethis document. 4.1. Route Cache All ad hoc network routing information needed by a node implementing DSR iscapable of transmitting unicast packets over unidirectional links. - The MAC protocolstored inusethat node's Route Cache. Each node in the networkis not capablemaintains its own Route Cache. A node adds information to its Route Cache as it learns oftransmitting unicast packets over unidirectional links; only bidirectionalnew linkscan be used bybetween nodes in theMAC protocolad hoc network; fortransmitting unicast packets. Forexample,the IEEE 802.11 Distributed Coordination Function (DCF) MAC protocol [11] is capablea node may learn oftransmittingnew links when it receives aunicastpacketonly overcarrying abidirectional link, since the MAC protocol requires the return ofRoute Request, Route Reply, or DSR source route. Likewise, alink-level acknowledgment packetnode removes information from its Route Cache as it learns that existing links in thereceiver and also optionally requires the bidirectional exchange of an RTS and CTS packet between the transmitter and receiver nodes. In the first case above,ad hoc network have broken; for example,the source route used inadata packet, the accumulated route record innode may learn of a broken link when it receives a packet carrying a RouteRequest,Error or through theroute being returned inlink-layer retransmission mechanism reporting aRoute Reply SHOULD all be cached by any nodefailure inthe "forward" direction; any node SHOULD cache this information from any such packet received, whether theforwarding a packetwas addressed to this node, sentto its next-hop destination. Anytime abroadcast (or multicast) MAC address, or overheard while the node's network interface is in promiscuous mode. However, the "reverse" direction ofnode adds new information to its Route Cache, thelinks identified in such packet headersnode SHOULDNOT be cached. Johnson, et al Expires 21 August 2002 [Page 9] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 For example,check each packet inthe situation shown below, node A is using a source routeits own Send Buffer (Section 4.2) tocommunicate with node E: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C |---->| D |---->| E | +-----+ +-----+ +-----+ +-----+ +-----+ As node C forwardsdetermine whether adata packet along theroutefrom A to E, it SHOULD addtoits cache the presence of the "forward" direction linksthatit learns frompacket's IP Destination Address now exists in theheaders of these packets, from itself to D and from Dnode's Route Cache (including the information just added toE. Node C SHOULD NOT, in this case, cachethe"reverse" direction ofCache). If so, thelinks identified in thesepacketheaders, from itself back to BSHOULD then be sent using that route and removed fromBthe Send Buffer. It is possible toA, since these links mightinterface a DSR network with other networks, external to this DSR network. Such external networks may, for example, beunidirectional. Inthesecond case above, in which linksInternet, or mayoccasionally operate unidirectionally, the links described above SHOULDbecached in both directions. Furthermore, in this case, if node X overhears (e.g., through promiscuous mode)other ad hoc networks routed with apacket transmitted by node Crouting protocol other than DSR. Such external networks may also be other DSR networks thatis using a source route from node Aare treated as external networks in order toE, node X SHOULD cache allimprove scalability. The complete handling ofthese links as well, also includingsuch external networks is beyond thelink from Cscope of this document. However, this document specifies a minimal set of requirements and features necessary toX over which it overheard the packet. Inallow nodes only implementing this specification to interoperate correctly with nodes implementing interfaces to such external networks. This minimal set of requirements and features involve thefinal case,First Hop External (F) and Last Hop External (L) bits inwhich the MAC protocol requires physical bidirectionality for unicast operation, links fromasource route SHOULD be cachedDSR Source Route option (Section 6.7) and a Route Reply option (Section 6.3) in a packet's DSR Options header (Section 6). These requirements also include the addition of an External flag bit tagging each link inboth directions, except whenthepacket also contains aRouteReply, in which case onlyCache, copied from thelinks already traversedFirst Hop External (F) and Last Hop External (L) bits in the DSR Source Route option or Route Reply option from which thissource routelink was learned. Johnson, et al Expires 24 August 2003 [Page 24] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 The Route Cache SHOULDbe cached, butsupport storing more than one route to each destination. In searching thelinks not yet traversed in thisRoute Cache for a routeSHOULD NOT be cached. 3.3.2. Replyingto some destination node, the RouteRequests using Cached Routes ACache is indexed by destination nodereceivingaddress. The following properties describe this searching function on a RouteRequestCache: - Each implementation of DSR at any node MAY choose any appropriate strategy and algorithm forwhich it is not the target, searchessearching itsownRoute Cacheforand selecting a "best" route to thetarget of the Request. If found, the node generally returnsdestination from among those found. For example, aRoute Reply to the initiator itself rather than forwarding the Route Request. In the Route Reply, thisnodesetsMAY choose to select the shortest routerecordtolistthe destination (the shortest sequence ofhops over which this copyhops), or it MAY use an alternate metric to select the route from the Cache. - However, if there are multiple cached routes to a destination, the selection of routes when searching the RouteRequest was forwardedCache MUST prefer routes that do not have the External flag set on any link. This preference will select routes that lead directly toit, concatenated withthesource route to thistargetobtained from its own Route Cache. However, before transmitting a Route Reply packet that was generated using information from its Route Cache in this way, anodeMUST verifyover routes that attempt to reach theresultingtarget via any external networks connected to the DSR ad hoc network. - In addition, any routebeing returned inselected when searching the RouteReply, after this concatenation, contains no duplicate nodes listed inCache MUST NOT have theroute record. For example,External bit set for any links other than possibly thefigure below illustrates a case in Johnson, et al Expires 21 August 2002 [Page 10] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 which a Route Requestfirst link, the last link, or both; the External bit MUST NOT be set fortarget E has been received by node F, and node F already hasany intermediate hops initsthe route selected. An implementation of a Route Cache MAY provide aroute from itself to E: +-----+ +-----+ +-----+ +-----+ | A |---->| B |- >| D |---->| E | +-----+ +-----+ \ / +-----+ +-----+ \ / \ +-----+ / >| C |- +-----+ | ^ v |fixed capacity for the cache, or the cache size MAY be variable. The following properties describe the management of available space within a node's RouteRequest +-----+ Route: A - B - C - F | F |Cache:C - D-E +-----+ The concatenationEach implementation of DSR at each node MAY choose any appropriate policy for managing theaccumulated route record from theentries in its RouteRequest andCache, such as when limited cache capacity requires a choice of which entries to retain in thecached route from F's Route Cache would includeCache. For example, aduplicatenode MAY chose a "least recently used" (LRU) cache replacement policy, inpassingwhich the entry last used longest ago is discarded fromCthe cache if a decision needs toF and backbe made toC. Node Fallow space inthis case could attempt to edittheroute to eliminatecache for some new entry being added. - However, theduplication, resulting in a route from A to B to CRoute Cache replacement policy SHOULD allow routes toD and onbe categorized based upon "preference", where routes with a higher preferences are less likely toE, but in this case, node F would notbeonremoved from theroute that it returned in its own Route Reply. DSR Route Discovery prohibitscache. For example, a nodeF from returning suchcould prefer routes for which it initiated a RouteReply from its cache; this prohibition increases the probabilityDiscovery over routes that it learned as theresulting route is valid, since node F in this case should have receivedresult of promiscuous snooping on other packets. In particular, aRoute Error if the route had previously stopped working. Furthermore, this prohibition meansnode SHOULD prefer routes thata future Route Error traversing the routeit isvery likelypresently using over those that it is not. Johnson, et al Expires 24 August 2003 [Page 25] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 Any suitable data structure organization, consistent with this specification, MAY be used topass throughimplement the Route Cache in anynode that sentnode. For example, the following two types of organization are possible: - In DSR, the route returned in each Route Replyforthat is received by theroute (including node F), which helps to ensureinitiator of a Route Discovery (or thatstale dataisremovedlearned fromcaches (suchthe header of overhead packets, asat F)described in Section 8.1.4) represents atimely manner; otherwise,complete path (a sequence of links) leading to thenext Route Discovery initiated by A might also be contaminated bydestination node. By caching each of these paths separately, aRoute Reply from F containing"path cache" organization for thesame stale route. If node F, due to this restriction on returning aRouteReply based on informationCache can be formed. A path cache is very simple to implement and easily guarantees that all routes are loop-free, since each individual route fromits Route Cache, does not return sucha RouteReply, node F propagates theReply or Route Requestnormally. 3.3.3. Preventing Route Reply Storms The abilityor used in a packet is loop-free. To search fornodes to reply toaRoute Request based on informationroute intheira path cache data structure, the sending node can simply search its RouteCaches, as described in Section 3.3.2, could result inCache for any path (or prefix of apossiblepath) that leads to the intended destination node. This type of organization for the RouteReply "storm"Cache in DSR has been extensively studied through simulation [5, 10, 14, 21] and through implementation of DSR insome cases. In particular, if a node broadcastsaRoute Request formobile outdoor testbed under significant workload [22, 23, 24]. - Alternatively, atarget node"link cache" organization could be used for the Route Cache, in which each individual link (hop) in thenode's neighbors have a routeroutes returned intheirRouteCaches, each neighbor may attemptReply packets (or otherwise learned from the header of overhead packets) is added tosendaRoute Reply, thereby wasting bandwidth and possibly increasing the numberunified graph data structure of this node's current view of the networkcollisionstopology. To search for a route in link cache, thearea. Johnson, et al Expires 21 August 2002 [Page 11] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 For example, the figure below showssending node must use asituation in which nodes B, C, D, E, and F all receive A's Route Request for target G, and each hasmore complex graph search algorithm, such as theindicated route cached for this target: +-----+ +-----+ | D |< >| C | +-----+ \ / +-----+ Cache: C - B - G \ / Cache: B - G \ +-----+ / -| A |- +-----+\ +-----+ +-----+ | | \--->| B | | G | / \ +-----+ +-----+ / \ Cache: G v v +-----+ +-----+ | E | | F | +-----+ +-----+ Cache: F - B - G Cache: B - G Normally, each of these nodes would attemptwell-known Dijkstra's shortest-path algorithm, to find the current best path through the graph to the destination node. Such an algorithm is more difficult to implement and may require significantly more CPU time toreply fromexecute. However, a link cache organization is more powerful than a path cache organization, in itsown Route Cache, and they would thus all send their Route Replies at about the same time, since theyability to effectively utilize allreceivedof thebroadcast Route Request atpotential information that a node might learn about thesame time. Such simultaneous Route Repliesstate of the network. In particular, links learned from differentnodes all receiving theRouteRequest may cause local congestion in the wireless network and may create packet collisions among someDiscoveries orall of these Replies iffrom theMAC protocolheader of any overheard packets can be merged together to form new routes inuse doesthe network, but this is notprovide sufficient collision avoidance for these packets. In addition, it will often bepossible in a path cache due to thecase thatseparation of each individual path in thedifferent replies will indicate routescache. This type ofdifferent lengths, as shownorganization for the Route Cache inthis example. In orderDSR, including the effect of a range of implementation choices, has been studied through detailed simulation [10]. The choice of data structure organization toreduce these effects, ifuse for the Route Cache in any DSR implementation is a local matter for each nodecan put its network interface into promiscuous receive mode, it MAY delay sending its ownand affects Johnson, et al Expires 24 August 2003 [Page 26] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 only performance; any reasonable choice of organization for the Route Cache does not affect either correctness or interoperability. Each entry in the RouteReply forCache SHOULD have ashort period, while listeningtimeout associated with it, toseeallow that entry to be deleted if not used within some time. The particular choice of algorithm and data structure used to implement theinitiating node begins using a shorter route first. Specifically, this node MAY delay sending its ownRouteReplyCache SHOULD be considered in choosing the timeout fora random period d = H * (h - 1 + r) where h isentries in thelengthRoute Cache. The configuration variable RouteCacheTimeout defined innumber of network hops forSection 9 specifies theroutetimeout to bereturnedapplied to entries inthis node'sthe RouteReply, rCache, although it is also possible to instead use an adaptive policy in choosing timeout values rather than using arandom floating point number between 0 and 1,single timeout setting for all entries; for example, the Link-MaxLife cache design (below) uses an adaptive timeout algorithm andH is a small constant delay (at least twicedoes not use themaximum wirelessRouteCacheTimeout configuration variable. As guidance to implementors, Appendix A describes a type of linkpropagation delay)cache known as "Link-MaxLife" that has been shown tobe introduced per hop. This delay effectively randomizes the time atoutperform other types of link caches and path caches studied in detailed simulation [10]. Link-MaxLife is an adaptive link cache in which each link in the cache has a timeout that is determined dynamically by the caching nodesends its Route Reply, with all nodes sending Route Replies giving routesaccording to its observed past behavior oflength less than h sending their Replies before this node, and allthe two nodessending Route Replies givingat the ends of the link; in addition, when selecting a route for a packet being sent to some destination, among cached routes of equal lengthgreater than h sending their Replies after this node. Johnson, et al Expires 21 August 2002 [Page 12] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 Within(number of hops) to that destination, Link-MaxLife selects thedelay period, this node promiscuously receives all packets, looking for data packets fromroute with theinitiatorlongest expected lifetime (highest minimum timeout ofthis Route Discovery destined forany link in thetargetroute). Use of theDiscovery. If suchLink-MaxLife design for the Route Cache is recommended in implementations of DSR. 4.2. Send Buffer The Send Buffer of adata packet receivednode implementing DSR is a queue of packets that cannot be sent bythisthat nodeduring the delay period usesbecause it does not yet have a source routeof length less than or equaltoh, this node may infereach such packet's destination. Each packet in the Send Buffer is logically associated with the time that it was placed into the Buffer, and SHOULD be removed from the Send Buffer and silently discarded after a period of SendBufferTimeout 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 Section 8.2, a Route Discovery SHOULD be initiated as often as possible for theinitiatordestination address of any packets residing in the Send Buffer. Johnson, et al Expires 24 August 2003 [Page 27] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 4.3. RouteDiscovery has already received aRequest Table The RouteReply giving an equally good or better route. In this case, thisRequest Table of a nodeSHOULD cancel its delay timer and SHOULD NOT send itsimplementing DSR records information about RouteReply forRequests that have been recently originated or forwarded by thisRoute Discovery. 3.3.4. Route Request Hop Limits Eachnode. The table is indexed by IP address. The Route Requestmessage containsTable on a"hop limit" that may be used to limitnode records thenumber of intermediatefollowing information about nodesallowedtoforward that copy of thewhich this node has initiated a RouteRequest. This hop limit is implemented using theRequest: - The Time-to-Live (TTL) field used in the IP header of thepacket carrying theRouteRequest. As theRequestis forwarded, this limit is decremented, and the Request packet is discarded if the limit reaches zero before findingfor thetarget. Thislast RouteRequest hop limit can be usedDiscovery initiated by this node for that target node. This value allows the node to implement a variety of algorithms for controlling the spread ofaits Route Requestduring aon each Route Discoveryattempt. For example, a node MAY use this hop limit to implement a "non-propagating" Route Request as an initial phase of a Route Discovery. A node using this technique sends its first Route Request attemptinitiated forsome target node usingahop limittarget. As examples, two possible algorithms for this use of1, suchthe TTL field are described in Section 3.3.4. - The time thatanythis nodereceiving the initial transmission of thelast originated a Route Requestwill not forward the Request to other nodes by re-broadcasting it. This formfor that target node. - The number of consecutive RouteRequest is called a "non-propagating" Route Request; it provides an inexpensive methodDiscoveries initiated fordetermining if thethis targetis currently a neighbor of the initiator or ifsince receiving aneighbor node hasvalid Route Reply giving a route tothethat targetcached (effectively using the neighbors' Route Caches as an extensionnode. - The remaining amount ofthe initiator's own Route Cache). If no Route Reply is received aftertime before which this node MAY next attempt at ashort timeout, thenRoute Discovery for that target node. When the nodesendsinitiates a"propagating"new RouteRequest (i.e., with no hop limit)Discovery for this target node, this field in the Route Request Table entry for that targetnode. As another example, anodeMAY use this hop limitis initialized toimplement an "expanding ring" searchthe timeout for that Route Discovery, after which thetarget [14]. Anodeusing this technique sends an initial non-propagating Route Request as described above; if noMAY initiate a new Discovery for that target. Until a valid Route Reply is received forit, thethis target nodeoriginates another Route Request withaddress, ahop limit of 2. Fornode MUST implement a back-off algorithm in determining this timeout value for each successive RouteRequest originated, if no Route Reply is receivedDiscovery initiated forit,this target using thenode doublessame Time-to-Live (TTL) value in the IP header of the Route Request packet. The timeout between such consecutive Route Discovery initiations SHOULD increase by doubling thehop limit usedtimeout value onthe previous attempt, to progressively explore for the target node without allowingeach new initiation. In addition, the Route Requestto propagate overTable on a node also records theentire network. However,following information about initiator nodes from which thisexpanding ring search approach could have the effectnode has received a Route Request: - A FIFO cache ofincreasingsize RequestTableIds entries containing theaverage latency of Route Discovery, since multiple Discovery attemptsIdentification value andtimeouts may be needed before discovering a route to thetarget address from the most recent Route Requests received by this node from that initiator node. Nodes SHOULD use an LRU policy to manage the entries in their Route Request Table. Johnson, et al Expires2124 August20022003 [Page13]28] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 3.4. Additional2003 The number of Identification values to retain in each Route Request Table entry, RequestTableIds, MUST NOT be unlimited, since, in the worst case, when a node crashes and reboots, the first RequestTableIds Route Discoveries it initiates after rebooting could appear to be duplicates to the other nodes in the network. In addition, a node SHOULD base its initial Identification value, used for Route Discoveries after rebooting, on a battery backed-up clock or other persistent memory device, in order to help avoid any possible such delay in successfully discovering new routes after rebooting; if no such source of initial Identification value is available, a node after rebooting SHOULD base its initial Identification value on a random number. 4.4. Gratuitous Route Reply Table The Gratuitous Route Reply Table of a node implementing DSR records information about "gratuitous" RouteMaintenance Features 3.4.1. Packet Salvaging When an intermediateReplies sent by this nodeforwardingas part of automatic route shortening. As described in Section 3.4.3, apacket detects throughnode returns a gratuitous RouteMaintenance thatReply when it overhears a packet transmitted by some node, for which thenext hop alongnode overhearing theroute for thatpacketis broken, ifwas not the intended next-hop nodehas another route tobut was named later in thepacket's destinationunexpended hops of the source route inits Route Cache,that packet; the nodeSHOULD "salvage"overhearing the packetrather than discarding it. To salvagereturns apacket, the node replacesgratuitous Route Reply to the originalsourcesender of the packet, listing the shorter routeon(not including thepacket withhops of the source routefrom"skipped over" by this packet). A node uses its Gratuitous RouteCache. The node then forwardsReply Table to limit thepacketrate at which it originates gratuitous Route Replies to thenextsame original sender for the same nodeindicated along this source route. For example, infrom which it overheard a packet to trigger thesituation showngratuitous Route Reply. Each entry in theexampleGratuitous Route Reply Table ofSection 3.2, ifa node contains the following fields: - The address of the nodeC has another route cachedto which this nodeE, it can salvage the packet by replacingoriginated a gratuitous Route Reply. - The address of theoriginal route innode from which this node overheard the packetwithtriggering that gratuitous Route Reply. - The remaining time before which thisnew route from its ownentry in the Gratuitous RouteCache, rather than discardingReply Table expires and SHOULD be deleted by thepacket.node. Whensalvagingapacket,node creates acount is maintainednew entry in its Gratuitous Route Reply Table, thepacket of the number of timestimeout value for thatit has been salvaged, to prevent a single packet from being salvaged endlessly. Otherwise, it couldentry should bepossible for the packetinitialized toenter a routing loop, as different nodes repeatedly salvage the packet and replace the source route onthe value GratReplyHoldoff. When a node overhears a packetwith routes to each other. As described in Section 3.2, an intermediate node, such as in this case,thatdetects throughwould trigger a gratuitous RouteMaintenance thatReply, if a corresponding entry already exists in thenext hop alongnode's Gratuitous Route Reply Table, then theroute fornode SHOULD NOT send apacketgratuitous Route Reply for thatit is forwarding is broken,packet. Otherwise (no corresponding Johnson, et al Expires 24 August 2003 [Page 29] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 entry already exists), the nodealsoSHOULDreturncreate a new entry in its Gratuitous RouteErrorReply Table tothe original senderrecord that gratuitous Route Reply, with a timeout value of GratReplyHoldoff. 4.5. Network Interface Queue and Maintenance Buffer Depending on factors such as thepacket, identifying the link over whichstructure and organization of the operating system, protocol stack implementation, network interface device driver, and network interface hardware, a packet being transmitted couldnotbeforwarded. If the node sends this Route Error, it SHOULD originate the Route Error before salvaging the packet. 3.4.2. Queued Packets Destined over a Broken Link When an intermediate node forwardingqueued in apacket detects through Route Maintenance thatvariety of ways. For example, outgoing packets from thenext-hopnetwork protocol stack might be queued at the operating system or linkalonglayer, before transmission by theroutenetwork interface. The network interface might also provide a retransmission mechanism forthat packet is broken,packets, such as occurs inaddition to handling that packetIEEE 802.11 [13]; the DSR protocol, asdefined forpart of Route Maintenance,the node SHOULD also handle in a similar way any pendingrequires limited buffering of packetsthat italready transmitted for which the reachability of the next-hop destination hasqueuednot yet been determined. The operation of DSR is defined here in terms of two conceptual data structures thatare destined overtogether incorporate thisnew broken link. Specifically, the node SHOULD search itsqueuing behavior. The Network Interface Queueand Maintenance Buffer (Section 4.5) forof a node implementing DSR is an output queue of packets from the network protocol stack waiting to be transmitted by the network interface; forwhichexample, in thenext-hop link4.4BSD Unix network protocol stack implementation, this queue for a network interface is represented as a "struct ifqueue" [36]. This queue is used to hold packets while the network interface is in the process of transmitting another packet. The Maintenance Buffer of a node implementing DSR is a queue of packets sent by thisnew broken link.node that are awaiting next-hop reachability confirmation as part of Route Maintenance. For eachsuchpacketcurrently queued at this node,in the Maintenance Buffer, a nodeSHOULD process that packet as follows: - Removemaintains a count of the number of retransmissions and thepacket fromtime of thenode's Network Interface Queue and Maintenance Buffer. Johnson, et al Expires 21 August 2002 [Page 14] INTERNET-DRAFTlast retransmission. TheDynamic Source Routing Protocol 21 February 2002 - OriginateMaintenance Buffer MAY be of limited size; when adding aRoute Error for thisnew packet to theoriginal sender of the packet, using the procedure described in Section 6.3.4, asMaintenance Buffer, if thenode had already reachedbuffer size is insufficient to hold themaximum number of retransmission attempts for thatnew packet, the new packetfor Route Maintenance. However, in sending such Route Errors for queuedSHOULD be silently discarded. If, after MaxMaintRexmt attempts to confirm next-hop reachability of some node, no confirmation is received, all packets inresponse to a single new broken link detected,this node's Maintenance Buffer with this next-hop destination SHOULD be removed from the Maintenance Buffer; in this case, the node also SHOULDsend no more than oneoriginate a Route Error for this packet to each originalsender of anysource ofthese packets. - If the nodea packet removed in this way (Section 8.3) and SHOULD salvage each packet removed in this way (Section 8.3.6) if it has another route tothethat packet's IP Destination Address in its RouteCache, the node SHOULD salvage theCache. The definition of MaxMaintRexmt conceptually includes any retransmissions that might be attempted for a packetas described in Section 6.3.6. Otherwise, the node SHOULD discardat thepacket. 3.4.3. Automatic Route Shortening Source routes in use MAY be automatically shortened if onelink layer ormore intermediate nodes inwithin theroute become no longer necessary. This mechanism of automatically shortening routes in use is somewhat similarnetwork interface hardware. The timeout value to use for each transmission attempt for an acknowledgement request depends on theuseJohnson, et al Expires 24 August 2003 [Page 30] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 type ofpassive acknowledgments [16]. In particular, ifacknowledgement mechanism used by Route Maintenance for that attempt, as described in Section 8.3. 4.6. Blacklist When a node using the DSR protocol isable to overhearconnected through an interface that requires physically bidirectional links for unicast transmission, it MUST maintain apacket carryingblacklist. A Blacklist is asource route (e.g.,table, indexed byoperating its network interface in promiscuous receive mode), then this node examines the unexpended portion ofneighbor address, thatsource route. Ifindicates that the link between this nodeis not the intended next-hop destination forand thepacket but is namedspecified neighbor may not be bidirectional. A node places another node's address inthe later unexpended portion of the packet's source route, thenthis list when itcan inferbelieves that broadcast packets from that other node reach this node, but that unicast transmission between theintermediatetwo nodesbefore itself in the source route are no longer needed in the route.is not possible. For example,the figure below illustrates an example in which node D has overheard a data packet being transmitted from B to C, for later forwarding to D and to E: +-----+ +-----+ +-----+ +-----+ +-----+ | A |---->| B |---->| C | | D | | E | +-----+ +-----+ +-----+ +-----+ +-----+ \ ^ \ / --------------------- In this case, this node (node D) SHOULD returnif a node forwarding a"gratuitous" Route Reply to the original sender of the packet (node A). TheRoute Replygives the shorter route as the concatenation of the portion ofdiscovers that theoriginal source route up throughnext hop is unreachable, it places that next hop in the node's blacklist. Once a node discovers thattransmitted the overheard packet (node B), plus the suffixit can communicate bidirectionally with one of theoriginal source route beginning withnodes listed in the blacklist, it SHOULD remove that nodereturningfrom thegratuitous Route Reply (node D). In thisblacklist. For example,the route returnedif node A has node B inthe gratuitous Route Reply message sent from D toits blacklist, but Agives the new route ashears B forward a Route Request with a hop list indicating that thesequence of hopsbroadcast from A to B was successful, then A SHOULD remove B from its blacklist. A node MUST associate a state with each node in the blacklist, specifying whether the unidirectionality is "questionable" or "probable". Each time the unreachability is positively determined, the node SHOULD set the state toD"probable". After the unreachability has not been positively determined for some amount of time, the state should revert toE."questionable". A node MAY expire nodes from its blacklist after a reasonable amount of time. Johnson, et al Expires2124 August20022003 [Page15]31] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 When deciding whether to return a gratuitous Route Reply in this way, a node MAY factor in2003 5. Additional Conceptual Data Structures for Flow State Extension This section defines additionalinformation beyondconceptual data structures used by thefact that it was ableoptional "flow state" extension tooverhearDSR. In an implementation of thepacket. For example,protocol, these data structures MAY be implemented in any manner consistent with the external behavior described in this document. 5.1. Flow Table A nodeMAY decide to return the gratuitous Route Reply only whenimplementing theoverheard packet is received withflow state extension MUST implement asignal strenthFlow Table orsignal-to-noise ratio above some specific threshold. In addition, eachother data structure consistent with the external behavior described in this section. A nodemaintainsnot implementing the flow state extension SHOULD NOT implement aGratuitous Route Reply Table,Flow Table. The Flow Table records information about flows from which packets recently have been sent or forwarded by this node. The table is indexed by a triple (IP Source Address, IP Destination Address, Flow ID), where Flow ID is a 16-bit token assigned by the source as described in Section4.4, to limit3.5.1. Each entry in therate at which it originates gratuitous Route Replies forFlow Table contains thesame returned route. 3.4.4. Increased Spreadingfollowing fields: - The MAC address ofRoute Error Messages When a source node receives a Route Error for a data packet that it originated, this sourcethe next-hop nodepropagates this Route Error to its neighbors by piggybacking it on its next Route Request. Inalong thisway, stale information in the cachesflow. - An indication ofnodes around this source node will not generate Route Replies that containthesame invalid link for whichoutgoing network interface on thissourcenodereceived the Route Error. For example, in the situation shownto be used inthe exampletransmitting packets along this flow. - The MAC address ofSection 3.2,the previous-hop node along this flow. - An indication of the network interface on this nodeA learnsfromthe Route Error messagewhich packets fromC,thatthe link from C to D is currently broken. It thus removesprevious-hop node are received. - A timeout after which thislink from its own Route Cache and initiates a new Route Discovery (if it has no other route to Eentry inits Route Cache). OntheRoute Request packet initiatingFlow Table MUST be deleted. - The expected value of the Hop Count field in the DSR Flow State header for packets received for forwarding along thisRoute Discovery, node A piggybacksfield (for use with packets containing acopyDSR Flow State header). - An indication of whether or not thisRoute Error, ensuring thatflow can be used as a default flow for packets originated by this node (the flow IP MUST be odd). - The entry SHOULD record theRoute Error spreads well to other nodes, and guaranteeing that any Route Reply that it receives (including those from other node's Route Caches)complete source route for the flow. (Nodes not recording the complete source route cannot participate inresponse to thisAutomatic RouteRequest does notShortening.) - The entry MAY contain aroute that assumesfield recording theexistence oftime thisbroken link.entry was last used. Johnson, et al Expires2124 August20022003 [Page16]32] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 4. Conceptual Data Structures This document describes the operation of the DSR protocol in terms of a number of conceptual data structures. This section describes each of these data structures and provides an overview of2003 The entry MUST be deleted when itsuse in the protocol. In an implementation oftimeout expires. 5.2. Automatic Route Shortening Table A node implementing theprotocol, theseflow state extension SHOULD implement an Automatic Route Shortening Table or other datastructures MAY be implemented in any mannerstructure consistent with the external behavior described in thisdocument. 4.1. Route Cache All ad hoc network routing information needed by asection. A node not implementingDSR is stored in that node's Route Cache. Each node inthenetwork maintains its ownflow state extension SHOULD NOT implement an Automatic RouteCache. A node adds information to itsShortening Table. The Automatic RouteCache as it learns of new links between nodes in the ad hoc network;Shortening Table records information about received packets forexample, a nodewhich Automatic Route Shortening maylearn of new links when it receives a packet carryingbe possible. The table is indexed by a triple (IP Source Address, IP Destination Address, Flow ID). Each entry in the Automatic RouteRequest, Route Reply, or DSR source route. Likewise,Shortening Table contains anode removes information from its Route Cache as it learnslist of (packet identifier, Hop Count) pairs for thatexisting linksflow. The packet identifier in thead hoc network have broken;list may be any unique identifier for the received packet; for example,a node may learnfor IPv4 packets, the combination ofa broken link when it receives a packet carrying a Route Error or throughthelink-layer retransmission mechanism reporting a failure in forwarding a packet to its next-hop destination. Anytime a node adds new information to its Route Cache,following fields from thenode SHOULD check each packet in its own Send Buffer (Section 4.2) to determine whether a route to thatpacket's IP header MAY be used as a unique identifier for the packet: Source Address, DestinationAddress now existsAddress, Identification, Protocol, Fragment, and Total Length. The Hop Count in thenode's Route Cache (includinglist in theinformation just added toentry is copied from theCache). If so,Hop Count field in the DSR Flow State header of the received packet for which this table entry was created. Any packet identifier SHOULDthen be sent using that routeappear at most once in the list in an entry, andremoved fromthis list item SHOULD record theSend Buffer. It is possible to interfaceminimum Hop Count value received for that packet (if the wireless signal strength or signal-to-noise ratio at which aDSR network with other networks, externalpacket is received is available tothisthe DSRnetwork. Such external networks may,implementation in a node, the node MAY, for example,beremember instead in this list theInternet,minimum Hop Count value for which the received packet's signal strength ormay be other ad hoc networks routed withsignal-to-noise ratio exceeded some threshold). Space in the Automatic Route Shortening Table of arouting protocol other than DSR. Such external networks may alsonode MAY beother DSR networks that are treated as external networksdynamically managed by any local algorithm at the node. For example, in order toimprove scalability. The complete handlinglimit the amount ofsuch external networks is beyondmemory used to store thescopetable, any existing entry MAY be deleted at any time, and the number ofthis document.packets listed in each entry MAY be limited. However,this document specifies a minimal set of requirements and features necessary to allow nodes only implementing this specification to interoperate correctly withwhen reclaiming space in the table, nodesimplementing interfaces to such external networks. This minimal set of requirements and features involveSHOULD favor retaining information about more flows in theFirst Hop External (F) and Last Hop External (L) bitstable rather than more packets listed ina DSR Source Route option (Section 5.7) and a Route Reply option (Section 5.3)each entry ina packet's DSR header (Section 5). These requirements also includetheadditiontable, as long as at least the listing ofan External flag bit tagging each linksome small number of packets (e.g., 3) can be retained in each entry. In addition, subject to any implementation limit on theRoute Cache, copied fromnumber of packets listed in each entry in theFirst Hop External (F) and Last Hop External (L) bitstable, information about a packet listed in an entry SHOULD be retained until theDSR Source Route optionexpiration of the packet's IP TTL. 5.3. Default Flow ID Table A node implementing the flow state extension MUST implement a Default Flow Table orRoute Reply option from which this link was learned.other data structure consistent with the external Johnson, et al Expires2124 August20022003 [Page17]33] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 The Route Cache2003 behavior described in this section. A node not implementing the flow state extension SHOULDsupport storing more than one route toNOT implement a Default Flow Table. For eachdestination. In searching the Route Cache(source, destination) pair for which aroute to some destination node,node forwards packets, theRoute Cache is indexed by destinationnodeaddress. The following properties describe this searching function on a Route Cache:MUST record: -Each implementation of DSRthe largest odd Flow ID value seen - the time atanywhich all of this (source, destination) pair's flows that are forwarded by this nodeMAY choose any appropriate strategy and algorithm for searching its Route Cache and selectingexpire - the current default Flow ID - a"best" route toflag indicating whether or not thedestination from among those found. For example,current default Flow ID is valid If a nodeMAY choose to select the shortest route to the destination (the shortest sequence of hops), ordeletes this record for a (source, destination) pair, itMAY use an alternate metric to select the route from the Cache. - However,MUST also delete all Flow Table entries for that (source, destination) pair. Nodes MUST delete table entries ifthereall of this (source, destination) pair's flows that aremultiple cached routes to a destination, the selectionforwarded by this node expire. Johnson, et al Expires 24 August 2003 [Page 34] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 6. DSR Options Header Format The Dynamic Source Routing protocol makes use ofroutes when searching the Route Cache MUST prefer routesa special header carrying control information thatdo not have the External flag set oncan be included in anylink.existing IP packet. Thispreference will select routes that lead directly toDSR Options header in a packet contains a small fixed-sized, 4-octet portion, followed by a sequence of zero or more DSR options carrying optional information. The end of thetarget node over routes that attempt to reachsequence of DSR options in thetarget via any external networks connected toDSR Options header is implied by total length of the DSRad hoc network. - In addition, any route selected when searchingOptions header. For IPv4, theRoute CacheDSR Options header MUSTNOT haveimmediately follow theExternal bit setIP header in the packet. (If a Hop-by-Hop Options extension header, as defined in IPv6 [7], becomes defined forany links other than possiblyIPv4, thefirst link,DSR Options header MUST immediately follow thelast link, or both;Hop-by-Hop Options extension header, if one is present in theExternal bitpacket, and MUSTNOT be set for any intermediate hops inotherwise immediately follow theroute selected. An implementation ofIP header.) To add aRoute Cache MAY provideDSR Options header to afixed capacity for the cache, orpacket, thecache size MAY be variable. TheDSR Options header is inserted followingproperties describethemanagement of available space within a node's Route Cache: - Each implementation of DSR at each node MAY choosepacket's IP header, before anyappropriate policy for managing the entries in its Route Cache,following header such aswhen limited cache capacity requiresachoice of which entries to retain intraditional (e.g., TCP or UDP) transport layer header. Specifically, theCache. For example, a node MAY chose a "least recently used" (LRU) cache replacement policy,Protocol field inwhichtheentry last used longest agoIP header isdiscarded from the cache if a decision needs to be madeused toallow space inindicate that a DSR Options header follows thecache for some new entry being added. - However,IP header, and theRoute Cache replacement policy SHOULD allow routes to be categorized based upon "preference", where routes with a higher preferences are less likelyNext Header field in the DSR Options header is used tobe removed fromindicate thecache. For example, a node could prefer routes for which it initiated a Route Discovery over routes that it learnedtype of protocol header (such as a transport layer header) following theresultDSR Options header. If any headers follow the DSR Options header in a packet, the total length ofpromiscuous snooping on other packets. In particular,the DSR Options header (and thus the total, combined length of all DSR options present) MUST be anode SHOULD prefer routes that it is presently using over those that it is not.multiple of 4 octets. This requirement preserves the alignment of these following headers in the packet. Johnson, et al Expires2124 August20022003 [Page18]35] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 Any suitable data structure organization, consistent with this specification, MAY be2003 6.1. Fixed Portion of DSR Options Header The fixed portion of the DSR Options header is used toimplementcarry information that must be present in any DSR Options header. This fixed portion of the DSR Options header has the following format: 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |F| Reserved | Payload Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Options . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Next Header 8-bit selector. Identifies the type of header immediately following the DSR Options header. Uses the same values as the IPv4 Protocol field [32]. Flow State Header (F) Flag bit. MUST be set to 0. This bit is set in a DSR Flow State header (Section 7.1) and clear in a DSR Options header. Reserved MUST be sent as 0 and ignored on reception. Payload Length The length of theRoute Cache in any node. For example,DSR Options header, excluding thefollowing two types4-octet fixed portion. The value oforganization are possible: - In DSR,theroute returnedPayload Length field defines the total length of all options carried ineach Route Reply thatthe DSR Options header. Options Variable-length field; the length of the Options field isreceivedspecified by theinitiatorPayload Length field in this DSR Options header. Contains one or more pieces ofa Route Discovery (or that is learned fromoptional information (DSR options), encoded in type-length-value (TLV) format (with theheaderexception ofoverhead packets, asthe Pad1 option, described in Section6.1.4) represents a complete path (a sequence6.8). The placement oflinks) leading toDSR options following thedestination node. By caching eachfixed portion ofthese paths separately, a "path cache" organization fortheRoute Cache canDSR Options header MAY beformed. A path cache is very simple to implement and easily guarantees that all routes are loop-free, since each individual route from a Route Reply or Route Request or used in a packet is loop-free. To search for a route in a path cache data structure, the sending node can simply search its Route Cachepadded forany path (or prefix of a path) that leadsalignment. However, due to theintended destination node. This type of organization for the Route Cachetypically limited available wireless bandwidth inDSR has been extensively studied through simulation [5, 9, 12, 19]ad hoc networks, Johnson, et al Expires 24 August 2003 [Page 36] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 this padding is not required, andthrough implementation ofreceiving nodes MUST NOT expect options within a DSRinOptions header to be aligned. Each DSR option is assigned amobile outdoor testbed underunique Option Type code. The most significantworkload [20, 21, 22]. - Alternatively,3 bits (that is, Option Type & 0xE0) allow a"link cache" organization could be usednode not implementing processing forthe Route Cache, in which each individual link (hop)this Option Type value to behave in theroutes returnedmanner closest to correct for that type: - The most significant bit inRoute Reply packets (or otherwise learned fromtheheader of overhead packets) is added toOption Type value (that is, Option Type & 0x80) represents whether or not aunified graph data structure ofnode receiving thisnode's current viewOption Type SHOULD respond to such a DSR option with a Route Error ofthe network topology. To search fortype OPTION_NOT_SUPPORTED, except that such arouteRoute Error SHOULD never be sent in response to a packet containing a Route Request option. - The two follow bits inlink cache,thesending node must useOption Type value (that is, Option Type & 0x60) are amore complex graph search algorithm,two-bit field indicating how suchas the well-known Dijkstra's shortest-path algorithm, to find the current best path through the graph to the destination node. Such an algorithm is more difficult to implement and may require significantly more CPU time to execute. However,alink cache organization is more powerful thannode that does not support this Option Type MUST process the packet: 00 = Ignore Option 01 = Remove Option 10 = Mark Option 11 = Drop Packet When these two bits are zero (that is, Option Type & 0x60 == 0), apath cache organization, in its abilitynode not implementing processing for that Option Type MUST use the Opt Data Len field toeffectively utilize all ofskip over thepotential information thatoption and continue processing. When these two bits are 01 (that is, Option Type & 0x60 == 0x20), a nodemight learn aboutnot implementing processing for that Option Type MUST use thestate ofOpt Data Len field to remove thenetwork. In particular, links learned from different Route Discoveries oroption from theheader of any overheard packets can be merged together to form new routes inpacket and continue processing as if thenetwork, but this isoption had notpossiblebeen included in the received packet. When these two bits are 10 (that is, Option Type & 0x60 == 0x40), apath cache due tonode not implementing processing for that Option Type MUST set theseparation of each individual path inmost significant bit following thecache. This typeOpt Data Len field, MUST ignore the contents oforganization fortheRoute Cache in DSR, includingoption using theeffect ofOpt Data Len field, and MUST continue processing the packet. Finally, when these two bits are 11 (that is, Option Type & 0x60 == 0x60), arange of implementation choices, has been studied through detailed simulation [9].node not implementing processing for that Option Type MUST drop the packet. Johnson, et al Expires 24 August 2003 [Page 37] INTERNET-DRAFT ThechoiceDynamic Source Routing Protocol 24 February 2003 The following types ofdata structure organization to useDSR options are defined in this document fortheuse within a DSR Options header: - RouteCache in anyRequest option (Section 6.2) - Route Reply option (Section 6.3) - Route Error option (Section 6.4) - Acknowledgement Request option (Section 6.5) - Acknowledgement option (Section 6.6) - DSRimplementation is a local matter for each node and affectsSource Route option (Section 6.7) - Pad1 option (Section 6.8) - PadN option (Section 6.9) Johnson, et al Expires2124 August20022003 [Page19]38] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 only performance; any reasonable choice of organization for the Route Cache does not affect either correctness or interoperability. Each entry in the Route Cache SHOULD have a timeout associated with it, to allow that entry to be deleted if not used within some time. The particular choice of algorithm and data structure used to implement the Route Cache SHOULD be considered in choosing the timeout for entries in the2003 6.2. RouteCache.Request Option Theconfiguration variable RouteCacheTimeout defined in Section 9 specifies the timeout to be applied to entries in theRouteCache, although it is also possible to instead use an adaptive policyRequest option inchoosing timeout values rather than using a single timeout setting for all entries; for example, the Link-MaxLife cache design (below) uses an adaptive timeout algorithm and does not use the RouteCacheTimeout configuration variable. As guidance to implementors, Appendix A describesatype of link cache knownDSR Options header is encoded as"Link-MaxLife" that has been shownfollows: 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ IP fields: Source Address MUST be set tooutperform other typesthe address oflink caches and path caches studied in detailed simulation [9]. Link-MaxLife is an adaptive link cache in which each link inthecache has a timeoutnode originating this packet. Intermediate nodes thatis determined dynamically byretransmit thecaching node accordingpacket toits observed past behavior ofpropagate thetwo nodes atRoute Request MUST NOT change this field. Destination Address MUST be set to theendsIP limited broadcast address (255.255.255.255). Hop Limit (TTL) MAY be varied from 1 to 255, for example to implement non-propagating Route Requests and Route Request expanding-ring searches (Section 3.3.4). Route Request fields: Option Type 2 Opt Data Len 8-bit unsigned integer. Length of thelink;option, inaddition, when selectingoctets, excluding the Option Type and Opt Data Len fields. Johnson, et al Expires 24 August 2003 [Page 39] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 Identification A unique value generated by the initiator (original sender) of the Route Request. Nodes initiating arouteRoute Request generate a new Identification value for each Route Request, for example based on apacket being sent to some destination, among cached routes of equal length (numbersequence number counter ofhops) to that destination, Link-MaxLife selects the route withall Route Requests initiated by thelongest expected lifetime (highest minimum timeoutnode. This value allows a receiving node to determine whether it has recently seen a copy ofany linkthis Route Request: if this Identification value is found by this receiving node in its Route Request Table (in theroute). Usecache of Identification values in theLink-MaxLife designentry there for this initiating node), this receiving node MUST discard the RouteCache is recommended in implementationsRequest. When propagating a Route Request, this field MUST be copied from the received copy ofDSR. 4.2. Send Bufferthe Route Request being propagated. Target Address TheSend Bufferaddress ofathe nodeimplementing DSRthat isa queuethe target ofpackets that cannot be sent by thatthe Route Request. Address[1..n] Address[i] is the address of the i-th nodebecause it does not yet have a source route to each such packet's destination. Each packetrecorded in theSend BufferRoute Request option. The address given in the Source Address field in the IP header islogically associated withthetime that it was placed intoaddress of theBuffer,initiator of the Route Discovery andSHOULDMUST NOT beremoved fromlisted in theSend Buffer and silently discarded after a periodAddress[i] fields; the address given in Address[1] is thus the address ofSendBufferTimeoutthe first node on the path afterinitially being placedthe initiator. The number of addresses present in this field is indicated by theBuffer. If necessary, a FIFO strategy SHOULD be used to evict packets before they timeout to preventOpt Data Len field in thebuffer from overflowing. Subject tooption (n = (Opt Data Len - 6) / 4). Each node propagating therate limiting defined in Section 6.2, aRouteDiscovery SHOULD be initiated as often as possible for the destinationRequest adds its own addressof any packets residing into this list, increasing theSend Buffer.Opt Data Len value by 4 octets. The Route Request option MUST NOT appear more than once within a DSR Options header. Johnson, et al Expires2124 August20022003 [Page20]40] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 4.3.2003 6.3. RouteRequest TableReply Option The RouteRequest Table ofReply option in anode implementingDSRrecords information about Route Requests that have been recently originated or forwarded by this node. The tableOptions header isindexed byencoded 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 | Opt Data Len |L| Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ IPaddress. Thefields: Source Address Set to the address of the node sending the RouteRequest Table onReply. In the case of a noderecordssending a reply from its Route Cache (Section 3.3.2) or sending a gratuitous Route Reply (Section 3.4.3), this address can differ from thefollowing information about nodesaddress that was the target of the Route Discovery. Destination Address MUST be set towhich thisthe address of the source nodehas initiatedof the route being returned. Copied from the Source Address field of the Route Request generating the Route Reply, or in the case of a gratuitous RouteRequest: - The Time-to-Live (TTL)Reply, copied from the Source Address fieldused inof theIP headerdata packet triggering the gratuitous Reply. Route Reply fields: Option Type 1. Nodes not understanding this option will ignore this option. Opt Data Len 8-bit unsigned integer. Length of theRoute Request foroption, in octets, excluding the Option Type and Opt Data Len fields. Johnson, et al Expires 24 August 2003 [Page 41] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 Last Hop External (L) Set to indicate that the lastRoute Discovery initiatedhop given bythis node for that target node. This value allowsthenodeRoute Reply (the link from Address[n-1] toimplementAddress[n]) is actually an arbitrary path in avariety of algorithms for controllingnetwork external to the DSR network; the exact route outside the DSR network is not represented in thespread of its Route Request on eachRouteDiscovery initiated for a target. As examples, two possible algorithms forReply. Nodes caching thisuse ofhop in their Route Cache MUST flag theTTL field are describedcached hop with the External flag. Such hops MUST NOT be returned inSection 3.3.4. - The time that this node last originateda cached RouteRequest for that target node. - The number of consecutive Route Discoveries initiated forReply generated from thistarget since receiving a validRouteReply giving a routeCache entry, and selection of routes from the Route Cache to route a packet being sent MUST prefer routes thattarget node. -contain no hops flagged as External. Reserved MUST be sent as 0 and ignored on reception. Address[1..n] Theremaining amountsource route being returned by the Route Reply. The route indicates a sequence oftime before which this node MAY next attempthops, originating ata Route Discovery for that target node. Whenthenode initiates a newsource node specified in the Destination Address field of the IP header of the packet carrying the RouteDiscovery for this target node, this fieldReply, through each of the Address[i] nodes in the order listed in the RouteRequest Table entry for that targetReply, ending with the destination node indicated by Address[n]. The number of addresses present in the Address[1..n] field isinitialized toindicated by thetimeout for that Route Discovery, after whichOpt Data Len field in thenodeoption (n = (Opt Data Len - 1) / 4). A Route Reply option MAYinitiate a new Discovery for that target. Untilappear one or more times within avalidDSR Options header. Johnson, et al Expires 24 August 2003 [Page 42] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 6.4. RouteReplyError Option The Route Error option in a DSR Options header isreceived forencoded 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 | Opt Data Len | Error Type |Reservd|Salvage| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Type-Specific Information . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 2. Nodes not understanding thistarget node address, a node MUST implement a back-off algorithm in determiningoption will ignore thistimeout value for each successiveoption. Opt Data Len 8-bit unsigned integer. Length of the option, in octets, excluding the Option Type and Opt Data Len fields. For the current definition of the RouteDiscovery initiated forError option, thistarget usingfield MUST be set to 10, plus thesame Time-to-Live (TTL) valuesize of any Type-Specific Information present in theIP headerRoute Error. Further extensions to the Route Error option format may also be included after the Type-Specific Information portion of the RouteRequest packet.Error option specified above. Thetimeout betweenpresence of suchconsecutive Route Discovery initiations SHOULD increaseextensions will be indicated bydoublingthetimeout value on each new initiation. In addition,Opt Data Len field. When theRoute Request Table on a node also recordsOpt Data Len is greater than that required for thefollowing information about initiator nodes from which this node has received a Route Request: - A FIFO cachefixed portion ofsize RequestTableIds entries containing the Identification value and target address fromthemost recentRouteRequests receivedError plus the necessary Type-Specific Information as indicated bythis node from that initiator node. Nodes SHOULD use an LRU policy to managetheentriesOption Type value intheir Route Request Table.the option, the remaining octets are interpreted as extensions. Currently, no such further extensions have been defined. Error Type The type of error encountered. Currently, the following type values are defined: 1 = NODE_UNREACHABLE 2 = FLOW_STATE_NOT_SUPPORTED 3 = OPTION_NOT_SUPPORTED Johnson, et al Expires2124 August20022003 [Page21]43] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 The number of Identification2003 Other valuesto retain in each Route Request Table entry, RequestTableIds,of the Error Type field are reserved for future use. Reservd Reserved. MUSTNOTbeunlimited, since,sent as 0 and ignored on reception. Salvage A 4-bit unsigned integer. Copied from the Salvage field in theworst case, when a node crashes and reboots,DSR Source Route option of the packet triggering thefirst RequestTableIdsRouteDiscoveries it initiates after rebooting could appear to be duplicates toError. The "total salvage count" of theother nodesRoute Error option is derived from the value in thenetwork. In addition, a node SHOULD base its initial Identification value, used forSalvage field of this RouteDiscoveries after rebooting, on a battery backed-up clock or other persistent memory device,Error option and all preceding Route Error options inorder to help avoid any possiblethe packet as follows: the total salvage count is the sum of, for each suchdelayRoute Error option, one plus the value insuccessfully discovering new routes after rebooting; if no such sourcethe Salvage field ofinitial Identification value is available, a node after rebooting SHOULD base its initial Identification value on a random number. 4.4. Gratuitousthat RouteReply TableError option. Error Source Address TheGratuitous Route Reply Tableaddress ofathe nodeimplementing DSR records information about "gratuitous"originating the RouteReplies sent by this node as part of automatic route shortening. As described in Section 3.4.3, aError (e.g., the nodereturns a gratuitous Route Reply when it overhearsthat attempted to forward a packettransmitted by some node, for which the node overhearingand discovered thepacket was notlink failure). Error Destination Address The address of theintended next-hopnodebut was named later into which theunexpended hops ofRoute Error must be delivered For example, when thesource route in that packet;Error Type field is set to NODE_UNREACHABLE, this field will be set to the address of the nodeoverhearingthat generated thepacket returns a gratuitous Route Reply torouting information claiming that theoriginal sender ofhop from thepacket, listingError Source Address to Unreachable Node Address (specified in theshorter route (not includingType-Specific Information) was a valid hop. Type-Specific Information Information specific to thehopsError Type ofthe source route "skipped over" bythispacket).Route Error message. Anode uses its GratuitousRouteReply Table to limitError option MAY appear one or more times within a DSR Options header. Johnson, et al Expires 24 August 2003 [Page 44] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 6.4.1. Node Unreachable Type-Specific Information When therate at which it originates gratuitousRouteReplies toError is of type NODE_UNREACHABLE, thesame original sender forType-Specific Information field is defined 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unreachable Node Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Unreachable Node Address The address of thesamenodefromthat was found to be unreachable (the next-hop neighbor to whichit overheard a packetthe node with address Error Source Address was attempting totriggertransmit the packet). 6.4.2. Flow State Not Supported Type-Specific Information When thegratuitousRouteReply. Each entry inError is of type FLOW_STATE_NOT_SUPPORTED, the Type-Specific Information field is empty. 6.4.3. Option Not Supported Type-Specific Information When theGratuitousRouteReply TableError is ofa node containstype OPTION_NOT_SUPPORTED, thefollowing fields: -Type-Specific Information field is defined as follows: 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |Unsupported Opt| +-+-+-+-+-+-+-+-+ Unsupported Opt Theaddresstype of option triggering thenode to which this node originated a gratuitousRouteReply. -Error. Johnson, et al Expires 24 August 2003 [Page 45] INTERNET-DRAFT Theaddress of the node from which this node overheard the packet triggering that gratuitous Route Reply. -Dynamic Source Routing Protocol 24 February 2003 6.5. Acknowledgement Request Option Theremaining time before which this entryAcknowledgement Request option in a DSR Options header is encoded 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 160. Nodes not understanding this option will remove theGratuitous Route Reply Table expiresoption andSHOULD be deleted by the node. When a node createsreturn anew entry in its GratuitousRouteReply Table,Error. Opt Data Len 8-bit unsigned integer. Length of thetimeout value for that entry should be initialized tooption, in octets, excluding thevalue GratReplyHoldoff. When a node overhears a packet that would trigger a gratuitous Route Reply, ifOption Type and Opt Data Len fields. Identification The Identification field is set to acorresponding entry already exists inunique value and is copied into thenode's Gratuitous Route Reply Table, thenIdentification field of the Acknowledgement option when returned by the nodeSHOULDreceiving the packet over this hop. An Acknowledgement Request option MUST NOTsendappear more than once within agratuitous Route Reply for that packet. Otherwise (no correspondingDSR Options header. Johnson, et al Expires2124 August20022003 [Page22]46] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 entry already exists), the node SHOULD create a new entry2003 6.6. Acknowledgement Option The Acknowledgement option inits Gratuitous Route Reply Table to record that gratuitous Route Reply, withatimeout value of GratReplyHoldoff. 4.5. Network Interface Queue and Maintenance Buffer Depending on factors suchDSR Options header is encoded 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ACK Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ACK Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 32. Nodes not understanding this option will remove thestructure and organizationoption. Opt Data Len 8-bit unsigned integer. Length of theoperating system, protocol stack implementation, network interface device driver, and network interface hardware, a packet being transmitted could be queuedoption, ina variety of ways. For example, outgoing packets from the network protocol stack might be queued at the operating system or link layer, before transmission byoctets, excluding thenetwork interface. The network interface might also provide a retransmission mechanism for packets, such as occurs in IEEE 802.11 [11];Option Type and Opt Data Len fields. Identification Copied from theDSR protocol, as part of Route Maintenance, requires limited bufferingIdentification field ofpackets already transmitted for whichthereachabilityAcknowledgement Request option of thenext-hop destination has not yet been determined. The operation of DSR is defined here in terms of two conceptual data structures that together incorporate this queueing behavior.packet being acknowledged. ACK Source Address TheNetwork Interface Queueaddress ofathe nodeimplementing DSR is an output queueoriginating the acknowledgement. ACK Destination Address The address ofpackets fromthenetwork protocol stack waitingnode tobe transmitted by the network interface; for example, inwhich the4.4BSD Unix network protocol stack implementation, this queue for a network interface is represented as a "struct ifqueue" [33]. This queueacknowledgement isusedtohold packets while the network interface is in the process of transmitting another packet.be delivered. An Acknowledgement option MAY appear one or more times within a DSR Options header. Johnson, et al Expires 24 August 2003 [Page 47] INTERNET-DRAFT TheMaintenance Buffer ofDynamic Source Routing Protocol 24 February 2003 6.7. DSR Source Route Option The DSR Source Route option in anode implementingDSR Options header isa queue of packets sent by this node that are awaiting next-hop reachability confirmationencoded aspartfollows: 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 | Opt Data Len |F|L|Reservd|Salvage| Segs Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 96. Nodes not understanding this option will drop the packet. Opt Data Len 8-bit unsigned integer. Length ofRoute Maintenance. For each packetthe option, in octets, excluding theMaintenance Buffer, a node maintains a countOption Type and Opt Data Len fields. For the format of thenumber of retransmissions andDSR Source Route option defined here, this field MUST be set to the value (n * 4) + 2, where n is thetimenumber of addresses present in thelast retransmission. The Maintenance Buffer MAY be of limited size; when adding a new packetAddress[i] fields. First Hop External (F) Set to indicate that theMaintenance Buffer, iffirst hop indicated by thebuffer sizeDSR Source Route option isinsufficientactually an arbitrary path in a network external toholdthenew packet,DSR network; thenew packet SHOULD be silently discarded. If, after MaxMaintRexmt attempts to confirm next-hop reachability of some node, no confirmationexact route outside the DSR network isreceived, all packetsnot represented in the DSR Source Route option. Nodes caching thisnode's Maintenance Bufferhop in their Route Cache MUST flag the cached hop withthis next-hop destination SHOULD be removed fromtheMaintenance Buffer;External flag. Such hops MUST NOT be returned inthis case, the node also SHOULD originatea RouteError forReply generated from thispacket to each original sourceRoute Cache entry, and selection of routes from the Route Cache to route a packetremoved in this way (Section 6.3) and SHOULD salvage each packet removed in this way (Section 6.3.6) if it has another routebeing sent MUST prefer routes that contain no hops flagged as External. Last Hop External (L) Set to indicate thatpacket's IP Destination Address in itsthe last hop indicated by the DSR Source RouteCache. The definition of MaxMaintRexmt conceptually includes any retransmissions that might be attempted foroption is actually an arbitrary path in apacket atnetwork external to thelink layer or withinDSR network; the exact route outside the DSR networkinterface hardware. The timeout value to use for each transmission attempt for an acknowledgment request depends onis not represented in the DSR Source Route option. Johnson, et al Expires2124 August20022003 [Page23]48] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 type of acknowledgment mechanism used for Route Maintenance for that attempt, as described2003 Nodes caching this hop inSection 6.3. 4.6. Blacklist When a node using the DSR protocol is connected through an interface that requires physically bidirectional links for unicast transmission, ittheir Route Cache MUSTkeep a blacklist. A Blacklist is a table, indexed by neighbor address, that indicates thatflag thelink between this node andcached hop with thespecified neighbor may notExternal flag. Such hops MUST NOT bebidirectional. A node places another node's addressreturned inthis list when it believes that broadcast packetsa Route Reply generated fromthat other node reachthisnode, but that unicast transmission betweenRoute Cache entry, and selection of routes from thetwo nodes is not possible. For example, if a node forwarding aRouteReply discoversCache to route a packet being sent MUST prefer routes thatthe next hop is unreachable, it placescontain no hops flagged as External. Reserved MUST be sent as 0 and ignored on reception. Salvage A 4-bit unsigned integer. Count of number of times thatnext hop in the node's blacklist. Oncethis packet has been salvaged as anode discovers that it can communicate bidirectionally with onepart of DSR routing (Section 3.4.1). Segments Left (Segs Left) Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination. Address[1..n] The sequence of addresses of thenodes listedsource route. In routing and forwarding the packet, the source route is processed as described in Sections 8.1.3 and 8.1.5. The number of addresses present in theblacklist, it SHOULD remove that node fromAddress[1..n] field is indicated by theblacklist. For example, if A has BOpt Data Len field inits blacklist, but A hears B forwardthe option (n = (Opt Data Len - 2) / 4). When forwarding aRoute Request withpacket along ahop list indicating that the broadcast from A to B was successful, A SHOULD remove B from its blacklist. A node MUST associateDSR source route using astate with each nodeDSR Source Route option in theblacklist, specifying whetherpacket's DSR Options header, theunidirectionality is "questionable" or "probable." Each timeDestination Address field in theunreachabilitypacket's IP header ispositively determined, the node SHOULDalways setthe stateto"probable." Aftertheunreachability has not been positively determined for some amountaddress oftime,thestate should revert to "questionable."packet's ultimate destination. A nodeMAY expire nodes from its blacklist afterreceiving areasonable amount of time.packet containing a DSR Options header with a DSR Source Route option MUST examine the indicated source route to determine if it is the intended next-hop node for the packet and determine how to forward the packet, as defined in Sections 8.1.4 and 8.1.5. Johnson, et al Expires2124 August20022003 [Page24]49] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5. DSR Header Format2003 6.8. Pad1 Option TheDynamic Source Routing protocol makes use ofPad1 option in a DSR Options header is encoded as follows: +-+-+-+-+-+-+-+-+ | Option Type | +-+-+-+-+-+-+-+-+ Option Type 224. Nodes not understanding this option will drop the packet and return aspecial header carrying control information that canRoute Error. A Pad1 option MAY be included inany existing IP packet. This DSR header in a packet contains a small fixed-sized, 4-octet portion, followed by a sequence of zero or more DSR options carrying optional information. The end ofthesequenceOptions field of a DSRoptionsOptions header intheorder to align subsequent DSRheaderoptions, but such alignment isimpliednot required and MUST NOT be expected bytotal length of thea node receiving a packet containing a DSR Options header.For IPv4, the DSR header MUST immediatelyIf any headers follow theIPDSR Options header in a packet, thepacket. (Iftotal length of aHop-by-HopDSR Optionsextensionheader,as definedindicated by the Payload Length field inIPv6 [6], becomes defined for IPv4,the DSRheader MUST immediately follow the Hop-by-HopOptionsextension header, if one is present in the packet, andheader MUSTotherwise immediately follow the IP header.) To addbe aDSR header tomultiple of 4 octets. In this case, when building apacket, theDSR Options headeris inserted following the packet's IP header, before any following header such asin atraditional (e.g., TCPpacket, sufficient Pad1 orUDP) transport layer header. Specifically, the Protocol fieldPadN options MUST be included in theIP header is used to indicate that a DSR header follows the IP header, and the Next HeaderOptions fieldinof the DSR Options headeris usedtoindicatemake thetype of protocol header (such astotal length atransport layer header) following the DSR header.multiple of 4 octets. Ifany headers follow the DSR headermore than one consecutive octet of padding is being inserted ina packet,thetotal lengthOptions field ofthea DSRheader (and thusOptions header, thetotal, combined length of all DSR options present) MUSTPadN option, described next, SHOULD beaused, rather than multipleof 4 octets. This requirement preservesPad1 options. Note that thealignmentformat ofthese following headers inthepacket.Pad1 option is a special case; it does not have an Opt Data Len or Option Data field. Johnson, et al Expires2124 August20022003 [Page25]50] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.1. Fixed Portion of DSR Header2003 6.9. PadN Option Thefixed portion of the DSR header is used to carry information that must be presentPadN option inany DSR header. This fixed portion of thea DSR Options headerhas the following format: 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Headeris encoded as follows: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - |ReservedOption Type |Payload LengthOpt Data Len |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Options . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Next HeaderOption Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - Option Type 0. Nodes not understanding this option will ignore this option. Opt Data Len 8-bitselector. Identifies the typeunsigned integer. Length ofheader immediately following the DSR header. Usesthesame values asoption, in octets, excluding theIPv4 Protocol field [29]. Reserved MUST be sent as 0Option Type andignored on reception. Payload Length The lengthOpt Data Len fields. Option Data A number of zero-valued octets equal to theDSR header, excluding the 4-octet fixed portion. The value ofOpt Data Len. A PadN option MAY be included in thePayload LengthOptions fielddefines the total lengthofall options carrieda DSR Options header intheorder to align subsequent DSR options, but such alignment is not required and MUST NOT be expected by a node receiving a packet containing a DSR Options header. If any headers follow the DSR OptionsVariable-length field;header in a packet, the total length ofthea DSR Optionsfield is specifiedheader, indicated by the Payload Length field inthisthe DSRheader. Contains one or more piecesOptions header MUST be a multiple ofoptional information (DSR options), encoded4 octets. In this case, when building a DSR Options header intype-length-value (TLV) format (with the exception of thea packet, sufficient Pad1option, described in Section 5.8). The placement of DSRor PadN optionsfollowingMUST be included in thefixed portionOptions field of the DSR Options headerMAY be padded for alignment. However, dueto make thetypically limited available wireless bandwidth in ad hoc networks, this padding is not required, and receiving nodes MUST NOT expect options within a DSR header to be aligned. Johnson, et al Expires 21 August 2002 [Page 26] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 The following types of DSR options are defined in this document for use withintotal length aDSR header: - Route Request option (Section 5.2) - Route Reply option (Section 5.3) - Route Error option (Section 5.4) - Acknowledgment Request option (Section 5.5) - Acknowledgment option (Section 5.6) - DSR Source Route option (Section 5.7) - Pad1 option (Section 5.8) - PadN option (Section 5.9)multiple of 4 octets. Johnson, et al Expires2124 August20022003 [Page27]51] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.2. Route Request Option2003 7. Additional Header Formats and Options for Flow State Extension TheRoute Request option in aoptional DSR flow state extension requires a new headeris encoded 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Target Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ IP fields: Source Address MUST be set totype, theaddress ofDSR Flow State header. In addition, thenode originating this packet. Intermediate nodes that retransmitDSR flow state extension adds thepacket to propagatefollowing options for theRoute Request MUST NOT change this field.DSR Options header defined in Section 6: - Timeout option - DestinationAddress MUST be set to the IP limited broadcast address (255.255.255.255). Hop Limit (TTL) MAY be varied from 1 to 255, for example to implement non-propagating Route RequestsandRoute Request expanding-ring searches (Section 3.3.4). Route Request fields: OptionFlow ID option Two new Error Type2 Opt Data Len 8-bit unsigned integer. Length ofvalues are also defined for use in theoption,Route Error option inoctets, excludinga DSR Options header: - Unknown Flow - Default Flow Unknown Finally, an extension to theOption Type and Opt Data Len fields.Acknowledgement Request option in a DSR Options header is also defined: - Previous Hop Address This section defines each of these new header or option formats. Johnson, et al Expires2124 August20022003 [Page28]52] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 Identification A unique value generated by the initiator (original sender) of the Route Request. Nodes initiating a Route Request generate a new Identification value for each Route Request, for example based on a sequence number counter of all Route Requests initiated by the node. This value allows2003 7.1. DSR Flow State Header The DSR Flow State header is areceiving nodesmall 4-byte header optionally used todetermine whether it has recently seen a copy of this Route Request: if this Identification value is found by this receiving node in its Route Request Table (in the cache of Identification values incarry theentry thereflow ID and hop count forthis initiating node), this receiving node MUST discard the Route Request. When propagatingaRoute Request, this field MUST be copied from the received copy of the Route Requestpacket beingpropagated. Target Address The address of the node thatsent along a DSR flow. It is distinguished from thetarget offixed DSR Options header (Section 6.1) in that theRoute Request. Address[1..n] Address[i]Flow State Header (F) bit isthe address of the i-th node recordedset in theRoute Request option. The address givenDSR Flow State header and is clear in theSource Address field infixed DSR Options header. 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |F| Hop Count | Flow Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Next Header 8-bit selector. Identifies theIPtype of headerisimmediately following theaddress ofDSR Flow State header. Uses theinitiator ofsame values as theRoute Discovery andIPv4 Protocol field [32]. Flow State Header (F) Flag bit. MUSTNOTbelistedset to 1. This bit is set inthe Address[i] fields; the address givena DSR Flow State header and clear inAddress[1]a DSR Options header (Section 6.1). Hop Count 7-bit unsigned integer. The number of hops through which this packet has been forwarded. Flow Identification The flow ID for this flow, as described in Section 3.5.1. Johnson, et al Expires 24 August 2003 [Page 53] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 7.2. Options and Extensions in DSR Options Header 7.2.1. Timeout Option The Timeout option isthusdefined for use in a DSR Options header to indicate theaddressamount of time before thefirst node onexpiration of thepath afterflow ID along which theinitiator. The number of addresses present in this fieldpacket isindicated bybeing sent. 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 | Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 128. Nodes not understanding this option will ignore the option and return a Route Error. Opt Data Lenfield8-bit unsigned integer. Length of the option, in octets, excluding theoption (n = (OptOption Type and Opt Data Len- 6) / 4). Each node propagatingfields. When no extensions are present, theRoute Request adds its own addressOpt Data Len of a Timeout option is 2. Further extensions tothis list, increasing theDSR may include additional data in a Timeout option. The presence of such extensions is indicated by an Opt Data Lenvalue by 4 octets.greater than 2. Currently, no such extensions have been defined. Timeout TheRoute Requestnumber of seconds for which this flow remains valid. The Timeout option MUST NOT appear more than once within a DSR Options header. Johnson, et al Expires2124 August20022003 [Page29]54] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.3. Route Reply2003 7.2.2. Destination and Flow ID Option TheRoute ReplyDestination and Flow ID option is defined for use in a DSR Options headeris encoded as follows:to send a packet to an intermediate host along one flow, for eventual forwarding to the final destination along a different flow. This option enables the aggregation of the state of multiple flows. 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 |Opt Data Len |L| Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Option Length |...New Flow Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+New IPfields: SourceDestination AddressSet to| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 129. Nodes not understanding this option will ignore theaddressoption and return a Route Error. Opt Data Len 8-bit unsigned integer. Length of thenode sendingoption, in octets, excluding theRoute Reply. InOption Type and Opt Data Len fields. When no extensions are present, thecaseOpt Data Len of anode sending a reply from its Route Cache (Section 3.3.2) or sending a gratuitous Route Reply (Section 3.4.3), this address can differ from the address that was the target of the Route Discovery.DestinationAddress MUST be setand Flow ID option is 6. Further extensions tothe address of the source nodeDSR may include additional data in a Destination and Flow ID option. The presence of such extensions is indicated by an Opt Data Len greater than 6. Currently, no such extensions have been defined. New Flow Identifier Indicates theroute being returned. Copied fromnext identifier to store in theSource AddressFlow ID field of theRoute Request generatingDSR Options header. New IP Destination Address Indicates theRoute Reply, ornext address to store in thecase of a gratuitous Route Reply, copied from the SourceDestination Address field of thedata packet triggering the gratuitous Reply. Route Reply fields: Option Type 3 Opt Data Len 8-bit unsigned integer. Length of the option, in octets, excluding the Option TypeIP header. The Destination andOpt Data Len fields.Flow ID option MAY appear one or more times within a DSR Options header. Johnson, et al Expires2124 August20022003 [Page30]55] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 Last Hop External (L) Set to indicate that the last hop given by the Route Reply (the link from Address[n-1] to Address[n])2003 7.2.3. New Error Type Value for Unknown Flow A new Error Type value of 129 (Unknown Flow) isactually an arbitrary pathdefined for use in anetwork external to the DSR network; the exact route outside the DSR network is not represented in the Route Reply. Nodes caching this hop in theirRouteCache MUST flag the cached hop with the External flag. Such hops MUST NOT be returnedError option in acached Route Reply generated from this Route Cache entry, and selectionDSR Options header. The Type-Specific Information for errors ofroutes from the Route Cache to route a packet being sent MUST prefer routes that contain no hops flagged as External. Reserved MUST be sentthis type is encoded 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 0and ignored on reception. Address[1..n] The source route being returned by the Route Reply. The route indicates a sequence of hops, originating at the source node specified in the1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Original IP Destination Addressfield of the| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Flow ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Original IPheaderDestination Address The IP Destination Address of the packetcarrying the Route Reply, through each of the Address[i] nodes inthat caused theorder listederror. Flow ID The Flow ID contained in theRoute Reply, ending withDSR Flow ID option that caused thedestination node indicated by Address[n].error. Johnson, et al Expires 24 August 2003 [Page 56] INTERNET-DRAFT ThenumberDynamic Source Routing Protocol 24 February 2003 7.2.4. New Error Type Value for Default Flow Unknown A new Error Type value ofaddresses present in the Address[1..n] field130 (Default Flow Unknown) isindicated by the Opt Data Len fielddefined for use inthe option (n = (Opt Data Len - 1) / 4). Aa RouteReplyError optionMAY appear one or more times withinin a DSR Options header. The Type-Specific Information for errors of this type is encoded 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Original IP Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Original IP Destination Address The IP Destination Address of the packet that caused the error. Johnson, et al Expires2124 August20022003 [Page31]57] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.4. Route Error2003 7.2.5. Acknowledgement Request Option Previous Hop Address Extension When the Option Length field of an Acknowledgement Request option in a DSR Options header is greater than or equal to 6, a Previous Hop Address Extension is present. TheRoute Erroroptionin a DSR headerisencodedthen formatted 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 |Opt Data Len | Error Type |Reservd|Salvage| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Option Length |Error Source AddressPacket Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Error DestinationACK Request Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+. . . Type-Specific Information . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Option Type4 Opt Data Len5 Option Length 8-bit unsigned integer. Length of the option, inoctets, excludingoctets, excluding the Option Type and Option Length fields. When no extensions are presents, the Option Length of a Acknowledgement Request option is 2. Further extensions to DSR may include additional data in a Acknowledgement Request option. The presence of such extensions is indicated by an Opt Data Len greater than 2. Currently, one such extension has been defined. If the Option Length is at least 6, then a ACK Request Source Address is present. Packet Identifier The Packet Identifier field is set to a unique number and is copied into the Identification field of the DSR Acknowledgement option when returned by the node receiving the packet over this hop. ACK Request Source Address The address of the node requesting the DSR Acknowledgement. Johnson, et al Expires 24 August 2003 [Page 58] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 8. Detailed Operation 8.1. General Packet Processing 8.1.1. Originating a Packet When originating any packet, a node using DSR routing MUST perform the following sequence of steps: - Search the node's Route Cache for a route to the address given in the IP Destination Address field in the packet's header. - If no such route is found in the Route Cache, then perform Route Discovery for the Destination Address, as described in Section 8.2. Initiating a Route Discovery for this target node address results in theOption Typenode adding a Route Request option in a DSR Options header in this existing packet, or saving this existing packet to its Send Buffer andOpt Data Len fields. Forinitiating thecurrent definition ofRoute Discovery by sending a separate packet containing such a Route Request option. If the node chooses to initiate the RouteError option,Discovery by adding the Route Request option to this existing packet, it will replace the IP Destination Address fieldMUST be setwith the IP "limited broadcast" address (255.255.255.255) [3], copying the original IP Destination Address to10, plusthesizeTarget Address field ofany Type-Specific Information present inthe new RouteError. Further extensionsRequest option added to the packet, as described in Section 8.2.1. - If the packet now does not contain a RouteError option format may also be included afterRequest option, then this node must have a route to theType-Specific Information portionDestination Address of theRoute Error option specified above. The presence of such extensions will be indicated bypacket; if theOpt Data Len field. Whennode has more than one route to this Destination Address, theOpt Data Lennode selects one to use for this packet. If the length of this route is greater than 1 hop, or if the node determines to request a DSR network-layer acknowledgement from the first-hop node in thatrequired forroute, then insert a DSR Options header into the packet, as described in Section 8.1.2, and insert a DSR Source Route option, as described in Section 8.1.3. The source route in the packet is initialized from thefixed portionselected route to the Destination Address of theRoute Error pluspacket. - Transmit thenecessary Type-Specific Information as indicated bypacket to theOption Type valuefirst-hop node address given in selected source route, using Route Maintenance to determine theoption,reachability of theremaining octets are interpretednext hop, asextensions. Currently, no such further extensions have been defined. Error Type The type of error encountered. Currently,described in Section 8.3. 8.1.2. Adding a DSR Options Header to a Packet A node originating a packet adds a DSR Options header to thefollowing type valuepacket, if necessary, to carry information needed by the routing protocol. A packet MUST NOT contain more than one DSR Options header. A DSR Options header isdefined: 1 = NODE_UNREACHABLE Other values ofadded to a packet by performing theError Type field are reserved for future use.following Johnson, et al Expires2124 August20022003 [Page32]59] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 Reservd Reserved. MUST be sent as 0 and ignored on reception. Salvage A 4-bit unsigned integer. Copied from the Salvage field in the DSR Source Route option2003 sequence of steps (these steps assume that the packettriggering the Route Error. The "total salvage count" of the Route Error option is derived from the value in the Salvage field of this Route Error option and all preceding Route Error optionscontains no other headers that MUST be located in the packetas follows: the total salvage count isbefore thesum of, for each such Route Error option, one plusDSR Options header): - Insert a DSR Options header after thevalue inIP header but before any other header that may be present. - Set theSalvageNext Header field ofthat Route Error option. Error Source Address The address ofthenode originatingDSR Options header to theRoute Error (e.g.,Protocol number field of thenode that attempted to forward a packet and discoveredpacket's IP header. - Set thelink failure). Error Destination Address The addressProtocol field of thenodepacket's IP header towhichthe Protocol number assigned for a DSR Options header (TBA???). 8.1.3. Adding a DSR Source RouteError must be delivered For example, whenOption to a Packet A node originating a packet adds a DSR Source Route option to theError Type field is setpacket, if necessary, in order toNODE_UNREACHABLE,carry the source route from thisfield will be setoriginating node to the final destination address of thenode that generatedpacket. Specifically, therouting information claiming thatnode adding thehop fromDSR Source Route option constructs theErrorDSR SourceAddress to Unreachable Node Address (specified inRoute option and modifies theType-Specific Information) was a valid hop. Type-Specific Information Information specificIP packet according to theError Typefollowing sequence ofthis Route Error message. Currently, the Type-Specific Information field is defined only forsteps: - The node creates a DSR Source RouteError messages of type NODE_UNREACHABLE. In this case, the Type-Specific Information field is defined 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unreachable Node Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Johnson, et al Expires 21 August 2002 [Page 33] INTERNET-DRAFToption, as described in Section 6.7, and appends it to the DSR Options header in the packet. (A DSR Options header is added, as described in Section 8.1.2, if not already present.) - TheDynamicnumber of Address[i] fields to include in the DSR SourceRouting Protocol 21 February 2002 Unreachable Node Address TheRoute option (n) is the number of intermediate nodes in the source route for the packet (i.e., excluding address of the originating nodethat was found to be unreachable (the next-hop neighbor to whichand thenode withfinal destination addressError Source Address was attempting to transmitof the packet).AThe Segments Left field in the DSR Source RouteErroroptionMAY appear one or more timesis initialized equal to n. - The addresses withinathe source route for the packet are copied into sequential Address[i] fields in the DSRheader. Johnson, et al Expires 21 August 2002 [Page 34] INTERNET-DRAFT The DynamicSourceRouting Protocol 21 February 2002 5.5. Acknowledgment Request OptionRoute option, for i = 1, 2, ..., n. - TheAcknowledgment Request optionFirst Hop External (F) bit inathe DSRheaderSource Route option isencodedcopied from the External bit flagging the first hop in the source route for the packet, asfollows: 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 5 Opt Data Len 8-bit unsigned integer. Length ofindicated in theoption,Route Cache. - The Last Hop External (L) bit inoctets, excludingtheOption Type and Opt Data Len fields. Identification The Identification field is set to a unique value andDSR Source Route option is copiedintofrom theIdentification field ofExternal bit flagging theAcknowledgment option when returned bylast hop in thenode receivingsource route for the packet, as indicated in the Route Cache. - The Salvage field in thepacket over this hop. An Acknowledgment Request option MUST NOT appear more than once within aDSRheader.Source Route option is initialized to 0. Johnson, et al Expires2124 August20022003 [Page35]60] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.6. Acknowledgment Option The Acknowledgment option in2003 8.1.4. Processing aDSR header is encodedReceived Packet When a node receives any packet (whether for forwarding, overheard, or asfollows: 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 | Opt Data Len | Identification | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ACK Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ACK Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 6 Opt Data Len 8-bit unsigned integer. Lengththe final destination of theoption,packet), if that packet contains a DSR Options header, then that node MUST process any options contained in that DSR Options header, inoctets, excludingtheOption Typeorder contained there. Specifically: - If the DSR Options header contains a Route Request option, the node SHOULD extract the source route from the Route Request andOpt Data Len fields. Identification Copiedadd this routing information to its Route Cache, subject to the conditions identified in Section 3.3.1. The routing information from theIdentification fieldRoute Request is the sequence of hop addresses initiator, Address[1], Address[2], ..., Address[n] where initiator is theAcknowledgment Request optionvalue of thepacket being acknowledged. ACKSource AddressThe addressfield in the IP header of thenode originatingpacket carrying theacknowledgment. ACK Destination Address TheRoute Request (the address of thenode to whichinitiator of theacknowledgmentRoute Discovery), and each Address[i] isto be delivered. An Acknowledgment option MAY appear one or more times withinaDSR header. Johnson, et al Expires 21 August 2002 [Page 36] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 5.7. DSR Source Route Option The DSR Sourcenode through which this RouteoptionRequest has passed, ina DSR headerturn, during this Route Discovery. The value n here isencoded 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 | Opt Data Len |F|L|Reservd|Salvage| Segs Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[1] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[2] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Address[n] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Option Type 7 Optthe number of addresses recorded in the Route Request option, or (Opt Data Len8-bit unsigned integer. Length of- 6) / 4. After possibly updating the node's Route Cache in response to the routing information in the Route Request option, the node MUST then process the Route Request option as described inoctets, excludingSection 8.2.2. - If theOption Type and Opt Data Len fields. ForDSR Options header contains a Route Reply option, theformat ofnode SHOULD extract the source route from theDSR SourceRouteoption defined here,Reply and add thisfield MUST be setrouting information to its Route Cache, subject to thevalue (n * 4) + 2, where nconditions identified in Section 3.3.1. The source route from the Route Reply is thenumbersequence of hop addressespresentinitiator, Address[1], Address[2], ..., Address[n] where initiator is the value of the Destination Address field in theAddress[i] fields. First Hop External (F) Set to indicate thatIP header of thefirst hop indicated bypacket carrying theDSR SourceRouteoptionReply (the address of the initiator of the Route Discovery), and each Address[i] isactually an arbitrary path inanetwork external tonode through which theDSR network;source route passes, in turn, on theexactrouteoutsideto theDSR network is not represented intarget of theDSR SourceRouteoption. Nodes caching this hopDiscovery. Address[n] is the address of the target. If the Last Hop External (L) bit is set intheirthe RouteCacheReply, the node MUST flag thecachedlast hopwithfrom theExternal flag. Such hops MUST NOT be returned in aRoute Replygenerated from this Route Cache entry, and selection of routes(the link fromtheAddress[n-1] to Address[n]) in its Route Cacheto route a packet being sent MUST prefer routes that contain no hops flaggedas External.Last Hop External (L) Set to indicate that the last hop indicated by the DSR Source Route optionThe value n here isactually an arbitrary path in a network external totheDSR network;number of addresses in theexactsource routeoutside the DSR network is not representedbeing returned in theDSR Source Route option. Nodes caching this hop in theirRouteCache MUST flag theReply option, or (Opt Data Len - 1) / 4. Johnson, et al Expires2124 August20022003 [Page37]61] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 cached hop with2003 After possibly updating theExternal flag. Such hops MUST NOT be returned in a Route Reply generated from thisnode's Route Cacheentry, and selection of routes fromin response to the routing information in the RouteCache to route a packet being sent MUST prefer routes that contain no hops flagged as External. Reserved MUST be sent as 0 and ignored on reception. Salvage A 4-bit unsigned integer. Count of numberReply option, then if the packet's IP Destination Address matches one oftimes thatthispacket has been salvagednode's IP addresses, the node MUST then process the Route Reply option asa part ofdescribed in Section 8.2.5. - If the DSRrouting (Section 3.4.1). Segments Left (Segs Left) Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reachingOptions header contains a Route Error option, thefinal destination. Address[1..n] The sequence of addresses ofnode MUST process thesource route. In routing and forwardingRoute Error option as described in Section 8.3.5. - If thepacket,DSR Options header contains an Acknowledgement Request option, thesource route is processednode MUST process the Acknowledgement Request option as described inSections 6.1.3 and 6.1.5. The number of addresses presentSection 8.3.3. - If the DSR Options header contains an Acknowledgement option, then subject to the conditions identified in Section 3.3.1, theAddress[1..n] field is indicated bynode SHOULD add to its Route Cache the single link from theOpt Data Len field innode identified by theoption (n = (Opt Data Len - 2) / 4). When forwarding a packet along a DSR source route using a DSRACK SourceRoute option inAddress field to thepacket's DSR header,node identified by the ACK Destination Addressfield infield. After possibly updating thepacket's IP header is always setnode's Route Cache in response to theaddress ofrouting information in the Acknowledgement option, thepacket's ultimate destination. Anodereceiving a packet containing aMUST then process the Acknowledgement option as described in Section 8.3.3. - If the DSR Options headerwithcontains a DSR Source Routeoption MUST examineoption, the node SHOULD extract theindicatedsource routeto determine if it is the intended next-hop node forfrom thepacketDSR Source Route anddetermine howadd this routing information to its Route Cache, subject toforwardthepacket, as definedconditions identified inSections 6.1.4 and 6.1.5. Johnson, et al Expires 21 August 2002 [Page 38] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 5.8. Pad1 Option The Pad1 optionSection 3.3.1. If the value of the Salvage field inathe DSRheader is encoded as follows: +-+-+-+-+-+-+-+-+ | Option Type | +-+-+-+-+-+-+-+-+ Option Type 0 A Pad1Source Route optionMAY be included inis zero, then the routing information from theOptions field of a DSR header in order to align subsequentDSRoptions, but such alignmentSource Route isnot requiredthe sequence of hop addresses source, Address[1], Address[2], ..., Address[n], destination andMUST NOT be expected by a node receiving a packet containing aotherwise (Salvage is nonzero), the routing information from the DSRheader. If any headers followSource Route is theDSR header in a packet,sequence of hop addresses Address[1], Address[2], ..., Address[n], destination where source is thetotal lengthvalue ofa DSR header, indicated bythePayload LengthSource Address field in theDSRIP headerMUST be a multipleof4 octets. In this case, when building athe packet carrying the DSRheader in a packet, sufficient Pad1 or PadN options MUST be includedSource Route option (the original sender of the packet), each Address[i] is the value in theOptionsAddress[i] fieldofin the DSRheader to makeSource Route, and destination is thetotal length a multiple of 4 octets. If more than one consecutive octetvalue ofpadding is being inserted intheOptionsDestination Address field in the packet's IP header (the last-hop address ofa DSR header,thePadN option, described next, SHOULD be used, rather than multiple Pad1 options. Note thatsource route). The value n here is theformatnumber of addresses in source route in thePad1 option is a special case; it does not have an Opt Data LenDSR Source Route option, orOption(Opt Datafield.Len - 2) / 4. Johnson, et al Expires2124 August20022003 [Page39]62] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 5.9. PadN Option The PadN option in a DSR header is encoded as follows: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - | Option Type | Opt Data Len | Option Data +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - Option Type 1 Opt Data Len 8-bit unsigned integer. Length of the option, in octets, excluding2003 After possibly updating theOption Type and Opt Data Len fields. Option Data A number of zero-valued octets equalnode's Route Cache in response to theOpt Data Len. A PadN option MAY be includedrouting information in theOptions field of a DSR header in order to align subsequentDSRoptions, but such alignment is not required and MUST NOT be expected by aSource Route option, the nodereceiving a packet containing a DSR header. If any headers followMUST then process the DSRheaderSource Route option as described in Section 8.1.5. - Any Pad1 or PadN options ina packet,thetotal length of aDSRheader, indicated byOptions header are ignored. Finally, if thePayload Length fieldDestination Address in theDSRpacket's IP headerMUST be a multiplematches one of4 octets. Inthiscase, when building areceiving node's own IP address(es), remove the DSR Options headerin a packet, sufficient Pad1 or PadN options MUST beand all the included DSR options in theOptions fieldheader, and pass the rest of theDSR headerpacket tomakethetotal length a multiple of 4 octets. Johnson, et al Expires 21 August 2002 [Page 40] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 6. Detailed Operation 6.1. General Packetnetwork layer. 8.1.5. Processing6.1.1. OriginatingaPacketReceived DSR Source Route Option Whenoriginating any packet,a nodeusingreceives a packet containing a DSRrouting MUST performSource Route option (whether for forwarding, overheard, or as thefollowing sequencefinal destination ofsteps: - Searchthenode's Route Cache for a routepacket), that node SHOULD examine the packet to determine if theaddress givenreceipt of that packet indicates an opportunity for automatic route shortening, as described in Section 3.4.3. Specifically, if this node is not theIP Destination Address fieldintended next-hop destination for the packet but is named in thepacket's header. - If no suchlater unexpended portion of the source routeis foundin the packet's DSR Source RouteCache,option, thenperform Route Discoverythis packet indicates an opportunity for automatic route shortening: theDestination Address, as described in Section 6.2. Initiating a Route Discovery forintermediate nodes after the node from which thistargetnodeaddress results inoverheard the packet and before this nodeadding a Route Request option in a DSR headeritself, are no longer necessary in the source route. In thisexisting packet, or savingcase, thisexisting packet to its Send Buffer and initiatingnode SHOULD perform the following sequence of steps as part of automatic route shortening: - The node searches its Gratuitous RouteDiscovery by sending a separate packet containing suchReply Table for an entry describing a gratuitous RouteRequest option. If the node chooses to initiate the Route DiscoveryReply earlier sent byadding the Route Request option tothisexisting packet, it will replace the IP Destination Address field with the IP "limited broadcast" address (255.255.255.255) [3], copyingnode, for which the originalIP Destination Address to the Target Address fieldsender of thenew Route Request option added to the packet, as described in Section 6.2.1. - If thepacketnow does not contain atriggering the gratuitous RouteRequest option, thenReply and the transmitting node from which this nodemust have a routeoverheard that packet in order to trigger theDestination Address of the packet; ifgratuitous Route Reply, both match the respective nodehas more than one route toaddresses for thisDestination Address,new received packet. If such an entry is found in the node's Gratuitous Route Reply Table, the nodeselects oneSHOULD NOT perform automatic route shortening in response touse forthispacket. If the lengthreceipt of thisroute is greater than 1 hop, or if the node determines to request a DSR network-layer acknowledgment frompacket. - Otherwise, thefirst-hopnode creates an entry for this overheard packet inthat route, then insert a DSR header into the packet, as described in Section 6.1.2, and insert a DSR Sourceits Gratuitous Routeoption, as described in Section 6.1.3.Reply Table. Thesource route in the packet istimeout value for this new entry SHOULD be initializedfrom the selected routeto theDestination Address ofvalue GratReplyHoldoff. After this timeout has expired, thepacket.node SHOULD delete this entry from its Gratuitous Route Reply Table. -TransmitAfter creating thepacket tonew Gratuitous Route Reply Table entry above, thefirst-hopnodeaddress given in selected source route, usingoriginates a gratuitous RouteMaintenanceReply todeterminethereachabilityIP Source Address ofthe next hop,this overheard packet, as described in Section6.3. 6.1.2. Adding a DSR Header to a Packet A node originating a packet adds a DSR header to the packet, if necessary, to carry information needed by the routing protocol. A packet MUST NOT contain more than one DSR header. A DSR header is added to a packet by performing the following sequence of steps3.4.3. Johnson, et al Expires2124 August20022003 [Page41]63] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 (these steps assume that2003 If thepacket contains no other headers that MUST be locatedMAC protocol in use in thepacket before the DSR header): - Insertnetwork is not capable of transmitting unicast packets over unidirectional links, as discussed in Section 3.3.1, then in originating this Route Reply, the node MUST use aDSR header aftersource route for routing theIP header but before any other headerRoute Reply packet thatmay be present. - Set the Next Header field of the DSR header tois obtained by reversing theProtocol number fieldsequence of hops over which thepacket's IP header. - Setpacket triggering theProtocol fieldgratuitous Route Reply was routed in reaching and being overheard by this node; this reversing of thepacket's IP header toroute uses theProtocol number assigned for a DSR header (TBA???). 6.1.3. Adding a DSR Source Route Option to a Packet A node originating a packet adds a DSR Sourcegratuitous Routeoption to the packet, if necessary, in orderReply tocarrytest this sequence of hops for bidirectionality, preventing thesource routegratuitous Route Reply fromthis originating node tobeing received by thefinal destination addressinitiator of thepacket. Specifically,Route Discovery unless each of thenode addinghops over which theDSR Sourcegratuitous Routeoption constructsReply is returned is bidirectional. - Discard theDSR Source Route option and modifiesoverheard packet, since theIPpacketaccording to the following sequencehas been received before its normal traversal ofsteps: - The node creates a DSR Source Route option, as described in Section 5.7, and appendsthe packet's source route would have caused it to reach this receiving node. Another copy of theDSR header in the packet. (A DSR header is added,packet will normally arrive at this node asdescribedindicated inSection 6.1.2, if not already present.) - The numberthe packet's source route; discarding this initial copy ofAddress[i] fields to include intheDSR Sourcepacket, which triggered the gratuitous Routeoption (n) isReply, will prevent thenumberduplication ofintermediate nodes in the source route forthis packet that would otherwise occur. If the packet(i.e., excluding addressis not discarded as part of automatic route shortening above, then theoriginatingnodeandMUST process thefinal destination addressoption according to the following sequence of steps: - If the value of thepacket). TheSegments Left field in the DSR Source Route optionis initialized equal to n. - The addresses within the source route for the packet are copied into sequential Address[i] fields in the DSR Source Route option, for i = 1, 2, ..., n. - The First Hop External (F) bit inequals 0, then remove the DSR Source Route optionis copiedfrom theExternal bit flagging the first hop in the source route for the packet, as indicated in the Route Cache.DSR Options header. -The Last Hop External (L) bitElse, let n equal (Opt Data Len - 2) / 4. This is the number of addresses in the DSR Source Routeoption is copied from the External bit flagging the last hop in the source route foroption. - If thepacket, as indicated invalue of theRoute Cache. - The SalvageSegments Left fieldin the DSR Source Route optionisinitializedgreater than n, then send an ICMP Parameter Problem, Code 0, message [29] to0. Johnson, et al Expires 21 August 2002 [Page 42] INTERNET-DRAFT The Dynamicthe IP SourceRouting Protocol 21 February 2002 6.1.4. Processing a Received Packet When a node receives any packet (whether for forwarding, overheard, or asAddress, pointing to the Segments Left field, and discard the packet. Do not process the DSR Source Route option further. - Else, decrement thefinal destinationvalue of thepacket), if that packet contains a DSR header, then that node MUST process any options contained in that DSR header,Segments Left field by 1. Let i equal n minus Segments Left. This is the index of the next address to be visited in theorder contained there. Specifically:Address vector. - If Address[i] or theDSR header containsIP Destination Address is aRoute Request option, the node SHOULD extractmulticast address, then discard thesource route frompacket. Do not process the DSR Source RouteRequest and addoption further. - If the MTU of the link over which thisrouting informationnode would transmit the packet toits Route Cache, subjectforward it to theconditions identified in Section 3.3.1. The routing information from the Route Requestnode Address[i] is less than thesequencesize ofhop addresses initiator, Address[1], Address[2], ..., Address[n] where initiator isthevalue ofpacket, the node MUST either discard the packet and send an ICMP Packet Too Big message to the packet's Source Addressfield[29] or fragment it as specified inthe IP header ofSection 8.5. Johnson, et al Expires 24 August 2003 [Page 64] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 - Forward the packetcarryingto theRoute Request (theIP addressof the initiator of the Route Discovery), and each Address[i] is a node through which this Route Request has passed,specified inturn, during this Route Discovery. The value n here isthenumberAddress[i] field ofaddresses recorded intheRoute Request option, or (Opt Data Len - 6) / 4. After possibly updatingIP header, following normal IP forwarding procedures, including checking and decrementing thenode's Route CacheTime-to-Live (TTL) field inresponse totherouting information inpacket's IP header [30, 3]. In this forwarding of theRoute Request option,packet, the next-hop node (identified by Address[i]) MUSTthen process the Route Request optionbe treated asdescribed in Section 6.2.2. - If the DSR header containsaRoute Reply option,direct neighbor node: the transmission to that next nodeSHOULD extract the source route from theMUST be done in a single IP forwarding hop, without RouteReplyDiscovery andadd this routing information to its Route Cache, subject towithout searching theconditions identified in Section 3.3.1. The source route fromRoute Cache. - In forwarding the packet, perform RouteReply isMaintenance for thesequence ofnext hopaddresses initiator, Address[1], Address[2], ..., Address[n] where initiator is the valueof theDestination Address fieldpacket, by verifying that the next-hop node is reachable, as described in Section 8.3. Multicast addresses MUST NOT appear in a DSR Source Route option or in the IPheaderDestination Address field ofthea packet carryingthe Route Reply (the address of the initiator of thea DSR Source RouteDiscovery), and each Address[i] isoption in anode through which the source route passes,DSR Options header. 8.1.6. Handling an Unknown DSR Option Nodes implementing DSR MUST handle all options specified inturn, on the routethis document, except those options pertaining to thetargetoptional flow state extension (Section 7). However, further extensions to DSR may include other option types that may not be understood by implementations conforming to this version of theRoute Discovery. Address[n] isDSR specification. In DSR, Option Type codes encode required behavior for nodes not implementing that type of option. These behaviors are included in theaddressmost significant three bits of thetarget.Option Type. If theLast Hop External (L)most significant bit of the Option Type is set (that is, Option Type & 0x80 is nonzero), and this packet does not contain a Route Request option, a node SHOULD return a Route Error to the IP Source Address, following the steps described in Section 8.3.4, except that theRoute Reply,Error Type MUST be set to OPTION_NOT_SUPPORTED and thenodeUnsupported Opt field MUSTflagbe set to thelast hop fromOption Type triggering the RouteReply (the link from Address[n-1] to Address[n]) in itsError. Whether or not a RouteCache as External. The value n hereError isthe number of addressessent in response to this DSR option, as described above, thesource route being returned innode also MUST examine theRoute Reply option, or (Optnext two most significant bits (that is, Option Type & 0x60): - When these two bits are zero (that is, Option Type & 0x60 == 0), a node not implementing processing for that Option Type MUST use the Opt Data Len field to skip over the option and continue processing. -1) / 4. After possibly updatingWhen these two bits are 01 (that is, Option Type & 0x60 == 0x20), a node not implementing processing for that Option Type MUST use thenode's Route Cache in responseOpt Data Len field to remove the option from the packet and Johnson, et al Expires 24 August 2003 [Page 65] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 continue processing as if the option had not been included in the received packet. - When these two bits are 10 (that is, Option Type & 0x60 == 0x40), a node not implementing processing for that Option Type MUST set therouting informationmost significant bit following the Opt Data Len field; in addition, theRoute Reply option,node MUST thenifignore the contents of the option using the Opt Data Len field, and MUST continue processing the packet. - Finally, when these two bits are 11 (that is, Option Type & 0x60 == 0x60), a node not implementing processing for that Option Type MUST drop the packet. Johnson, et al Expires2124 August20022003 [Page43]66] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 packet's IP Destination Address matches one of this node's IP addresses,2003 8.2. Route Discovery Processing Route Discovery is the mechanism by which a nodeMUST then process theS wishing to send a packet to a destination node D obtains a source route to D. RouteReply optionDiscovery is used only when S attempts to send a packet to D and does not already know a route to D. The node initiating a Route Discovery is known asdescribed in Section 6.2.5. - IftheDSR header contains a"initiator" of the RouteError option,Discovery, and the destination nodeMUST processfor which the RouteError optionDiscovery is initiated is known asdescribed in Section 6.3.5. - IftheDSR header contains an Acknowledgment Request option,"target" of the Route Discovery. Route Discovery operates entirely on demand, with a nodeMUST process the Acknowledgment Request option as described in Section 6.3.3. - If the DSR header contains an Acknowledgment option, then subjectinitiating Route Discovery based on its own origination of new packets for some destination address tothe conditions identifiedwhich it does not currently know a route. Route Discovery does not depend on any periodic or background exchange of routing information or neighbor node detection at any layer inSection 3.3.1,thenode SHOULD add to itsnetwork protocol stack at any node. The RouteCache the single link from the node identified by the ACK Source Address fieldDiscovery procedure utilizes two types of messages, a Route Request (Section 6.2) and a Route Reply (Section 6.3), to actively search thenode identified by the ACK Destination Address field. After possibly updating the node's Route Cache in responsead hoc network for a route to therouting informationdesired destination. These DSR messages MAY be carried in any type of IP packet, through use of theAcknowledgment option, the node MUST then process the Acknowledgment optionDSR Options header as described in Section6.3.3. - If the DSR header contains6. Except as discussed in Section 8.3.5, aDSR SourceRouteoption, the nodeDiscovery for a destination address SHOULDextract the source route fromNOT be initiated unless theDSR Source Route and add this routing information toinitiating node has a packet in itsRoute Cache, subjectSend Buffer requiring delivery tothe conditions identified in Section 3.3.1. If the value of the Salvage field in the DSR Sourcethat destination. A Routeoption is zero, thenDiscovery for a given target node MUST NOT be initiated unless permitted by theroutingrate-limiting informationfromcontained in theDSR SourceRouteis the sequence of hop addresses source, Address[1], Address[2], ..., Address[n], destination and otherwise (Salvage is nonzero), the routing information from the DSR SourceRequest Table. After each RouteisDiscovery attempt, thesequenceinterval between successive Route Discoveries for this target SHOULD be doubled, up to a maximum ofhop addresses Address[1], Address[2], ..., Address[n], destination where sourceMaxRequestPeriod, until a valid Route Reply isthe value of the Source Address fieldreceived for this target. 8.2.1. Originating a Route Request A node initiating a Route Discovery for some target creates and initializes a Route Request option inthe IPa DSR Options headerofin some IP packet. This MAY be a separate IP packet, used only to carry this Route Request option, or thepacket carryingnode MAY include theDSR SourceRoute Request option(the original sender of the packet), each Address[i] is the value in the Address[i] fieldin some existing packet that it needs to send to theDSR Source Route, and destination istarget node (e.g., thevalue ofIP packet originated by this node, that caused theDestination Address field innode to attempt Route Discovery for thepacket's IP header (the last-hopdestination address of thesource route).packet). Thevalue n here is the number of addresses in source routeRoute Request option MUST be included inthea DSRSource Route option, or (Opt Data Len - 2) / 4. After possibly updating the node's Route CacheOptions header inresponse totherouting information inpacket. To initialize theDSR SourceRoute Request option, the nodeMUST then processperforms theDSR Source Route option as describedfollowing sequence of steps: - The Option Type inSection 6.1.5.the option MUST be set to the value 2. Johnson, et al Expires2124 August20022003 [Page44]67] INTERNET-DRAFT The Dynamic SourceRouting Protocol 21 February 2002 - Any Pad1 or PadN options in the DSR header are ignored. Finally, if the Destination Address in the packet's IP header matches one of this receiving node's own IP address(es), remove the DSR header and all the included DSR optionsRouting Protocol 24 February 2003 - The Opt Data Len field in theheader, and passoption MUST be set to therestvalue 6. The total size of thepacket to the network layer. 6.1.5. Processing a Received DSR Source Route Option When a node receives a packet containing a DSR SourceRoute Request option(whether for forwarding, overheard, or aswhen initiated is 8 octets; thefinal destinationOpt Data Len field excludes the size of thepacket), that node SHOULD examineOption Type and Opt Data Len fields themselves. - The Identification field in thepacketoption MUST be set todetermine if the receipt ofa new value, different from thatpacket indicates an opportunityused forautomatic route shortening, as described in Section 3.4.3. Specifically, ifother Route Requests recently initiated by this nodeis not the intended next-hop destinationfor this same target address. For example, each node MAY maintain a single counter value for generating a new Identification value for each Route Request it initiates. - The Target Address field in thepacket butoption MUST be set to the IP address that isnamed inthelater unexpended portiontarget ofthe source routethis Route Discovery. The Source Address in thepacket's DSR Source Route option, thenIP header of this packetindicates an opportunity for automatic route shortening:MUST be theintermediate nodes afternode's own IP address. The Destination Address in thenode from whichIP header of thisnode overheard thepacketand before thisMUST be the IP "limited broadcast" address (255.255.255.255). A nodeitself, are no longer necessaryMUST maintain in its Route Request Table, information about Route Requests that it initiates. When initiating a new Route Request, thesource route. In this case, thisnodeSHOULD performMUST use the information recorded in thefollowing sequence of steps as part of automatic route shortening: - The node searches its GratuitousRouteReplyRequest Tablefor anentrydescribing a gratuitous Route Reply earlier sent by this node,forwhichtheoriginal sendertarget ofthe packet triggering the gratuitousthat RouteReplyRequest, andthe transmitting node from which this node overheardit MUST update thatpacketinformation inorder to trigger the gratuitous Route Reply, both matchtherespective node addresses for this new received packet. If such antable entryis foundfor use in thenode's Gratuitousnext RouteReply Table, the node SHOULD NOT perform automatic route shortening in response to this receipt ofRequest initiated for thispacket.target. In particular: -Otherwise, the node creates anThe Route Request Table entry forthis overheard packeta target node records the Time-to-Live (TTL) field used inits Gratuitousthe IP header of the RouteReply Table. The timeout valueRequest forthis new entry SHOULD be initialized tothevalue GratReplyHoldoff. Afterlast Route Discovery initiated by thistimeout has expired,node for that target node. This value allows the nodeSHOULD delete this entry fromto implement a variety of algorithms for controlling the spread of itsGratuitousRouteReply Table. - After creatingRequest on each Route Discovery initiated for a target. As examples, two possible algorithms for this use of thenew GratuitousTTL field are described in Section 3.3.4. - The RouteReplyRequest Table entryabove, thefor a target nodeoriginatesrecords the number of consecutive Route Requests initiated for this target since receiving agratuitousvalid Route Reply giving a route to that target node, and theIP Source Address of this overheard packet, as described in Section 3.4.3. If the MAC protocol in use in the network is not capableremaining amount oftransmitting unicast packets over unidirectional links, as discussed in Section 3.3.1, then in originatingtime before which this node MAY next attempt at a RouteReply, theDiscovery for that target node. A node MUST use these values to implement asource routeback-off algorithm to limit the rate at which this node initiates new Route Discoveries forroutingthe same target address. In particular, until a valid Route Reply is received for this target node address, the timeout between consecutive Route Discovery initiations for this target node with the same hop limit SHOULD increase by doubling the timeout value on each new initiation. Johnson, et al Expires2124 August20022003 [Page45]68] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 packet that is obtained by reversing the sequence2003 The behavior ofhops over which thea node processing a packettriggering the gratuitouscontaining DSR Options header with both a DSR Source RouteReply was routed in reachingoption andbeing overhearda Route Request option is unspecified. Packets SHOULD NOT contain both a DSR Source Route option and a Route Request option. Packets containing a Route Request option SHOULD NOT include an Acknowledgement Request option, SHOULD NOT expect link-layer acknowledgement or passive acknowledgement, and SHOULD NOT be retransmitted. The retransmission of packets containing a Route Request option is controlled solely by the logic described in thisnode; this reversingsection. 8.2.2. Processing a Received Route Request Option When a node receives a packet containing a Route Request option, that node MUST process the option according to the following sequence of steps: - If theroute usesTarget Address field in thegratuitousRouteReply to testRequest matches thissequence of hops for bidirectionality, preventingnode's own IP address, then thegratuitousnode SHOULD return a Route Replyfrom being received byto the initiator ofthe Route Discovery unless each of the hops over which the gratuitousthis RouteReply is returned is bidirectional. - Discard the overheard packet, sinceRequest (the Source Address in thepacket has been received before its normal traversalIP header of thepacket'spacket), as described in Section 8.2.4. The source routewould have caused it to reachfor thisreceiving node. Another copy ofReply is thepacket will normally arrive at this node as indicated insequence of hop addresses initiator, Address[1], Address[2], ..., Address[n], target where initiator is thepacket's source route; discarding this initial copyaddress of thepacket, which triggeredinitiator of this Route Request, each Address[i] is an address from thegratuitousRouteReply, will preventRequest, and target is theduplicationtarget ofthis packet that would otherwise occur. IfthepacketRoute Request (the Target Address field in the Route Request). The value n here isnot discarded as partthe number ofautomatic route shortening above, thenaddresses recorded in the Route Request, or (Opt Data Len - 6) / 4. The node then MUSTprocessreplace theoption according toDestination Address field in thefollowing sequence of steps: - IfRoute Request packet's IP header with the valueofin theSegments LeftTarget Address field in theDSR SourceRoute Request option, and continue processing the rest of the Route Request packet normally. The node MUST NOT process the Route Request optionequals 0, then removefurther and MUST NOT retransmit theDSR SourceRouteoption fromRequest to propagate it to other nodes as part of theDSR header.Route Discovery. - Else,let n equal (Opt Data Len - 2) / 4. This isthenumber of addressesnode MUST examine the route recorded in theDSR SourceRouteoption. - IfRequest option (the IP Source Address field and thevaluesequence ofthe Segments Left field is greater than n, then send an ICMP Parameter Problem, Code 0, message [26]Address[i] fields) tothedetermine if this node's own IPSource Address, pointing toaddress already appears in this list of addresses. If so, theSegments Left field, andnode MUST discard thepacket. Do not processentire packet carrying theDSR SourceRouteoption further.Request option. - Else,decrementif thevalue ofRoute Request was received through a network interface that requires physically bidirectional links for Johnson, et al Expires 24 August 2003 [Page 69] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 unicast transmission, theSegments Left fieldnode MUST check if the Request was last forwarded by1. Let i equal n minus Segments Left. Thisa node on its blacklist. If such an entry is found, and theindexstate of thenext address to be visited inunidirectional link is "probable", then theAddress vector.Request MUST be silently discarded. -If Address[i] orElse, if theIP Destination Address isRoute Request was received through amulticast address, then discardnetwork interface that requires physically bidirectional links for unicast transmission, thepacket. Do not processnode MUST check if theDSR Source Route option further. -Request was last forwarded by a node on its blacklist. If such an entry is found, and theMTUstate of the unidirectional linkover which this node would transmitis "questionable", then the node MUST create and unicast a Route Request packet toforward itthat previous node, setting the IP Time-To-Live (TTL) to 1 to prevent the Request from being propagated. If the nodeAddress[i] is less thanreceives a Route Reply in response to thesize ofnew Request, it MUST remove thepacket,blacklist entry for that node, and SHOULD continue processing. If the node does not receive a Route Reply within some reasonable amount of time, MUSTeithersilently discard thepacket and sendRoute Request packet. - Else, the node MUST search its Route Request Table for anICMP Packet Too Big message toentry for thepacket'sinitiator of this Route Request (the IP Source Address[26] or fragment it as specifiedfield). If such an entry is found inSection 8. - Forwardthepacket totable, theIP address specified innode MUST search theAddress[i] fieldcache of Identification values of recently received Route Requests in that table entry, to determine if an entry is present in theIP header, following normal IP forwarding procedures, including checking and decrementingcache matching theTime-to-Live Johnson, et al Expires 21 August 2002 [Page 46] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 (TTL) fieldIdentification value and target node address inthe packet's IP header [27, 3]. Inthisforwarding of the packet,Route Request. If such an (Identification, target address) entry is found in this cache in this entry in thenext-hop node (identified by Address[i]) MUST be treated as a direct neighbor node:Route Request Table, then thetransmission to that nextnode MUSTbe done in a single IP forwarding hop, without Route Discovery and without searchingdiscard the entire packet carrying the RouteCache.Request option. -In forwardingElse, this node SHOULD further process thepacket, performRouteMaintenanceRequest according to the following sequence of steps: o Add an entry for this Route Request in its cache of (Identification, target address) values of recently received Route Requests. o Conceptually create a copy of this entire packet and perform thenext hopfollowing steps on the copy of thepacket, by verifying thatpacket. o Append this node's own IP address to thenext-hop node is reachable, as described in Section 6.3. Multicast addresses MUST NOT appearlist of Address[i] values ina DSR Sourcethe Routeoption orRequest, and increase the value of the Opt Data Len field in the Route Request by 4 (the size of an IPDestination Address fieldaddress). o This node SHOULD search its own Route Cache for a route (from itself, as if it were the source of apacket carryingpacket) to the target of this Route Request. If such aDSR Sourceroute is found in its RouteoptionCache, then this node SHOULD follow the procedure outlined in Section 8.2.3 to return aDSR header."cached Route Reply" Johnson, et al Expires2124 August20022003 [Page47] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 6.2. Route Discovery Processing Route Discovery is the mechanism by which a node S wishing to send a packet to a destination node D obtains a source route to D. Route Discovery is used only when S attempts to send a packet70] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 toD andthe initiator of this Route Request, if permitted by the restrictions specified there. o If the node does notalready knowreturn aroute to D. Thecached Route Reply, then this nodeinitiatingSHOULD link-layer re-broadcast this copy of the packet, with aRoute Discoveryshort jitter delay before the broadcast isknownsent. The jitter period SHOULD be chosen asthe "initiator" of the Route Discovery,a random period, uniformly distributed between 0 and BroadcastJitter. 8.2.3. Generating a Route Reply using thedestination nodeRoute Cache As described in Section 3.3.2, it is possible forwhicha node processing a received Route Request to avoid propagating the RouteDiscovery is initiated is known asRequest further toward the"target"target of the Request, if this node has in its RouteDiscovery.Cache a route from itself to this target. Such a RouteDiscovery operates entirely on demand, withReply generated by a nodeinitiating Route Discovery based onfrom its ownorigination of new packets for some destination addresscached route towhich it does not currently know a route. Route Discovery does not depend on any periodic or background exchange of routing information or neighbor node detection at any layer inthenetwork protocol stack at any node. The Route Discovery procedure utilizes two typestarget ofmessages,a Route Request(Section 5.2) andis called a "cached RouteReply (Section 5.3), to actively searchReply", and this mechanism can greatly reduce the overall overhead of Route Discovery on thead hocnetworkfor a route toby reducing thedesired destination. These DSR messages MAY be carried in any typeflood ofIP packet, through useRoute Requests. The general processing ofthe DSR header asa received Route Request is described in Section5. Except as discussed in Section 6.3.5,8.2.2; this section specifies the additional requirements that MUST be met before a cached RouteDiscovery for a destination address SHOULD NOTReply may beinitiated unlessgenerated and returned and specifies theinitiating node hasprocedure for returning such apacket in its Send Buffer requiring delivery to that destination. Acached RouteDiscoveryReply. While processing a received Route Request, for agiven targetnode to possibly return a cached Route Reply, it MUSTNOT be initiated unless permitted by the rate-limiting information containedhave inthe Route Request Table. After eachits RouteDiscovery attempt,Cache a route from itself to theinterval between successive Route Discoveries for thistargetSHOULD be doubled, up to a maximumofMaxRequestPeriod, untilthis Route Request. However, before generating avalidcached Route Replyis receivedfor thistarget. 6.2.1. Originating aRouteRequest ARequest, the nodeinitiating a Route Discovery for some target creates and initializes a Route Request optionMUST verify that there are no duplicate addresses listed ina DSR headerthe route accumulated insome IP packet. This MAYthe Route Request together with the route from this node's Route Cache. Specifically, there MUST bea separateno duplicates among the following addresses: - The IPpacket, used only to carrySource Address of the packet containing the Route Request, - The Address[i] fields in the Route Request, and - The nodes listed in the route obtained from this node's Route Cache, excluding the address of this node itself (this node itself is the common point between the route accumulated in the Route Requestoption, orand thenode MAY includeroute obtained from the RouteRequest option in some existing packet that it needs to send toCache). If any duplicates exist among these addresses, then thetargetnode(e.g., the IP packet originated by this node, that caused theMUST NOT send a cached Route Reply. The node SHOULD continue toattempt Route Discovery for the destination address ofprocess thepacket). TheRoute Requestoption MUST be included in a DSR headeras described inthe packet. To initializeSection 8.2.2. If the Route Requestoption,and thenode performsroute from thefollowing sequence of steps: - The Option Type inRoute Cache meet theoption MUST be set torestriction above, then thevalue 2.node SHOULD construct and return a cached Route Reply as follows: Johnson, et al Expires2124 August20022003 [Page48]71] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 - TheOpt Data Len field in the option MUST be set tosource route for this reply is thevalue 6. The total sizesequence ofthe Route Request option when initiatedhop addresses initiator, Address[1], Address[2], ..., Address[n], c-route where initiator is8 octets; the Opt Data Len field excludesthesizeaddress of theOption Type and Opt Data Len fields themselves. - The Identification field in the option MUST be set to a new value, different from that used for other Route Requests recently initiated by this node forinitiator of thissame target address. For example, each node MAY maintain a single counter value for generating a new Identification value for eachRouteRequest it initiates. - The Target Address field in the option MUST be set to the IPRequest, each Address[i] is an addressthatfrom the Route Request, and c-route is thetargetsequence of hop addresses in the source route to this target node, obtained from the node's RouteDiscovery. The Source Address inCache. In appending this cached route to theIP headersource route for the reply, the address of thispacketnode itself MUST be excluded, since it is already listed as Address[n]. - Send a Route Reply to thenode's own IP address.initiator of the Route Request, using the procedure defined in Section 8.2.4. TheDestinationinitiator of the Route Request is indicated in the Source Address field in the packet's IPheader of this packet MUST beheader. If the node returns a cached Route Reply as described above, then theIP "limited broadcast" address (255.255.255.255). Anode MUSTmaintain in itsNOT propagate the Route RequestTable, information about Route Requests that it initiates. When initiating a new Route Request,further (i.e., the node MUSTuseNOT rebroadcast theinformation recorded inRoute Request). In this case, instead, if the packet contains no other DSR options and contains no payload after the DSR Options header (e.g., the Route RequestTable entry foris not piggybacked on a TCP or UDP packet), then the node SHOULD simply discard the packet. Otherwise (if the packet contains other DSR options or contains any payload after the DSR Options header), the node SHOULD forward the packet along the cached route to the target ofthatthe RouteRequest, andRequest. Specifically, if the node does so, it MUSTupdate that information in the table entry foruseinthenext Route Request initiated for this target. In particular:following steps: -TheCopy the Target Address from the Route RequestTable entry for a target node recordsoption in theTime-to-Live (TTL)DSR Options header to the Destination Address fieldusedin the packet's IPheader ofheader. - Remove the Route Requestforoption from thelastDSR Options header in the packet, and add a DSR Source RouteDiscovery initiated by this node for that target node. This value allowsoption to thenodepacket's DSR Options header. - In the DSR Source Route option, set the Address[i] fields toimplement a variety of algorithms for controllingrepresent thespread of itssource route found in this node's RouteRequest on eachCache to the original target of the Route Discoveryinitiated for a target. As examples, two possible algorithms for this use(the new IP Destination Address of theTTL field are described in Section 3.3.4. - The Route Request Table entry for a targetpacket). Specifically, the noderecordscopies thenumberhop addresses ofconsecutivethe source route into sequential Address[i] fields in the DSR Source RouteRequests initiatedoption, forthis target since receiving a valid Route Reply giving a route to that target node, andi = 1, 2, ..., n. Address[1] here is theremaining amountaddress oftime before whichthis nodeMAY next attempt at a Route Discovery for that target node. A node MUST use these values to implement a back-off algorithm to limititself (the first address in therate at whichsource route found from this nodeinitiates new Route Discoveries forto thesameoriginal targetaddress. In particular, until a validof the RouteReplyDiscovery). The value n here isreceived for this target node address,thetimeout between consecutive Route Discovery initiations fornumber of hop addresses in thistarget node withsource route, excluding thesame hop limit SHOULD increase by doublingdestination of thetimeout value on each new initiation.packet (which is instead already represented in the Destination Address field in the packet's IP header). Johnson, et al Expires2124 August20022003 [Page49]72] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 The behavior of a node processing a packet containing DSR header with both a2003 - Initialize the Segments Left field in the DSR Source Route optionand a Route Request option is unspecified. Packets SHOULD NOT contain both ato n as defined above. - The First Hop External (F) bit in the DSR Source Route optionand a Route Request option. Packets containing ais copied from the External bit flagging the first hop in the source route for the packet, as indicated in the RouteRequest option SHOULD NOT include an Acknowledgment Request option, SHOULD NOT expect link-layer acknowledgment or passive acknowledgment, and SHOULD NOT be retransmitted.Cache. - Theretransmission of packets containing aLast Hop External (L) bit in the DSR Source RouteRequestoption iscontrolled solely bycopied from thelogic describedExternal bit flagging the last hop inthis section. 6.2.2. Processing a Received Route Request Option When a node receives a packet containing a Route Request option, that node MUST processtheoption according tosource route for thefollowing sequence of steps: - Ifpacket, as indicated in theTarget AddressRoute Cache. - The Salvage field in the DSR Source RouteRequest matches this node's own IP address, thenoption MUST be initialized to some nonzero value; thenodeparticular nonzero value used SHOULDreturnbe MAX_SALVAGE_COUNT. By initializing this field to a nonzero value, nodes forwarding or overhearing this packet will not consider aRoute Replylink to exist between theinitiator of this Route Request (theIP Source Addressin the IP headerof thepacket), as described in Section 6.2.4. The source route for this Reply is the sequence of hop addresses initiator, Address[1], Address[2], ..., Address[n], target where initiator ispacket and the Address[1] addressofin theinitiator ofDSR Source Route option (e.g., they will not attempt to add this to their RouteRequest, each Address[i] is an address fromCache as a link). By choosing MAX_SALVAGE_COUNT as theRoute Request, and target isnonzero value to which thetarget ofnode initializes this field, nodes furthermore will not attempt to salvage this packet. - Transmit theRoute Request (the Target Address field inpacket to theRoute Request). The value n here isnext-hop node on thenumber of addresses recordednew source route in the packet, using the forwarding procedure described in Section 8.1.5. 8.2.4. Originating a RouteRequest, or (Opt Data Len - 6) / 4. TheReply A nodethen MUST replace the Destination Address fieldoriginates a Route Reply intheorder to reply to a received and processed RouteRequest packet's IP header withRequest, according to thevalueprocedures described inthe Target Address fieldSections 8.2.2 and 8.2.3. The Route Reply is returned inthea RouteRequest option, and continue processingReply option (Section 6.3). The Route Reply option MAY be returned to therestinitiator of the Route Request in a separate IP packet, used only to carry this Route Reply option, or it MAY be included in any other IP packetnormally.being sent to this address. Thenode MUST NOT process theRouteRequestReply optionfurther andMUSTNOT retransmitbe included in a DSR Options header in theRoute Request to propagate itpacket returned toother nodes as part ofthe initiator. To initialize the RouteDiscovery. - Else,Reply option, the nodeMUST examineperforms theroute recordedfollowing sequence of steps: - The Option Type in theRoute Requestoption(the IP Source Address field and the sequence of Address[i] fields)MUST be set todetermine if this node's own IP address already appearsthe value 3. - The Opt Data Len field inthis list of addresses. If so,thenodeoption MUSTdiscardbe set to theentire packet carryingvalue (n * 4) + 3, where n is the number of addresses in the source route being returned (excluding the RouteRequest option.Discovery initiator node's address). -Else, ifThe Last Hop External (L) bit in theRoute Request through a network interface that requires physically bidirectional links for unicast transmission,option MUST be initialized to 0. Johnson, et al Expires2124 August20022003 [Page50]73] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 - The Reserved field in thenodeoption MUSTcheck ifbe initialized to 0. - The Route Request Identifier MUST be initialized to the Identifier field of the Route Requestwas last forwarded by a node on its blacklist. If such an entrythat this reply isfound, andsent in response to. - The sequence of hop addresses in thestatesource route are copied into the Address[i] fields of theunidirectional link is "probable," thenoption. Address[1] MUST be set to theRequestfirst-hop address of the route after the initiator of the Route Discovery, Address[n] MUST be set to the last-hop address of the source route (the address of the target node), and each other Address[i] MUST besilently discarded. - Else, if the Route Request through a network interface that requires physically bidirectional links for unicast transmission,set to thenode MUST check ifnext address in sequence in theRequest was last forwarded by a node on its blacklist. If such an entry is found, andsource route being returned. The Destination Address field in thestateIP header of theunidirectional link is "questionable," thenpacket carrying thenode MUST create and unicast aRouteRequest packetReply option MUST be set tothat previous node, settingtheIP Time-To-Live (TTL) to 1 to preventaddress of theRequest from being propagated. Ifinitiator of thenode receivesRoute Discovery (i.e., for a Route Reply being returned in response tothe newsome Route Request,it MUST removetheblacklist entry for that node,IP Source Address of the Route Request). After creating andSHOULD continue processing. Ifinitializing thenode does not receive aRoute Replywithin some reasonable amount of time, MUST silently discardoption and the IP packet containing it, send the RouteRequest packet. - Else,Reply. In sending thenode MUST search itsRouteRequest Table for an entry forReply from this node (but not from nodes forwarding theinitiator ofRoute Reply), this node SHOULD delay the Reply by a small jitter period chosen randomly between 0 and BroadcastJitter. When returning any RouteRequest (the IP Source Address field). If such an entry is foundReply in thetable,case in which thenodeMAC protocol in use in the network is not capable of transmitting unicast packets over unidirectional links, the source route used for routing the Route Reply packet MUSTsearchbe obtained by reversing thecache of Identification valuessequence ofrecently received Route Requestshops in the Route Request packet (the source route thattable entry, to determine if an entryispresentthen returned in thecache matchingRoute Reply). This restriction on returning a Route Reply enables theIdentification value and target node address in thisRouteRequest. If such an (Identification, target address) entry is found in this cache inReply to test thisentry insequence of hops for bidirectionality, preventing the RouteRequest Table, thenReply from being received by thenode MUST discardinitiator of theentire packet carryingRoute Discovery unless each of the hops over which the RouteRequest option. - Else, this node SHOULD further processReply is returned (and thus each of the hops in the source route being returned in the Reply) is bidirectional. If sending a RouteRequest accordingReply to thefollowing sequenceinitiator ofsteps: o Add an entry for thisthe Route Requestin its cache of (Identification, target address) values of recently received Route Requests. o Conceptually createrequires performing acopy of this entire packet and performRoute Discovery, thefollowing stepsRoute Reply option MUST be piggybacked on thecopy ofpacket that contains thepacket. o Append this node's own IP address toRoute Request. This piggybacking prevents a loop wherein thelisttarget ofAddress[i] values inthe new RouteRequest, and increaseRequest (which was itself thevalueinitiator of theOpt Data Len field in theoriginal Route Request) must do another Route Requestby 4 (the size of an IP address). o This node SHOULD searchin order to return itsown Route Cache for a route (from itself, as if it wereRoute Reply. If sending thesource of a packet)Route Reply to thetargetinitiator ofthisthe RouteRequest. If suchRequest does not require performing aroute is found in itsRouteCache, then thisDiscovery, a node SHOULDfollow the procedure outlinedsend a unicast Route Reply inSection 6.2.3response toreturn a "cachedevery RouteReply"Request it receives for which it is the target node. Johnson, et al Expires2124 August20022003 [Page51]74] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 to2003 8.2.5. Processing a Received Route Reply Option Section 8.1.4 describes theinitiatorgeneral processing for a received packet, including the addition ofthis Route Request, if permitted byrouting information from options in therestrictions specified there. opacket's DSR Options header to the receiving node's Route Cache. If thenode does not returnreceived packet contains acachedRoute Reply,then this node SHOULD link-layer re-broadcast this copyno additional special processing of thepacket, with a short jitter delay before the broadcast is sent. The jitter period SHOULD be chosen as a random period, uniformly distributed between 0 and BroadcastJitter. 6.2.3. Generating aRoute Replyusing the Route Cacheoption is required beyond what is described there. As described in Section3.3.2, it is possible for4.1 anytime a nodeprocessing a received Route Requestadds new information toavoid propagating the Route Request further toward the target of the Request, if this node has inits Route Cachea route(including the information added fromitself tothistarget. Such aRoute Replygenerated by aoption), the nodefromSHOULD check each packet in its owncached routeSend Buffer (Section 4.2) tothe target of a Route Request is calleddetermine whether a"cached Route Reply", and this mechanism can greatly reduceroute to that packet's IP Destination Address now exists in theoverall overhead ofnode's RouteDiscovery onCache (including thenetwork by reducinginformation just added to theflood of Route Requests. The general processing of a received Route Request is described in Section 6.2.2; this section specifiesCache). If so, theadditional requirements that MUST be met before a cached Route Reply maypacket SHOULD then begenerated and returnedsent using that route andspecifiesremoved from the Send Buffer. This general procedurefor returning such a cached Route Reply. Whilehandles all processing required for a received RouteRequest, for a node to possibly returnReply option. When acached Route Reply, it MUST have in its Route CacheMAC protocol requires bidirectional links for unicast transmission, aroute from itself tounidirectional link may be discovered by thetargetpropagation ofthisthe Route Request.However, before generating a cachedWhen the Route Replyforis sent over the reverse path, a forwarding node may discover that the next-hop is unreachable. In this case, it MUST add the next-hop address to its blacklist. Johnson, et al Expires 24 August 2003 [Page 75] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 8.3. RouteRequest,Maintenance Processing Route Maintenance is the mechanism by which a source nodeMUST verifyS is able to detect, while using a source route to some destination node D, if the network topology has changed such thatthere areit can noduplicate addresses listed in thelonger use its routeaccumulated into D because a link along the route no longer works. When Route Maintenance indicates that a source route is broken, S can attempt to use any other route it happens to know to D, or can invoke RouteRequest together with theDiscovery again to find a new routefrom this node'sfor subsequent packets to D. RouteCache.Maintenance for this route is used only when S is actually sending packets to D. Specifically,therewhen forwarding a packet, a node MUSTbe no duplicates amongattempt to confirm thefollowing addresses: - The IP Source Addressreachability of thepacket containing the Route Request, - The Address[i] fields in the Route Request, and - The nodes listednext-hop node, unless such confirmation had been received in theroute obtained from this node's Route Cache, excluding the addresslast MaintHoldoffTime. Individual implementations MAY choose to bypass such confirmation for some limited number ofthis node itself (this node itselfpackets, as long as those packets all fall within MaintHoldoffTime within the last confirmation. If no confirmation is received after thecommon point betweenretransmission of MaxMaintRexmt acknowledgement requests, after theroute accumulated ininitial transmission of theRoute Requestpacket, and conceptually including all retransmissions provided by theroute obtained from the Route Cache). If any duplicates exist among these addresses, thenMAC layer, the nodeMUST NOT send a cached Route Reply. The node SHOULD continue to process the Route Request as described in Section 6.2.2. Ifdetermines that theRoute Request andlink for this next-hop node of the source route is "broken". This confirmation from the next-hop node for RouteCache meetMaintenance can be implemented using a link-layer acknowledgement (Section 8.3.1), using a "passive acknowledgement" (Section 8.3.2), or using a network-layer acknowledgement (Section 8.3.3); therestriction above, thenparticular strategy for retransmission timing depends on the type of acknowledgement mechanism used. When passive acknowledgements are being used, each retransmitted acknowledgement request SHOULD be explicit software acknowledgement requests. If no acknowledgement is received after MaxMaintRexmt retransmissions (if necessary), the node SHOULDconstruct and returnoriginate acachedRouteReply as follows: Johnson, et al Expires 21 August 2002 [Page 52] INTERNET-DRAFT The Dynamic Source Routing Protocol 21 February 2002 - The source route for this reply is the sequence of hop addresses initiator, Address[1], Address[2], ..., Address[n], c-route where initiator isError to theaddressoriginal sender of theinitiator of thispacket, as described in Section 8.3.4. In deciding whether or not to send a RouteRequest, each Address[i] is an addressError in response to attempting to forward a packet from some sender over a broken link, a node MUST limit theRoute Request, and c-route is the sequencenumber ofhop addresses inconsecutive packets from a single sender that thesource routenode attempts to forward over thistarget node, obtained fromsame broken link for which thenode'snode chooses not to return a RouteCache. In appendingError; thiscached route to the source routerequirement MAY be satisfied by returning a Route Error for each packet that thereply, the address of thisnodeitself MUST be excluded, since it is already listed as Address[n]. - Sendattempts to forward over aRoute Replybroken link. 8.3.1. Using Link-Layer Acknowledgements If the MAC protocol in use provides feedback as to theinitiatorsuccessful delivery of a data packet (such as is provided by theRoute Request, using the procedurelink-layer acknowledgement frame definedin Section 6.2.4. The initiatorby IEEE 802.11 [13]), then the use of theRouteDSR Acknowledgement Requestis indicated in the Source Address field in the packet's IP header.and Acknowledgement options Johnson, et al Expires 24 August 2003 [Page 76] INTERNET-DRAFT The Dynamic Source Routing Protocol 24 February 2003 is not necessary. Ifthe node returns a cachedsuch link-layer feedback is available, it SHOULD be used instead of any other acknowledgement mechanism for RouteReply as described above, thenMaintenance, and the nodeMUSTSHOULD NOTpropagate theuse either passive acknowledgements or network-layer acknowledgements for RouteRequest further (i.e., the node MUST NOT rebroadcast theMaintenance. When using link-layer acknowledgements for RouteRequest). In this case, instead, ifMaintenance, thepacket contains no other DSR optionsretransmission timing andcontains no payload aftertheDSR header (e.g.,timing at which retransmission attempts are scheduled are generally controlled by theRoute Request is not piggybacked on a TCP or UDP packet), thenparticular link layer implementation in use in thenode SHOULD simply discardnetwork. For example, in IEEE 802.11, thepacket. Otherwise (iflink-layer acknowledgement is returned after the data packetcontains other DSR options or contains any payload afteras a part of theDSR header),basic access method of of thenode SHOULD forwardIEEE 802.11 Distributed Coordination Function (DCF) MAC protocol; thepacket alongtime at which thecached routeacknowledgement is expected to arrive and thetarget oftime at which theRoute Request. Specifically, ifnext retransmission attempt (if necessary) will occur are controlled by the MAC protocol implementation. When a nodedoes so, it MUST use the following steps: - Copyreceives a link-layer acknowledgement for any packet in its Maintenance Buffer, that node SHOULD remove that packet, as well as any other packets in its Maintenance Buffer with theTarget Addresssame next-hop destination, fromtheits Maintenance Buffer. 8.3.2. Using Passive Acknowledgements When link-layer acknowledgements are not available, but passive acknowledgements [18] are available, passive acknowledgements SHOULD be used for RouteRequest option inMaintenance when originating or forwarding a packet along any hop other than theDSR headerlast hop (the hop leading to the IP Destination Addressfield in the packet's IP header. - Removenode of the packet). In particular, passive acknowledgements SHOULD be used for RouteRequest option from the DSR headerMaintenance in such cases if thepacket,node can place its network interface into "promiscuous" receive mode, andadd a DSR Source Route option to the packet's DSR header. - In the DSR Source Route option, set the Address[i] fieldsnetwork links used for data packets generally operate bidirectionally. A node MUST NOT attempt torepresent the source route found in this node'suse passive acknowledgements for RouteCacheMaintenance for a packet originated or forwarded over its last hop (the hop leading to theoriginal target of the Route Discovery (the newIP Destination Addressof the packet). Specifically, thenodecopies the hop addressesof thesource route into sequential Address[i] fields in the DSR Source Route option, for i = 1, 2, ..., n. Address[1] here ispacket), since theaddress of thisreceiving nodeitself (the first address inwill not be forwarding thesource route found frompacket and thus no passive acknowledgement will be available to be heard by this node. Beyond this restriction, a nodeto the original targetMAY utilize a variety ofthestrategies in using passive acknowledgements for RouteDiscovery). The value n here is the numberMaintenance ofhop addresses in this source route, excludinga packet that it originates or forwards. For example, the following two strategies are possible: - Each time a node receives a packet to be forwarded to a node other than the final destination (the IP Destination Address of the packet), that node sends the original transmission of that packet(whichwithout requesting a network-layer acknowledgement for it. If no passive acknowledgement isinstead already represented in the Destination Address field in the packet's IP header).received within Johnson, et al Expires2124 August20022003 [Page53]77] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February2002 - Initialize the Segments Left field in the DSR Source Route option to n as defined above. - The First Hop External (F) bit in the DSR Source Route option is copied from the External bit flagging the first hop in2003 PassiveAckTimeout after this transmission, thesource route fornode retransmits the packet,as indicated in the Route Cache. - The Last Hop External (L) bit inagain without requesting a network-layer acknowledgement for it; theDSR Source Route optionsame PassiveAckTimeout timeout value iscopied from the External bit flagging the last hop in the source routeused for each such attempt. If no acknowledgement has been received after a total of TryPassiveAcks retransmissions of the packet,as indicatednetwork-layer acknowledgements (as described inthe Route Cache.Section 8.3.3) are used for all remaining attempts for that packet. -The Salvage field in the DSR Source Route option MUSTEach node maintains a table of possible next-hop destination nodes, noting whether or not passive acknowledgements can typically beinitializedexpected from transmission tosome nonzero value;that node, and theparticular nonzero value used SHOULD be MAX_SALVAGE_COUNT. By initializing this field toexpected latency and jitter of anonzero value, nodes forwarding or overhearing this packet will not considerpassive acknowledgement from that node. Each time a node receives alink to exist between the IP Source Address of thepacketand the Address[1] address in the DSR Source Route option (e.g., they will not attempttoadd thisbe forwarded totheir Route Cache asalink). By choosing MAX_SALVAGE_COUNT asnode other than thenonzero value to whichIP Destination Address, the nodeinitializes this field,checks its table of next-hop destination nodesfurthermore will not attempttosalvagedetermine whether to use a passive acknowledgement or a network-layer acknowledgement for that transmission to that node. The timeout for thispacket. - Transmit thepacketto the next-hopcan also be derived from this table. A nodeon the new source route in the packet,usingthe forwarding procedure described in Section 6.1.5. 6.2.4. Originatingthis method SHOULD prefer using passive acknowledgements to network-layer acknowledgements. In using passive acknowledgements for aRoute Reply A nodepacket that it originates or forwards, aRoute Reply in order to reply tonode considers the later receipt of areceived and processed Route Request, accordingnew packet (e.g., with promiscuous receive mode enabled on its network interface) to be an acknowledgement of this first packet if both of theprocedures described in Sections 6.2.2 and 6.2.3.following two tests succeed: - TheRoute Reply is returnedSource Address, Destination Address, Protocol, Identification, and Fragment Offset fields ina Route Reply option (Section 5.3). The Route Reply option MAY be returned totheinitiatorIP header of theRoute Request in a separate IP packet, used only to carry this Route Reply option, or it MAY be included in any other IP packet being sent to this address. The Route Reply optiontwo packets MUSTbe included inmatch [30], and - If either packet contains a DSRheader inSource Route header, both packets MUST contain one, and thepacket returned tovalue in theinitiator. To initializeSegments Left field in the DSR Source RouteReply option, the node performs the following sequenceheader ofsteps: - The Option Type intheoptionnew packet MUST beset toless than that in thevalue 3. - The Opt Data Len fieldfirst packet. When a node hears such a passive acknowledgement for any packet in its Maintenance Buffer, that node SHOULD remove that packet, as well as any other packets in its Maintenance Buffer with theoption MUST be setsame next-hop destination, from its Maintenance Buffer. 8.3.3. Using Network-Layer Acknowledgements When a node originates or forwards a packet and has no other mechanism of acknowledgement available tothe value (n * 4) + 3, where n is the numberdetermine reachability ofaddressesthe next-hop node in the source routebeing returned (excluding thefor RouteDiscovery initiator node's address). - The Last Hop External (L) bit inMaintenance, that node SHOULD request a network-layer acknowledgement from that next-hop node. To do so, theoption MUST be initialized to 0.node inserts an Acknowledgement Request Johnson, et al Expires2124 August20022003 [Page54]78] INTERNET-DRAFT The Dynamic Source Routing Protocol2124 February20022003 option in the DSR Options header in the packet. The Identification field in that Acknowledgement Request option MUST be set to a value unique over all packets transmitted by this node to the same next-hop node that are either unacknowledged or recently ack