idnits 2.17.1 draft-ietf-manet-dsr-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. '1' -- Possible downref: Non-RFC (?) normative reference: ref. '2' -- Possible downref: Non-RFC (?) normative reference: ref. '5' -- Possible downref: Non-RFC (?) normative reference: ref. '6' ** Obsolete normative reference: RFC 2460 (ref. '7') (Obsoleted by RFC 8200) -- Possible downref: Non-RFC (?) normative reference: ref. '9' -- Possible downref: Non-RFC (?) normative reference: ref. '10' -- Possible downref: Non-RFC (?) normative reference: ref. '11' -- Possible downref: Non-RFC (?) normative reference: ref. '12' -- Possible downref: Non-RFC (?) normative reference: ref. '13' -- Possible downref: Non-RFC (?) normative reference: ref. '14' -- Possible downref: Non-RFC (?) normative reference: ref. '15' -- Possible downref: Non-RFC (?) normative reference: ref. '16' -- Possible downref: Non-RFC (?) normative reference: ref. '17' -- Possible downref: Non-RFC (?) normative reference: ref. '18' -- Possible downref: Non-RFC (?) normative reference: ref. '19' -- Possible downref: Non-RFC (?) normative reference: ref. '20' -- Possible downref: Non-RFC (?) normative reference: ref. '21' -- Possible downref: Non-RFC (?) normative reference: ref. '22' -- Possible downref: Non-RFC (?) normative reference: ref. '23' -- Possible downref: Non-RFC (?) normative reference: ref. '24' ** Obsolete normative reference: RFC 2434 (ref. '25') (Obsoleted by RFC 5226) -- Possible downref: Non-RFC (?) normative reference: ref. '26' -- Possible downref: Non-RFC (?) normative reference: ref. '27' -- Possible downref: Non-RFC (?) normative reference: ref. '29' ** Obsolete normative reference: RFC 793 (ref. '33') (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 1700 (ref. '34') (Obsoleted by RFC 3232) -- Possible downref: Non-RFC (?) normative reference: ref. '35' -- Possible downref: Non-RFC (?) normative reference: ref. '36' -- Possible downref: Non-RFC (?) normative reference: ref. '37' -- Possible downref: Non-RFC (?) normative reference: ref. '38' Summary: 6 errors (**), 0 flaws (~~), 3 warnings (==), 29 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 IETF MANET Working Group David B. Johnson, Rice University 2 INTERNET-DRAFT David A. Maltz, Carnegie Mellon University 3 19 July 2004 Yih-Chun Hu, Rice University 5 The Dynamic Source Routing Protocol 6 for Mobile Ad Hoc Networks (DSR) 8 10 Status of This Memo 12 This document is an Internet-Draft and is subject to all provisions 13 of Section 10 of RFC 2026. 15 Internet-Drafts are working documents of the Internet Engineering 16 Task Force (IETF), its areas, and its working groups. Note 17 that other groups may also distribute working documents as 18 Internet-Drafts. 20 Internet-Drafts are draft documents valid for a maximum of six months 21 and may be updated, replaced, or obsoleted by other documents at 22 any time. It is inappropriate to use Internet-Drafts as reference 23 material or to cite them other than as "work in progress". 25 The list of current Internet-Drafts can be accessed at 26 http://www.ietf.org/ietf/1id-abstracts.txt 28 The list of Internet-Draft Shadow Directories can be accessed at 29 http://www.ietf.org/shadow.html. 31 This Internet-Draft is a submission to the IETF Mobile Ad Hoc 32 Networks (MANET) Working Group. Comments on this draft may be sent 33 to the Working Group at manet@itd.nrl.navy.mil, or may be sent 34 directly to the authors. 36 Abstract 38 The Dynamic Source Routing protocol (DSR) is a simple and efficient 39 routing protocol designed specifically for use in multi-hop wireless 40 ad hoc networks of mobile nodes. DSR allows the network to be 41 completely self-organizing and self-configuring, without the need for 42 any existing network infrastructure or administration. The protocol 43 is composed of the two main mechanisms of "Route Discovery" and 44 "Route Maintenance", which work together to allow nodes to discover 45 and maintain routes to arbitrary destinations in the ad hoc network. 46 All aspects of the protocol operate entirely on-demand, allowing 47 the routing packet overhead of DSR to scale automatically to only 48 that needed to react to changes in the routes currently in use. The 49 protocol allows multiple routes to any destination and allows each 50 sender to select and control the routes used in routing its packets, 51 for example for use in load balancing or for increased robustness. 52 Other advantages of the DSR protocol include easily guaranteed 53 loop-free routing, operation in networks containing unidirectional 54 links, use of only "soft state" in routing, and very rapid recovery 55 when routes in the network change. The DSR protocol is designed 56 mainly for mobile ad hoc networks of up to about two hundred nodes, 57 and is designed to work well with even very high rates of mobility. 58 This document specifies the operation of the DSR protocol for routing 59 unicast IPv4 packets. 61 Contents 63 Status of This Memo i 65 Abstract ii 67 1. Introduction 1 69 2. Assumptions 4 71 3. DSR Protocol Overview 6 73 3.1. Basic DSR Route Discovery . . . . . . . . . . . . . . . . 6 74 3.2. Basic DSR Route Maintenance . . . . . . . . . . . . . . . 9 75 3.3. Additional Route Discovery Features . . . . . . . . . . . 11 76 3.3.1. Caching Overheard Routing Information . . . . . . 11 77 3.3.2. Replying to Route Requests using Cached Routes . 12 78 3.3.3. Route Request Hop Limits . . . . . . . . . . . . 13 79 3.4. Additional Route Maintenance Features . . . . . . . . . . 14 80 3.4.1. Packet Salvaging . . . . . . . . . . . . . . . . 14 81 3.4.2. Queued Packets Destined over a Broken Link . . . 15 82 3.4.3. Automatic Route Shortening . . . . . . . . . . . 16 83 3.4.4. Increased Spreading of Route Error Messages . . . 16 84 3.5. Optional DSR Flow State Extension . . . . . . . . . . . . 17 85 3.5.1. Flow Establishment . . . . . . . . . . . . . . . 17 86 3.5.2. Receiving and Forwarding Establishment Packets . 19 87 3.5.3. Sending Packets Along Established Flows . . . . . 19 88 3.5.4. Receiving and Forwarding Packets Sent Along 89 Established Flows . . . . . . . . . . . . 20 90 3.5.5. Processing Route Errors . . . . . . . . . . . . . 21 91 3.5.6. Interaction with Automatic Route Shortening . . . 21 92 3.5.7. Loop Detection . . . . . . . . . . . . . . . . . 21 93 3.5.8. Acknowledgement Destination . . . . . . . . . . . 22 94 3.5.9. Crash Recovery . . . . . . . . . . . . . . . . . 22 95 3.5.10. Rate Limiting . . . . . . . . . . . . . . . . . . 22 96 3.5.11. Interaction with Packet Salvaging . . . . . . . . 22 98 4. Conceptual Data Structures 23 100 4.1. Route Cache . . . . . . . . . . . . . . . . . . . . . . . 23 101 4.2. Send Buffer . . . . . . . . . . . . . . . . . . . . . . . 26 102 4.3. Route Request Table . . . . . . . . . . . . . . . . . . . 27 103 4.4. Gratuitous Route Reply Table . . . . . . . . . . . . . . 28 104 4.5. Network Interface Queue and Maintenance Buffer . . . . . 29 105 4.6. Blacklist . . . . . . . . . . . . . . . . . . . . . . . . 30 107 5. Additional Conceptual Data Structures for Flow State Extension 31 109 5.1. Flow Table . . . . . . . . . . . . . . . . . . . . . . . 31 110 5.2. Automatic Route Shortening Table . . . . . . . . . . . . 32 111 5.3. Default Flow ID Table . . . . . . . . . . . . . . . . . . 32 113 6. DSR Options Header Format 34 115 6.1. Fixed Portion of DSR Options Header . . . . . . . . . . . 35 116 6.2. Route Request Option . . . . . . . . . . . . . . . . . . 38 117 6.3. Route Reply Option . . . . . . . . . . . . . . . . . . . 40 118 6.4. Route Error Option . . . . . . . . . . . . . . . . . . . 42 119 6.4.1. Node Unreachable Type-Specific Information . . . 44 120 6.4.2. Flow State Not Supported Type-Specific Information 44 121 6.4.3. Option Not Supported Type-Specific Information . 44 122 6.5. Acknowledgement Request Option . . . . . . . . . . . . . 45 123 6.6. Acknowledgement Option . . . . . . . . . . . . . . . . . 46 124 6.7. DSR Source Route Option . . . . . . . . . . . . . . . . . 47 125 6.8. Pad1 Option . . . . . . . . . . . . . . . . . . . . . . . 49 126 6.9. PadN Option . . . . . . . . . . . . . . . . . . . . . . . 50 128 7. Additional Header Formats and Options for Flow State Extension 51 130 7.1. DSR Flow State Header . . . . . . . . . . . . . . . . . . 52 131 7.2. New Options and Extensions in DSR Options Header . . . . 53 132 7.2.1. Timeout Option . . . . . . . . . . . . . . . . . 53 133 7.2.2. Destination and Flow ID Option . . . . . . . . . 54 134 7.3. New Error Types for Route Error Option . . . . . . . . . 55 135 7.3.1. Unknown Flow Type-Specific Information . . . . . 55 136 7.3.2. Default Flow Unknown Type-Specific Information . 56 137 7.4. New Acknowledgement Request Option Extension . . . . . . 57 138 7.4.1. Previous Hop Address Extension . . . . . . . . . 57 140 8. Detailed Operation 58 142 8.1. General Packet Processing . . . . . . . . . . . . . . . . 58 143 8.1.1. Originating a Packet . . . . . . . . . . . . . . 58 144 8.1.2. Adding a DSR Options Header to a Packet . . . . . 58 145 8.1.3. Adding a DSR Source Route Option to a Packet . . 59 146 8.1.4. Processing a Received Packet . . . . . . . . . . 60 147 8.1.5. Processing a Received DSR Source Route Option . . 62 148 8.1.6. Handling an Unknown DSR Option . . . . . . . . . 64 149 8.2. Route Discovery Processing . . . . . . . . . . . . . . . 66 150 8.2.1. Originating a Route Request . . . . . . . . . . . 66 151 8.2.2. Processing a Received Route Request Option . . . 68 152 8.2.3. Generating a Route Reply using the Route Cache . 70 153 8.2.4. Originating a Route Reply . . . . . . . . . . . . 72 154 8.2.5. Preventing Route Reply Storms . . . . . . . . . . 74 155 8.2.6. Processing a Received Route Reply Option . . . . 75 156 8.3. Route Maintenance Processing . . . . . . . . . . . . . . 77 157 8.3.1. Using Link-Layer Acknowledgements . . . . . . . . 77 158 8.3.2. Using Passive Acknowledgements . . . . . . . . . 78 159 8.3.3. Using Network-Layer Acknowledgements . . . . . . 79 160 8.3.4. Originating a Route Error . . . . . . . . . . . . 82 161 8.3.5. Processing a Received Route Error Option . . . . 83 162 8.3.6. Salvaging a Packet . . . . . . . . . . . . . . . 84 163 8.4. Multiple Network Interface Support . . . . . . . . . . . 86 164 8.5. IP Fragmentation and Reassembly . . . . . . . . . . . . . 87 165 8.6. Flow State Processing . . . . . . . . . . . . . . . . . . 88 166 8.6.1. Originating a Packet . . . . . . . . . . . . . . 88 167 8.6.2. Inserting a DSR Flow State Header . . . . . . . . 90 168 8.6.3. Receiving a Packet . . . . . . . . . . . . . . . 90 169 8.6.4. Forwarding a Packet Using Flow IDs . . . . . . . 95 170 8.6.5. Promiscuously Receiving a Packet . . . . . . . . 95 171 8.6.6. Operation where the Layer below DSR Decreases 172 the IP TTL Non-Uniformly . . . . . . . . . 96 173 8.6.7. Salvage Interactions with DSR . . . . . . . . . . 96 175 9. Protocol Constants and Configuration Variables 97 177 10. IANA Considerations 98 179 11. Security Considerations 99 181 Appendix A. Link-MaxLife Cache Description 100 183 Appendix B. Location of DSR in the ISO Network Reference Model 102 185 Appendix C. Implementation and Evaluation Status 103 187 Changes from Previous Version of the Draft 105 189 Acknowledgements 106 191 References 107 193 Chair's Address 111 195 Authors' Addresses 112 196 1. Introduction 198 The Dynamic Source Routing protocol (DSR) [15, 16] is a simple and 199 efficient routing protocol designed specifically for use in multi-hop 200 wireless ad hoc networks of mobile nodes. Using DSR, the network 201 is completely self-organizing and self-configuring, requiring no 202 existing network infrastructure or administration. Network nodes 203 cooperate to forward packets for each other to allow communication 204 over multiple "hops" between nodes not directly within wireless 205 transmission range of one another. As nodes in the network move 206 about or join or leave the network, and as wireless transmission 207 conditions such as sources of interference change, all routing is 208 automatically determined and maintained by the DSR routing protocol. 209 Since the number or sequence of intermediate hops needed to reach any 210 destination may change at any time, the resulting network topology 211 may be quite rich and rapidly changing. 213 In designing DSR, we sought to create a routing protocol that had 214 very low overhead yet was able to react very quickly to changes in 215 the network. The DSR protocol provides highly reactive service in 216 order to help ensure successful delivery of data packets in spite of 217 node movement or other changes in network conditions. 219 The DSR protocol is composed of two main mechanisms that work 220 together to allow the discovery and maintenance of source routes in 221 the ad hoc network: 223 - Route Discovery is the mechanism by which a node S wishing to 224 send a packet to a destination node D obtains a source route 225 to D. Route Discovery is used only when S attempts to send a 226 packet to D and does not already know a route to D. 228 - Route Maintenance is the mechanism by which node S is able 229 to detect, while using a source route to D, if the network 230 topology has changed such that it can no longer use its route 231 to D because a link along the route no longer works. When Route 232 Maintenance indicates a source route is broken, S can attempt to 233 use any other route it happens to know to D, or can invoke Route 234 Discovery again to find a new route for subsequent packets to D. 235 Route Maintenance for this route is used only when S is actually 236 sending packets to D. 238 In DSR, Route Discovery and Route Maintenance each operate entirely 239 "on demand". In particular, unlike other protocols, DSR requires no 240 periodic packets of any kind at any layer within the network. For 241 example, DSR does not use any periodic routing advertisement, link 242 status sensing, or neighbor detection packets, and does not rely on 243 these functions from any underlying protocols in the network. This 244 entirely on-demand behavior and lack of periodic activity allows 245 the number of overhead packets caused by DSR to scale all the way 246 down to zero, when all nodes are approximately stationary with 247 respect to each other and all routes needed for current communication 248 have already been discovered. As nodes begin to move more or 249 as communication patterns change, the routing packet overhead of 250 DSR automatically scales to only that needed to track the routes 251 currently in use. Network topology changes not affecting routes 252 currently in use are ignored and do not cause reaction from the 253 protocol. 255 All state maintained by DSR is "soft state" [6], in that the loss 256 of any state will not interfere with the correct operation of the 257 protocol; all state is discovered as needed and can easily and 258 quickly be rediscovered if needed after a failure without significant 259 impact on the protocol. This use of only soft state allows the 260 routing protocol to be very robust to problems such as dropped or 261 delayed routing packets or node failures. In particular, a node in 262 DSR that fails and reboots can easily rejoin the network immediately 263 after rebooting; if the failed node was involved in forwarding 264 packets for other nodes as an intermediate hop along one or more 265 routes, it can also resume this forwarding quickly after rebooting, 266 with no or minimal interruption to the routing protocol. 268 In response to a single Route Discovery (as well as through routing 269 information from other packets overheard), a node may learn and 270 cache multiple routes to any destination. This support for multiple 271 routes allows the reaction to routing changes to be much more rapid, 272 since a node with multiple routes to a destination can try another 273 cached route if the one it has been using should fail. This caching 274 of multiple routes also avoids the overhead of needing to perform a 275 new Route Discovery each time a route in use breaks. The sender of 276 a packet selects and controls the route used for its own packets, 277 which together with support for multiple routes also allows features 278 such as load balancing to be defined. In addition, all routes used 279 are easily guaranteed to be loop-free, since the sender can avoid 280 duplicate hops in the routes selected. 282 The operation of both Route Discovery and Route Maintenance in DSR 283 are designed to allow unidirectional links and asymmetric routes to 284 be supported. In particular, as noted in Section 2, in wireless 285 networks, it is possible that a link between two nodes may not 286 work equally well in both directions, due to differing antenna or 287 propagation patterns or sources of interference. 289 This document specifies the operation of the DSR protocol for 290 routing unicast IPv4 packets in multi-hop wireless ad hoc networks. 291 Advanced, optional features, such as Quality of Service (QoS) support 292 and efficient multicast routing, and operation of DSR with IPv6 [7], 293 are covered in other documents. The specification of DSR in this 294 document provides a compatible base on which such features can be 295 added, either independently or by integration with the DSR operation 296 specified here. 298 The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 299 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 300 document are to be interpreted as described in RFC 2119 [4]. 302 2. Assumptions 304 The DSR protocol as described here is designed mainly for mobile 305 ad hoc networks of up to about two hundred nodes, and is designed 306 to work well with even very high rates of mobility. Other protocol 307 features and enhancements that may allow DSR to scale to larger 308 networks are outside the scope of this document. 310 We assume in this document that all nodes wishing to communicate with 311 other nodes within the ad hoc network are willing to participate 312 fully in the protocols of the network. In particular, each node 313 participating in the ad hoc network SHOULD also be willing to forward 314 packets for other nodes in the network. 316 The diameter of an ad hoc network is the minimum number of hops 317 necessary for a packet to reach from any node located at one extreme 318 edge of the ad hoc network to another node located at the opposite 319 extreme. We assume that this diameter will often be small (e.g., 320 perhaps 5 or 10 hops), but may often be greater than 1. 322 Packets may be lost or corrupted in transmission on the wireless 323 network. We assume that a node receiving a corrupted packet can 324 detect the error and discard the packet. 326 Nodes within the ad hoc network MAY move at any time without notice, 327 and MAY even move continuously, but we assume that the speed with 328 which nodes move is moderate with respect to the packet transmission 329 latency and wireless transmission range of the particular underlying 330 network hardware in use. In particular, DSR can support very 331 rapid rates of arbitrary node mobility, but we assume that nodes do 332 not continuously move so rapidly as to make the flooding of every 333 individual data packet the only possible routing protocol. 335 A common feature of many network interfaces, including most current 336 LAN hardware for broadcast media such as wireless, is the ability 337 to operate the network interface in "promiscuous" receive mode. 338 This mode causes the hardware to deliver every received packet to 339 the network driver software without filtering based on link-layer 340 destination address. Although we do not require this facility, some 341 of our optimizations can take advantage of its availability. Use 342 of promiscuous mode does increase the software overhead on the CPU, 343 but we believe that wireless network speeds are more the inherent 344 limiting factor to performance in current and future systems; we also 345 believe that portions of the protocol are suitable for implementation 346 directly within a programmable network interface unit to avoid this 347 overhead on the CPU [16]. Use of promiscuous mode may also increase 348 the power consumption of the network interface hardware, depending 349 on the design of the receiver hardware, and in such cases, DSR can 350 easily be used without the optimizations that depend on promiscuous 351 receive mode, or can be programmed to only periodically switch the 352 interface into promiscuous mode. Use of promiscuous receive mode is 353 entirely optional. 355 Wireless communication ability between any pair of nodes may at 356 times not work equally well in both directions, due for example to 357 differing antenna or propagation patterns or sources of interference 358 around the two nodes [1, 20]. That is, wireless communications 359 between each pair of nodes will in many cases be able to operate 360 bidirectionally, but at times the wireless link between two nodes 361 may be only unidirectional, allowing one node to successfully 362 send packets to the other while no communication is possible 363 in the reverse direction. Some MAC protocols, however, such as 364 MACA [19], MACAW [2], or IEEE 802.11 [13], limit unicast data 365 packet transmission to bidirectional links, due to the required 366 bidirectional exchange of RTS and CTS packets in these protocols and 367 due to the link-layer acknowledgement feature in IEEE 802.11; when 368 used on top of MAC protocols such as these, DSR can take advantage 369 of additional optimizations, such as the ability to reverse a source 370 route to obtain a route back to the origin of the original route. 372 The IP address used by a node using the DSR protocol MAY be assigned 373 by any mechanism (e.g., static assignment or use of DHCP for dynamic 374 assignment [8]), although the method of such assignment is outside 375 the scope of this specification. 377 A routing protocol such as DSR chooses a next-hop for each packet 378 and provides the IP address of that next-hop. When the packet 379 is transmitted, however, the lower-layer protocol often has a 380 separate, MAC-layer address for the next-hop node. DSR uses the 381 Address Resolution Protocol (ARP) [30] to translate from next-hop IP 382 addresses to next-hop MAC addresses. In addition, a node MAY add 383 an entry to its ARP cache based on any received packet, when the IP 384 address and MAC address of the transmitting node are available in 385 the packet; for example, the IP address of the transmitting node 386 is present in a Route Request option (in the Address list being 387 accumulated) and any packets containing a source route. Adding 388 entries to the ARP cache in this way avoids the overhead of ARP in 389 most cases. 391 3. DSR Protocol Overview 393 This section provides an overview of the operation of the DSR 394 protocol. The basic version of DSR uses explicit "source routing", 395 in which each data packet sent carries in its header the complete, 396 ordered list of nodes through which the packet will pass. This use 397 of explicit source routing allows the sender to select and control 398 the routes used for its own packets, supports the use of multiple 399 routes to any destination (for example, for load balancing), and 400 allows a simple guarantee that the routes used are loop-free; by 401 including this source route in the header of each data packet, other 402 nodes forwarding or overhearing any of these packets can also easily 403 cache this routing information for future use. Section 3.1 describes 404 this basic operation of Route Discovery, Section 3.2 describes basic 405 Route Maintenance, and Sections 3.3 and 3.4 describe additional 406 features of these two parts of DSR's operation. Section 3.5 then 407 describes an optional, compatible extension to DSR, known as "flow 408 state", that allows the routing of most packets without an explicit 409 source route header in the packet, while still preserves the 410 fundamental properties of DSR's operation. 412 3.1. Basic DSR Route Discovery 414 When some source node originates a new packet addressed to some 415 destination node, the source node places in the header of the packet 416 a "source route" giving the sequence of hops that the packet is to 417 follow on its way to the destination. Normally, the sender will 418 obtain a suitable source route by searching its "Route Cache" of 419 routes previously learned; if no route is found in its cache, it will 420 initiate the Route Discovery protocol to dynamically find a new route 421 to this destination node. In this case, we call the source node 422 the "initiator" and the destination node the "target" of the Route 423 Discovery. 425 For example, suppose a node A is attempting to discover a route to 426 node E. The Route Discovery initiated by node A in this example 427 would proceed as follows: 429 ^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D" 430 | id=2 | id=2 | id=2 | id=2 431 +-----+ +-----+ +-----+ +-----+ +-----+ 432 | A |---->| B |---->| C |---->| D |---->| E | 433 +-----+ +-----+ +-----+ +-----+ +-----+ 434 | | | | 435 v v v v 437 To initiate the Route Discovery, node A transmits a "Route 438 Request" as a single local broadcast packet, which is received by 439 (approximately) all nodes currently within wireless transmission 440 range of A, including node B in this example. Each Route Request 441 identifies the initiator and target of the Route Discovery, and 442 also contains a unique request identification (2, in this example), 443 determined by the initiator of the Request. Each Route Request also 444 contains a record listing the address of each intermediate node 445 through which this particular copy of the Route Request has been 446 forwarded. This route record is initialized to an empty list by the 447 initiator of the Route Discovery. In this example, the route record 448 initially lists only node A. 450 When another node receives this Route Request (such as node B in this 451 example), if it is the target of the Route Discovery, it returns 452 a "Route Reply" to the initiator of the Route Discovery, giving 453 a copy of the accumulated route record from the Route Request; 454 when the initiator receives this Route Reply, it caches this route 455 in its Route Cache for use in sending subsequent packets to this 456 destination. 458 Otherwise, if this node receiving the Route Request has recently seen 459 another Route Request message from this initiator bearing this same 460 request identification and target address, or if this node's own 461 address is already listed in the route record in the Route Request, 462 this node discards the Request. (A node considers a Request recently 463 seen if it still has information about that Request in its Route 464 Request Table, which is described in Section 4.3.) Otherwise, this 465 node appends its own address to the route record in the Route Request 466 and propagates it by transmitting it as a local broadcast packet 467 (with the same request identification). In this example, node B 468 broadcast the Route Request, which is received by node C; nodes C 469 and D each also, in turn, broadcast the Request, resulting in a copy 470 of the Request being received by node E. 472 In returning the Route Reply to the initiator of the Route Discovery, 473 such as in this example, node E replying back to node A, node E will 474 typically examine its own Route Cache for a route back to A, and if 475 found, will use it for the source route for delivery of the packet 476 containing the Route Reply. Otherwise, E SHOULD perform its own 477 Route Discovery for target node A, but to avoid possible infinite 478 recursion of Route Discoveries, it MUST piggyback this Route Reply 479 on the packet containing its own Route Request for A. It is also 480 possible to piggyback other small data packets, such as a TCP SYN 481 packet [33], on a Route Request using this same mechanism. 483 Node E could instead simply reverse the sequence of hops in the route 484 record that it is trying to send in the Route Reply, and use this as 485 the source route on the packet carrying the Route Reply itself. For 486 MAC protocols such as IEEE 802.11 that require a bidirectional frame 487 exchange as part of the MAC protocol [13], the discovered source 488 route MUST be reversed in this way to return the Route Reply since it 489 tests the discovered route to ensure it is bidirectional before the 490 Route Discovery initiator begins using the route; this route reversal 491 also avoids the overhead of a possible second Route Discovery. 493 When initiating a Route Discovery, the sending node saves a copy of 494 the original packet (that triggered the Discovery) in a local buffer 495 called the "Send Buffer". The Send Buffer contains a copy of each 496 packet that cannot be transmitted by this node because it does not 497 yet have a source route to the packet's destination. Each packet in 498 the Send Buffer is logically associated with the time that it was 499 placed into the Send Buffer and is discarded after residing in the 500 Send Buffer for some timeout period SendBufferTimeout; if necessary 501 for preventing the Send Buffer from overflowing, a FIFO or other 502 replacement strategy MAY also be used to evict packets even before 503 they expire. 505 While a packet remains in the Send Buffer, the node SHOULD 506 occasionally initiate a new Route Discovery for the packet's 507 destination address. However, the node MUST limit the rate at which 508 such new Route Discoveries for the same address are initiated (as 509 described in Section 4.3), since it is possible that the destination 510 node is not currently reachable. In particular, due to the limited 511 wireless transmission range and the movement of the nodes in the 512 network, the network may at times become partitioned, meaning that 513 there is currently no sequence of nodes through which a packet could 514 be forwarded to reach the destination. Depending on the movement 515 pattern and the density of nodes in the network, such network 516 partitions may be rare or may be common. 518 If a new Route Discovery was initiated for each packet sent by a 519 node in such a partitioned network, a large number of unproductive 520 Route Request packets would be propagated throughout the subset 521 of the ad hoc network reachable from this node. In order to 522 reduce the overhead from such Route Discoveries, a node SHOULD use 523 an exponential back-off algorithm to limit the rate at which it 524 initiates new Route Discoveries for the same target, doubling the 525 timeout between each successive Discovery initiated for the same 526 target. If the node attempts to send additional data packets to this 527 same destination node more frequently than this limit, the subsequent 528 packets SHOULD be buffered in the Send Buffer until a Route Reply is 529 received giving a route to this destination, but the node MUST NOT 530 initiate a new Route Discovery until the minimum allowable interval 531 between new Route Discoveries for this target has been reached. This 532 limitation on the maximum rate of Route Discoveries for the same 533 target is similar to the mechanism required by Internet nodes to 534 limit the rate at which ARP Requests are sent for any single target 535 IP address [3]. 537 3.2. Basic DSR Route Maintenance 539 When originating or forwarding a packet using a source route, each 540 node transmitting the packet is responsible for confirming that data 541 can flow over the link from that node to the next hop. For example, 542 in the situation shown below, node A has originated a packet for 543 node E using a source route through intermediate nodes B, C, and D: 545 +-----+ +-----+ +-----+ +-----+ +-----+ 546 | A |---->| B |---->| C |-->? | D | | E | 547 +-----+ +-----+ +-----+ +-----+ +-----+ 549 In this case, node A is responsible for the link from A to B, node B 550 is responsible for the link from B to C, node C is responsible for 551 the link from C to D, node D is responsible for the link from D to E. 553 An acknowledgement can provide confirmation that a link is capable of 554 carrying data, and in wireless networks, acknowledgements are often 555 provided at no cost, either as an existing standard part of the MAC 556 protocol in use (such as the link-layer acknowledgement frame defined 557 by IEEE 802.11 [13]), or by a "passive acknowledgement" [18] (in 558 which, for example, B confirms receipt at C by overhearing C transmit 559 the packet when forwarding it on to D). 561 If a built-in acknowledgement mechanism is not available, the 562 node transmitting the packet can explicitly request a DSR-specific 563 software acknowledgement be returned by the next node along the 564 route; this software acknowledgement will normally be transmitted 565 directly to the sending node, but if the link between these two nodes 566 is unidirectional (Section 4.6), this software acknowledgement could 567 travel over a different, multi-hop path. 569 After an acknowledgement has been received from some neighbor, a node 570 MAY choose to not require acknowledgements from that neighbor for a 571 brief period of time, unless the network interface connecting a node 572 to that neighbor always receives an acknowledgement in response to 573 unicast traffic. 575 When a software acknowledgement is used, the acknowledgement 576 request SHOULD be retransmitted up to a maximum number of times. 577 A retransmission of the acknowledgement request can be sent as a 578 separate packet, piggybacked on a retransmission of the original 579 data packet, or piggybacked on any packet with the same next-hop 580 destination that does not also contain a software acknowledgement. 582 After the acknowledgement request has been retransmitted the maximum 583 number of times, if no acknowledgement has been received, then the 584 sender treats the link to this next-hop destination as currently 585 "broken". It SHOULD remove this link from its Route Cache and 586 SHOULD return a "Route Error" to each node that has sent a packet 587 routed over that link since an acknowledgement was last received. 588 For example, in the situation shown above, if C does not receive 589 an acknowledgement from D after some number of requests, it would 590 return a Route Error to A, as well as any other node that may have 591 used the link from C to D since C last received an acknowledgement 592 from D. Node A then removes this broken link from its cache; any 593 retransmission of the original packet can be performed by upper 594 layer protocols such as TCP, if necessary. For sending such a 595 retransmission or other packets to this same destination E, if A has 596 in its Route Cache another route to E (for example, from additional 597 Route Replies from its earlier Route Discovery, or from having 598 overheard sufficient routing information from other packets), it 599 can send the packet using the new route immediately. Otherwise, it 600 SHOULD perform a new Route Discovery for this target (subject to the 601 back-off described in Section 3.1). 603 3.3. Additional Route Discovery Features 605 3.3.1. Caching Overheard Routing Information 607 A node forwarding or otherwise overhearing any packet SHOULD add all 608 usable routing information from that packet to its own Route Cache. 609 The usefulness of routing information in a packet depends on the 610 directionality characteristics of the physical medium (Section 2), as 611 well as the MAC protocol being used. Specifically, three distinct 612 cases are possible: 614 - Links in the network frequently are capable of operating only 615 unidirectionally (not bidirectionally), and the MAC protocol in 616 use in the network is capable of transmitting unicast packets 617 over unidirectional links. 619 - Links in the network occasionally are capable of operating only 620 unidirectionally (not bidirectionally), but this unidirectional 621 restriction on any link is not persistent, almost all links 622 are physically bidirectional, and the MAC protocol in use in 623 the network is capable of transmitting unicast packets over 624 unidirectional links. 626 - The MAC protocol in use in the network is not capable of 627 transmitting unicast packets over unidirectional links; 628 only bidirectional links can be used by the MAC protocol for 629 transmitting unicast packets. For example, the IEEE 802.11 630 Distributed Coordination Function (DCF) MAC protocol [13] 631 is capable of transmitting a unicast packet only over a 632 bidirectional link, since the MAC protocol requires the return of 633 a link-level acknowledgement packet from the receiver and also 634 optionally requires the bidirectional exchange of an RTS and CTS 635 packet between the transmitter and receiver nodes. 637 In the first case above, for example, the source route used in a data 638 packet, the accumulated route record in a Route Request, or the route 639 being returned in a Route Reply SHOULD all be cached by any node in 640 the "forward" direction; any node SHOULD cache this information from 641 any such packet received, whether the packet was addressed to this 642 node, sent to a broadcast (or multicast) MAC address, or overheard 643 while the node's network interface is in promiscuous mode. However, 644 the "reverse" direction of the links identified in such packet 645 headers SHOULD NOT be cached. 647 For example, in the situation shown below, node A is using a source 648 route to communicate with node E: 650 +-----+ +-----+ +-----+ +-----+ +-----+ 651 | A |---->| B |---->| C |---->| D |---->| E | 652 +-----+ +-----+ +-----+ +-----+ +-----+ 654 As node C forwards a data packet along the route from A to E, it 655 SHOULD add to its cache the presence of the "forward" direction 656 links that it learns from the headers of these packets, from itself 657 to D and from D to E. Node C SHOULD NOT, in this case, cache the 658 "reverse" direction of the links identified in these packet headers, 659 from itself back to B and from B to A, since these links might be 660 unidirectional. 662 In the second case above, in which links may occasionally operate 663 unidirectionally, the links described above SHOULD be cached in both 664 directions. Furthermore, in this case, if node X overhears (e.g., 665 through promiscuous mode) a packet transmitted by node C that is 666 using a source route from node A to E, node X SHOULD cache all of 667 these links as well, also including the link from C to X over which 668 it overheard the packet. 670 In the final case, in which the MAC protocol requires physical 671 bidirectionality for unicast operation, links from a source route 672 SHOULD be cached in both directions, except when the packet also 673 contains a Route Reply, in which case only the links already 674 traversed in this source route SHOULD be cached, but the links not 675 yet traversed in this route SHOULD NOT be cached. 677 3.3.2. Replying to Route Requests using Cached Routes 679 A node receiving a Route Request for which it is not the target, 680 searches its own Route Cache for a route to the target of the 681 Request. If found, the node generally returns a Route Reply to the 682 initiator itself rather than forwarding the Route Request. In the 683 Route Reply, this node sets the route record to list the sequence of 684 hops over which this copy of the Route Request was forwarded to it, 685 concatenated with the source route to this target obtained from its 686 own Route Cache. 688 However, before transmitting a Route Reply packet that was generated 689 using information from its Route Cache in this way, a node MUST 690 verify that the resulting route being returned in the Route Reply, 691 after this concatenation, contains no duplicate nodes listed in the 692 route record. For example, the figure below illustrates a case in 693 which a Route Request for target E has been received by node F, and 694 node F already has in its Route Cache a route from itself to E: 696 +-----+ +-----+ +-----+ +-----+ 697 | A |---->| B |- >| D |---->| E | 698 +-----+ +-----+ \ / +-----+ +-----+ 699 \ / 700 \ +-----+ / 701 >| C |- 702 +-----+ 703 | ^ 704 v | 705 Route Request +-----+ 706 Route: A - B - C - F | F | Cache: C - D - E 707 +-----+ 709 The concatenation of the accumulated route record from the Route 710 Request and the cached route from F's Route Cache would include a 711 duplicate node in passing from C to F and back to C. 713 Node F in this case could attempt to edit the route to eliminate the 714 duplication, resulting in a route from A to B to C to D and on to E, 715 but in this case, node F would not be on the route that it returned 716 in its own Route Reply. DSR Route Discovery prohibits node F 717 from returning such a Route Reply from its cache; this prohibition 718 increases the probability that the resulting route is valid, since 719 node F in this case should have received a Route Error if the route 720 had previously stopped working. Furthermore, this prohibition 721 means that a future Route Error traversing the route is very likely 722 to pass through any node that sent the Route Reply for the route 723 (including node F), which helps to ensure that stale data is removed 724 from caches (such as at F) in a timely manner; otherwise, the next 725 Route Discovery initiated by A might also be contaminated by a Route 726 Reply from F containing the same stale route. If node F, due to this 727 restriction on returning a Route Reply based on information from its 728 Route Cache, does not return such a Route Reply, node F propagates 729 the Route Request normally. 731 3.3.3. Route Request Hop Limits 733 Each Route Request message contains a "hop limit" that may be used 734 to limit the number of intermediate nodes allowed to forward that 735 copy of the Route Request. This hop limit is implemented using the 736 Time-to-Live (TTL) field in the IP header of the packet carrying 737 the Route Request. As the Request is forwarded, this limit is 738 decremented, and the Request packet is discarded if the limit reaches 739 zero before finding the target. This Route Request hop limit can be 740 used to implement a variety of algorithms for controlling the spread 741 of a Route Request during a Route Discovery attempt. 743 For example, a node MAY use this hop limit to implement a 744 "non-propagating" Route Request as an initial phase of a Route 745 Discovery. A node using this technique sends its first Route Request 746 attempt for some target node using a hop limit of 1, such that any 747 node receiving the initial transmission of the Route Request will 748 not forward the Request to other nodes by re-broadcasting it. This 749 form of Route Request is called a "non-propagating" Route Request; 750 it provides an inexpensive method for determining if the target is 751 currently a neighbor of the initiator or if a neighbor node has a 752 route to the target cached (effectively using the neighbors' Route 753 Caches as an extension of the initiator's own Route Cache). If no 754 Route Reply is received after a short timeout, then the node sends 755 a "propagating" Route Request for the target node (i.e., with hop 756 limit as defined by the value of the DiscoveryHopLimit configuration 757 variable). 759 As another example, a node MAY use this hop limit to implement an 760 "expanding ring" search for the target [16]. A node using this 761 technique sends an initial non-propagating Route Request as described 762 above; if no Route Reply is received for it, the node originates 763 another Route Request with a hop limit of 2. For each Route Request 764 originated, if no Route Reply is received for it, the node doubles 765 the hop limit used on the previous attempt, to progressively explore 766 for the target node without allowing the Route Request to propagate 767 over the entire network. However, this expanding ring search 768 approach could have the effect of increasing the average latency of 769 Route Discovery, since multiple Discovery attempts and timeouts may 770 be needed before discovering a route to the target node. 772 3.4. Additional Route Maintenance Features 774 3.4.1. Packet Salvaging 776 When an intermediate node forwarding a packet detects through Route 777 Maintenance that the next hop along the route for that packet is 778 broken, if the node has another route to the packet's destination in 779 its Route Cache, the node SHOULD "salvage" the packet rather than 780 discarding it. To salvage a packet, the node replaces the original 781 source route on the packet with the route from its Route Cache. The 782 node then forwards the packet to the next node indicated along this 783 source route. For example, in the situation shown in the example of 784 Section 3.2, if node C has another route cached to node E, it can 785 salvage the packet by replacing the original route in the packet with 786 this new route from its own Route Cache, rather than discarding the 787 packet. 789 When salvaging a packet, a count is maintained in the packet of the 790 number of times that it has been salvaged, to prevent a single packet 791 from being salvaged endlessly. Otherwise, since TTL is decremented 792 only once by each node, a single node could salvage a packet an 793 unbounded number of times. Even if we chose to require TTL to be 794 decremented on each salvage attempt, packet salvaging is an expensive 795 operation, so it is desirable to bound the maximum number of times a 796 packet can be salvaged independently of the maximum number of hops a 797 packet can traverse. 799 As described in Section 3.2, an intermediate node, such as in this 800 case, that detects through Route Maintenance that the next hop along 801 the route for a packet that it is forwarding is broken, the node also 802 SHOULD return a Route Error to the original sender of the packet, 803 identifying the link over which the packet could not be forwarded. 804 If the node sends this Route Error, it SHOULD originate the Route 805 Error before salvaging the packet. 807 3.4.2. Queued Packets Destined over a Broken Link 809 When an intermediate node forwarding a packet detects through Route 810 Maintenance that the next-hop link along the route for that packet 811 is broken, in addition to handling that packet as defined for Route 812 Maintenance, the node SHOULD also handle in a similar way any pending 813 packets that it has queued that are destined over this new broken 814 link. Specifically, the node SHOULD search its Network Interface 815 Queue and Maintenance Buffer (Section 4.5) for packets for which 816 the next-hop link is this new broken link. For each such packet 817 currently queued at this node, the node SHOULD process that packet as 818 follows: 820 - Remove the packet from the node's Network Interface Queue and 821 Maintenance Buffer. 823 - Originate a Route Error for this packet to the original sender of 824 the packet, using the procedure described in Section 8.3.4, as if 825 the node had already reached the maximum number of retransmission 826 attempts for that packet for Route Maintenance. However, in 827 sending such Route Errors for queued packets in response to a 828 single new broken link detected, the node SHOULD send no more 829 than one Route Error to each original sender of any of these 830 packets. 832 - If the node has another route to the packet's IP 833 Destination Address in its Route Cache, the node SHOULD 834 salvage the packet as described in Section 8.3.6. Otherwise, the 835 node SHOULD discard the packet. 837 3.4.3. Automatic Route Shortening 839 Source routes in use MAY be automatically shortened if one or more 840 intermediate nodes in the route become no longer necessary. This 841 mechanism of automatically shortening routes in use is somewhat 842 similar to the use of passive acknowledgements [18]. In particular, 843 if a node is able to overhear a packet carrying a source route (e.g., 844 by operating its network interface in promiscuous receive mode), then 845 this node examines the unexpended portion of that source route. If 846 this node is not the intended next-hop destination for the packet 847 but is named in the later unexpended portion of the packet's source 848 route, then it can infer that the intermediate nodes before itself in 849 the source route are no longer needed in the route. For example, the 850 figure below illustrates an example in which node D has overheard a 851 data packet being transmitted from B to C, for later forwarding to D 852 and to E: 854 +-----+ +-----+ +-----+ +-----+ +-----+ 855 | A |---->| B |---->| C | | D | | E | 856 +-----+ +-----+ +-----+ +-----+ +-----+ 857 \ ^ 858 \ / 859 --------------------- 861 In this case, this node (node D) SHOULD return a "gratuitous" Route 862 Reply to the original sender of the packet (node A). The Route 863 Reply gives the shorter route as the concatenation of the portion of 864 the original source route up through the node that transmitted the 865 overheard packet (node B), plus the suffix of the original source 866 route beginning with the node returning the gratuitous Route Reply 867 (node D). In this example, the route returned in the gratuitous Route 868 Reply message sent from D to A gives the new route as the sequence of 869 hops from A to B to D to E. 871 When deciding whether to return a gratuitous Route Reply in this way, 872 a node MAY factor in additional information beyond the fact that it 873 was able to overhear the packet. For example, the node MAY decide to 874 return the gratuitous Route Reply only when the overheard packet is 875 received with a signal strength or signal-to-noise ratio above some 876 specific threshold. In addition, each node maintains a Gratuitous 877 Route Reply Table, as described in Section 4.4, to limit the rate at 878 which it originates gratuitous Route Replies for the same returned 879 route. 881 3.4.4. Increased Spreading of Route Error Messages 883 When a source node receives a Route Error for a data packet that 884 it originated, this source node propagates this Route Error to its 885 neighbors by piggybacking it on its next Route Request. In this way, 886 stale information in the caches of nodes around this source node will 887 not generate Route Replies that contain the same invalid link for 888 which this source node received the Route Error. 890 For example, in the situation shown in the example of Section 3.2, 891 node A learns from the Route Error message from C, that the link 892 from C to D is currently broken. It thus removes this link from 893 its own Route Cache and initiates a new Route Discovery (if it has 894 no other route to E in its Route Cache). On the Route Request 895 packet initiating this Route Discovery, node A piggybacks a copy 896 of this Route Error, ensuring that the Route Error spreads well to 897 other nodes, and guaranteeing that any Route Reply that it receives 898 (including those from other node's Route Caches) in response to this 899 Route Request does not contain a route that assumes the existence of 900 this broken link. 902 3.5. Optional DSR Flow State Extension 904 This section describes an optional, compatible extension to the DSR 905 protocol, known as "flow state", that allows the routing of most 906 packets without an explicit source route header in the packet. The 907 DSR flow state extension further reduces the overhead of the protocol 908 yet still preserves the fundamental properties of DSR's operation. 909 Once a sending node has discovered a source route such as through 910 DSR's Route Discovery mechanism, the flow state mechanism allows the 911 sending node to establish hop-by-hop forwarding state within the 912 network, based on this source route, to enable each node along the 913 route to forward the packet to the next hop based on the node's own 914 local knowledge of the flow along which this packet is being routed. 915 Flow state is dynamically initialized by the first packet using a 916 source route and is then able to route subsequent packets along 917 the same flow without use of a source route header in the packet. 918 The state established at each hop along a flow is "soft state" and 919 thus automatically expires when no longer needed and can be quickly 920 recreated as necessary. Extending DSR's basic operation based on an 921 explicit source route in the header of each packet routed, the flow 922 state extension operates as a form of "implicit source routing" by 923 preserving DSR's basic operation but removing the explicit source 924 route from packets. 926 3.5.1. Flow Establishment 928 A source node sending packets to some destination node MAY use the 929 DSR flow state extension described here to establish a route to 930 that destination as a flow. A "flow" is a route from the source to 931 the destination represented by hop-by-hop forwarding state within 932 the nodes along the route. Each flow is uniquely identified by a 933 combination of the source node address, the destination node address, 934 and a flow identifier (flow ID) chosen by the source node. 936 Each flow ID is a 16-bit unsigned integer. Comparison between 937 different flow IDs MUST be performed modulo 2**16. For example, 938 using an implementation in the C programming language, a 939 flow ID value (a) is greater than another flow ID value (b) if 940 ((short)((a) - (b)) > 0), if a C language "short" data type is 941 implemented as a 16-bit signed integer. 943 A DSR Flow State header in a packet identifies the flow ID to 944 be followed in forwarding that packet. From a given source to 945 some destination, any number of different flows MAY exist and 946 be in use, for example following different sequences of hops to 947 reach the destination. One of these flows may be considered to be 948 the "default" flow from that source to that destination. A node 949 receiving a packet with neither a DSR Options header specifying the 950 route to be taken (with a Source Route option in the DSR Options 951 header) nor a DSR Flow State header specifying the flow ID to be 952 followed, is forwarded along the default flow for the source and 953 destination addresses specified in the packet's IP header. 955 In establishing a new flow, the source node generates a nonzero 956 16-bit flow ID greater than any unexpired flow IDs for this 957 (source, destination) pair. If the source wishes for this flow to 958 become the default flow, the low bit of the flow ID MUST be set (the 959 flow ID is an odd number); otherwise, the low bit MUST NOT be set 960 (the flow ID is an even number). 962 The source node establishing the new flow then transmits a packet 963 containing a DSR Options header with a Source Route option; to 964 establish the flow, the source node also MUST include in the packet 965 a DSR Flow State header, with the Flow ID field set to the chosen 966 flow ID for the new flow, and MUST include a Timeout option in the 967 DSR Options header, giving the lifetime after which state information 968 about this flow is to expire. This packet will generally be a normal 969 data packet being sent from this sender to the receiver (for example, 970 the first packet sent after discovering the new route) but is also 971 treated as a "flow establishment" packet. 973 The source node records this flow in its Flow Table for future use, 974 setting the TTL in this Flow Table entry to be the value used in the 975 TTL field in the packet's IP header and setting the Lifetime in this 976 entry to be the lifetime specified in the Timeout option in the DSR 977 Options header. The TTL field is used for Default Flow Forwarding, 978 as described in Sections 3.5.3 and 3.5.4. 980 Any further packets sent with this flow ID before the timeout that 981 also contain a DSR Options header with a Source Route option MUST use 982 this same source route in the Source Route option. 984 3.5.2. Receiving and Forwarding Establishment Packets 986 Packets intended to establish a flow, as described in Section 3.5.1, 987 contain a DSR Options header with a Source Route option, and are 988 forwarded along the indicated route. A node implementing the DSR 989 flow state extension, when receiving and forwarding such a DSR 990 packet, also keeps some state in its own Flow Table to enable it 991 to forward future packets that are sent along this flow with only 992 the flow ID specified. Specifically, if the packet also contains 993 a DSR Flow State header, this packet SHOULD cause an entry to be 994 established for this flow in the Flow Table of each node along the 995 packet's route. 997 The Hop Count field of the DSR Flow State header is also stored in 998 the Flow Table, as is Lifetime option specified in the DSR Options 999 header. 1001 If the Flow ID is odd and there is no flow in the Flow Table with 1002 Flow ID greater than the received Flow ID, set the default Flow ID 1003 for this (IP Source Address, IP Destination Address) pair to the 1004 received Flow ID, and the TTL of the packet is recorded. 1006 The Flow ID option is removed before final delivery of the packet. 1008 3.5.3. Sending Packets Along Established Flows 1010 When a flow is established as described in Section 3.5.1, a packet 1011 is sent which establishes state in each node along the route. 1012 This state is soft; that is, the protocol contains mechanisms for 1013 recovering from the loss of this state. However, the use of these 1014 mechanisms may result in reduced performance for packets sent 1015 along flows with forgotten state. As a result, it is desirable 1016 to differentiate behavior based on whether or not the sender is 1017 reasonably certain that the flow state exists on each node along 1018 the route. We define a flow's state to be "established end-to-end" 1019 if the Flow Tables of all nodes on the route contains forwarding 1020 information for that flow. While it is impossible to detect whether 1021 or not a flow's state has been established end-to-end without sending 1022 packets, implementations may make reasonable assumptions about the 1023 retention of flow state and the probability that an establishment 1024 packet has been seen by all nodes on the route. 1026 A source wishing to send a packet along an established flow 1027 determines if the flow state has been established end-to-end. If 1028 it has not, a DSR Options header with Source Route option with this 1029 flow's route is added to the packet. The source SHOULD set the 1030 Flow ID field of the DSR Flow State header either to the flow ID 1031 previously associated with this flow's route or to zero. If it sets 1032 the Flow ID field to any other value, it MUST follow the processing 1033 steps in Section 3.5.1 for establishing a new flow ID. If it sets the 1034 Flow ID field to a nonzero value, it MUST include a Timeout option 1035 with a value not greater than the timeout remaining in the node's 1036 Flow Table, and if its TTL is not equal to that specified in the Flow 1037 Table, the flow MUST NOT be used as a default flow in the future. 1039 Once flow state has been established end-to-end for non-default 1040 flows, a source adds a DSR Flow State header to each packet it wishes 1041 to send along that flow, setting the Flow ID field to the flow ID of 1042 that flow. A Source Route option SHOULD NOT be added to the packet, 1043 though if one is, then the steps for processing flows that have not 1044 been established end to end MUST be followed. 1046 Once flow state has been established end-to-end for default flows, 1047 sources sending packets with IP TTL equal to the TTL value in the 1048 local Flow Table entry for this flow then transmit the packet to the 1049 next hop. In this case, a DSR Flow State header SHOULD NOT be added 1050 to the packet and a DSR Options header likewise SHOULD NOT be added 1051 to the packet; though if one is, the steps for sending packets along 1052 non-default flows MUST be followed. If the IP TTL is not equal to 1053 the TTL value in the local Flow Table, then the steps for processing 1054 a non-default flow MUST be followed. 1056 3.5.4. Receiving and Forwarding Packets Sent Along Established Flows 1058 The handling of packets containing a DSR Options header with 1059 both a nonzero Flow ID and a Source Route option is described in 1060 Section 3.5.2. The Flow ID is ignored when it is equal to zero. 1061 This section only describes handling of packets without a Source 1062 Route option. 1064 If a node receives a packet with a Flow ID in the DSR Options 1065 header that indicates an unexpired flow in the node's Flow Table, it 1066 increments the Hop Count in the DSR Options header and forwards the 1067 packet to the next hop indicated in the Flow Table. 1069 If a node receives a packet with a Flow ID that indicates a flow not 1070 currently in the node's Flow Table, it returns a Route Error of type 1071 UNKNOWN_FLOW with Error Destination and IP Destination addresses 1072 copied from the IP Source of the packet triggering the error. This 1073 error packet SHOULD be MAC-destined to the node from which it was 1074 received; if it cannot confirm reachability of the previous node 1075 using Route Maintenance, it MUST send the error as described in 1076 Section 8.1.1. The node sending the error SHOULD attempt to salvage 1077 the packet triggering the Route Error. If it does salvage the 1078 packet, it MUST zero the Flow ID. 1080 If a node receives a packet with no DSR Options header and no DSR 1081 Flow State header, it checks the Default Flow Table. If there is 1082 an entry, it forwards to the next hop indicated in the Flow Table 1083 for the default flow. Otherwise, it returns a Route Error of type 1084 DEFAULT_FLOW_UNKNOWN with Error Destination and IP Destination 1085 addresses copied from the IP Source of the packet triggering the 1086 error. This error packet SHOULD be MAC-destined to the node from 1087 which it was received; if it cannot confirm reachability of the 1088 previous node using Route Maintenance, it MUST send the error as 1089 described in Section 8.1.1. The node sending the error SHOULD 1090 attempt to salvage the packet triggering the Route Error. If it does 1091 salvage the packet, it MUST zero the Flow ID. 1093 3.5.5. Processing Route Errors 1095 When a node receives a Route Error of type Unknown Flow, it marks 1096 the flow to indicate that it has not been established end-to-end. 1097 When a node receives a Route Error of type Default Flow Unknown, it 1098 marks the default flow to indicate that it has not been established 1099 end-to-end. 1101 3.5.6. Interaction with Automatic Route Shortening 1103 Because a full source route is not carried in every packet, an 1104 alternative method for performing automatic route shortening is 1105 necessary for packets using the flow state extension. Instead, nodes 1106 promiscuously listen to packets, and if a node receives a packet with 1107 (IP Source, IP Destination, Flow ID) found in the Flow Table but the 1108 MAC-layer (next hop) destination address of the packet is not this 1109 node, the node determines whether the packet was sent by an upstream 1110 or downstream node by examining the Hop Count field in the DSR Flow 1111 State header. If the Hop Count field is less than the expected 1112 Hop Count at this node (that is, the expected Hop Count field in 1113 the Flow Table described in Section 5.1), the node assumes that the 1114 packet was sent by an upstream node, and adds an entry for the packet 1115 to its Automatic Route Shortening Table, possibly evicting an earlier 1116 entry added to this table. When the packet is then sent to that node 1117 for forwarding, the node finds that it has previously received the 1118 packet by checking its Automatic Route Shortening Table, and returns 1119 a gratuitous Route Reply to the source of the packet. 1121 3.5.7. Loop Detection 1123 If a node receives a packet for forwarding with TTL lower than 1124 expected and default flow forwarding is being used, it sends a 1125 Route Error of type Default Flow Unknown back to the IP source. It 1126 can attempt delivery of the packet by normal salvaging (subject 1127 to constraints described in Section 8.6.7) or by inserting a 1128 Flow ID option with Special TTL extension based on what that node's 1129 understanding of the default Flow ID and TTL. 1131 3.5.8. Acknowledgement Destination 1133 In packets sent using Flow State, the previous hop is not necessarily 1134 known. In order to allow nodes that have lost flow state to 1135 determine the previous hop, the address of the previous hop can 1136 optionally be stored in the Acknowledgement Request. This extension 1137 SHOULD NOT be used when a Source Route option is present, MAY be used 1138 when flow state routing is used without a Source Route option, and 1139 SHOULD be used before Route Maintenance determines that the next-hop 1140 destination is unreachable. 1142 3.5.9. Crash Recovery 1144 Each node has a maximum Timeout value that it can possibly generate. 1145 This can be based on the largest number that can be set in a timeout 1146 option (2**16 - 1 seconds) or set in system software. When a node 1147 crashes, it does not establish new flows for a period equal to this 1148 maximum Timeout value, in order to avoid colliding with its old 1149 Flow IDs. 1151 3.5.10. Rate Limiting 1153 Flow IDs can be assigned with a counter. More specifically, the 1154 "Current Flow ID" is kept. When a new default Flow ID needs to be 1155 assigned, if the Current Flow ID is odd, the Current Flow ID is 1156 assigned as the Flow ID and the Current Flow ID is incremented by 1157 one; if the Current Flow ID is even, one plus the Current Flow ID is 1158 assigned as the Flow ID and the Current Flow ID is incremented by 1159 two. 1161 If Flow IDs are assigned in this way, one algorithm for avoiding 1162 duplicate, unexpired Flow IDs is to rate limit new Flow IDs to an 1163 average rate of n assignments per second, where n is 2**15 divided by 1164 the maximum Timeout value. This can be averaged over any period not 1165 exceeding the maximum Timeout value. 1167 3.5.11. Interaction with Packet Salvaging 1169 Salvaging is modified to zero the Flow ID field. Also, any time the 1170 this document refers to the Salvage field in the Source Route option 1171 in a DSR Options header, packets without a Source Route option are 1172 considered to have the value zero in the Salvage field. 1174 4. Conceptual Data Structures 1176 This document describes the operation of the DSR protocol in terms 1177 of a number of conceptual data structures. This section describes 1178 each of these data structures and provides an overview of its use 1179 in the protocol. In an implementation of the protocol, these data 1180 structures MAY be implemented in any manner consistent with the 1181 external behavior described in this document. Additional conceptual 1182 data structures are required for the optional flow state extensions 1183 to DSR; these data structures are described in Section 5. 1185 4.1. Route Cache 1187 Each node implementing DSR MUST maintain a Route Cache, containing 1188 routing information needed by the node. A node adds information to 1189 its Route Cache as it learns of new links between nodes in the ad hoc 1190 network; for example, a node may learn of new links when it receives 1191 a packet carrying a Route Request, Route Reply, or DSR source route. 1192 Likewise, a node removes information from its Route Cache as it 1193 learns that existing links in the ad hoc network have broken; for 1194 example, a node may learn of a broken link when it receives a packet 1195 carrying a Route Error or through the link-layer retransmission 1196 mechanism reporting a failure in forwarding a packet to its next-hop 1197 destination. 1199 Anytime a node adds new information to its Route Cache, the node 1200 SHOULD check each packet in its own Send Buffer (Section 4.2) to 1201 determine whether a route to that packet's IP Destination Address 1202 now exists in the node's Route Cache (including the information just 1203 added to the Cache). If so, the packet SHOULD then be sent using 1204 that route and removed from the Send Buffer. 1206 It is possible to interface a DSR network with other networks, 1207 external to this DSR network. Such external networks may, for 1208 example, be the Internet, or may be other ad hoc networks routed 1209 with a routing protocol other than DSR. Such external networks may 1210 also be other DSR networks that are treated as external networks 1211 in order to improve scalability. The complete handling of such 1212 external networks is beyond the scope of this document. However, 1213 this document specifies a minimal set of requirements and features 1214 necessary to allow nodes only implementing this specification to 1215 interoperate correctly with nodes implementing interfaces to such 1216 external networks. This minimal set of requirements and features 1217 involve the First Hop External (F) and Last Hop External (L) bits 1218 in a DSR Source Route option (Section 6.7) and a Route Reply option 1219 (Section 6.3) in a packet's DSR Options header (Section 6). These 1220 requirements also include the addition of an External flag bit 1221 tagging each link in the Route Cache, copied from the First Hop 1222 External (F) and Last Hop External (L) bits in the DSR Source Route 1223 option or Route Reply option from which this link was learned. 1225 The Route Cache SHOULD support storing more than one route to each 1226 destination. In searching the Route Cache for a route to some 1227 destination node, the Route Cache is indexed by destination node 1228 address. The following properties describe this searching function 1229 on a Route Cache: 1231 - Each implementation of DSR at any node MAY choose any appropriate 1232 strategy and algorithm for searching its Route Cache and 1233 selecting a "best" route to the destination from among those 1234 found. For example, a node MAY choose to select the shortest 1235 route to the destination (the shortest sequence of hops), or it 1236 MAY use an alternate metric to select the route from the Cache. 1238 - However, if there are multiple cached routes to a destination, 1239 the selection of routes when searching the Route Cache MUST 1240 prefer routes that do not have the External flag set on any link. 1241 This preference will select routes that lead directly to the 1242 target node over routes that attempt to reach the target via any 1243 external networks connected to the DSR ad hoc network. 1245 - In addition, any route selected when searching the Route Cache 1246 MUST NOT have the External bit set for any links other than 1247 possibly the first link, the last link, or both; the External bit 1248 MUST NOT be set for any intermediate hops in the route selected. 1250 An implementation of a Route Cache MAY provide a fixed capacity 1251 for the cache, or the cache size MAY be variable. The following 1252 properties describe the management of available space within a node's 1253 Route Cache: 1255 - Each implementation of DSR at each node MAY choose any 1256 appropriate policy for managing the entries in its Route Cache, 1257 such as when limited cache capacity requires a choice of which 1258 entries to retain in the Cache. For example, a node MAY chose a 1259 "least recently used" (LRU) cache replacement policy, in which 1260 the entry last used longest ago is discarded from the cache if a 1261 decision needs to be made to allow space in the cache for some 1262 new entry being added. 1264 - However, the Route Cache replacement policy SHOULD allow routes 1265 to be categorized based upon "preference", where routes with a 1266 higher preferences are less likely to be removed from the cache. 1267 For example, a node could prefer routes for which it initiated 1268 a Route Discovery over routes that it learned as the result of 1269 promiscuous snooping on other packets. In particular, a node 1270 SHOULD prefer routes that it is presently using over those that 1271 it is not. 1273 Any suitable data structure organization, consistent with this 1274 specification, MAY be used to implement the Route Cache in any node. 1275 For example, the following two types of organization are possible: 1277 - In DSR, the route returned in each Route Reply that is received 1278 by the initiator of a Route Discovery (or that is learned from 1279 the header of overhead packets, as described in Section 8.1.4) 1280 represents a complete path (a sequence of links) leading to the 1281 destination node. By caching each of these paths separately, 1282 a "path cache" organization for the Route Cache can be formed. 1283 A path cache is very simple to implement and easily guarantees 1284 that all routes are loop-free, since each individual route from 1285 a Route Reply or Route Request or used in a packet is loop-free. 1286 To search for a route in a path cache data structure, the sending 1287 node can simply search its Route Cache for any path (or prefix of 1288 a path) that leads to the intended destination node. 1290 This type of organization for the Route Cache in DSR has been 1291 extensively studied through simulation [5, 10, 14, 21] and 1292 through implementation of DSR in a mobile outdoor testbed under 1293 significant workload [22, 23, 24]. 1295 - Alternatively, a "link cache" organization could be used for the 1296 Route Cache, in which each individual link (hop) in the routes 1297 returned in Route Reply packets (or otherwise learned from the 1298 header of overhead packets) is added to a unified graph data 1299 structure of this node's current view of the network topology. 1300 To search for a route in link cache, the sending node must use 1301 a more complex graph search algorithm, such as the well-known 1302 Dijkstra's shortest-path algorithm, to find the current best path 1303 through the graph to the destination node. Such an algorithm is 1304 more difficult to implement and may require significantly more 1305 CPU time to execute. 1307 However, a link cache organization is more powerful than a path 1308 cache organization, in its ability to effectively utilize all of 1309 the potential information that a node might learn about the state 1310 of the network. In particular, links learned from different 1311 Route Discoveries or from the header of any overheard packets can 1312 be merged together to form new routes in the network, but this 1313 is not possible in a path cache due to the separation of each 1314 individual path in the cache. 1316 This type of organization for the Route Cache in DSR, including 1317 the effect of a range of implementation choices, has been studied 1318 through detailed simulation [10]. 1320 The choice of data structure organization to use for the Route Cache 1321 in any DSR implementation is a local matter for each node and affects 1322 only performance; any reasonable choice of organization for the Route 1323 Cache does not affect either correctness or interoperability. 1325 Each entry in the Route Cache SHOULD have a timeout associated 1326 with it, to allow that entry to be deleted if not used within some 1327 time. The particular choice of algorithm and data structure used 1328 to implement the Route Cache SHOULD be considered in choosing the 1329 timeout for entries in the Route Cache. The configuration variable 1330 RouteCacheTimeout defined in Section 9 specifies the timeout to be 1331 applied to entries in the Route Cache, although it is also possible 1332 to instead use an adaptive policy in choosing timeout values rather 1333 than using a single timeout setting for all entries; for example, the 1334 Link-MaxLife cache design (below) uses an adaptive timeout algorithm 1335 and does not use the RouteCacheTimeout configuration variable. 1337 As guidance to implementors, Appendix A describes a type of link 1338 cache known as "Link-MaxLife" that has been shown to outperform 1339 other types of link caches and path caches studied in detailed 1340 simulation [10]. Link-MaxLife is an adaptive link cache in which 1341 each link in the cache has a timeout that is determined dynamically 1342 by the caching node according to its observed past behavior of the 1343 two nodes at the ends of the link; in addition, when selecting a 1344 route for a packet being sent to some destination, among cached 1345 routes of equal length (number of hops) to that destination, 1346 Link-MaxLife selects the route with the longest expected lifetime 1347 (highest minimum timeout of any link in the route). Use of 1348 the Link-MaxLife design for the Route Cache is recommended in 1349 implementations of DSR. 1351 4.2. Send Buffer 1353 The Send Buffer of a node implementing DSR is a queue of packets that 1354 cannot be sent by that node because it does not yet have a source 1355 route to each such packet's destination. Each packet in the Send 1356 Buffer is logically associated with the time that it was placed into 1357 the Buffer, and SHOULD be removed from the Send Buffer and silently 1358 discarded after a period of SendBufferTimeout after initially being 1359 placed in the Buffer. If necessary, a FIFO strategy SHOULD be used 1360 to evict packets before they timeout to prevent the buffer from 1361 overflowing. 1363 Subject to the rate limiting defined in Section 4.3, a Route 1364 Discovery SHOULD be initiated as often as possible for the 1365 destination address of any packets residing in the Send Buffer. 1367 4.3. Route Request Table 1369 The Route Request Table of a node implementing DSR records 1370 information about Route Requests that have been recently originated 1371 or forwarded by this node. The table is indexed by IP address. 1373 The Route Request Table on a node records the following information 1374 about nodes to which this node has initiated a Route Request: 1376 - The Time-to-Live (TTL) field used in the IP header of the Route 1377 Request for the last Route Discovery initiated by this node for 1378 that target node. This value allows the node to implement a 1379 variety of algorithms for controlling the spread of its Route 1380 Request on each Route Discovery initiated for a target. As 1381 examples, two possible algorithms for this use of the TTL field 1382 are described in Section 3.3.3. 1384 - The time that this node last originated a Route Request for that 1385 target node. 1387 - The number of consecutive Route Discoveries initiated for this 1388 target since receiving a valid Route Reply giving a route to that 1389 target node. 1391 - The remaining amount of time before which this node MAY next 1392 attempt at a Route Discovery for that target node. When the 1393 node initiates a new Route Discovery for this target node, this 1394 field in the Route Request Table entry for that target node is 1395 initialized to the timeout for that Route Discovery, after which 1396 the node MAY initiate a new Discovery for that target. Until 1397 a valid Route Reply is received for this target node address, 1398 a node MUST implement a back-off algorithm in determining this 1399 timeout value for each successive Route Discovery initiated 1400 for this target using the same Time-to-Live (TTL) value in the 1401 IP header of the Route Request packet. The timeout between 1402 such consecutive Route Discovery initiations SHOULD increase by 1403 doubling the timeout value on each new initiation. 1405 In addition, the Route Request Table on a node also records the 1406 following information about initiator nodes from which this node has 1407 received a Route Request: 1409 - A FIFO cache of size RequestTableIds entries containing the 1410 Identification value and target address from the most recent 1411 Route Requests received by this node from that initiator node. 1413 Nodes SHOULD use an LRU policy to manage the entries in their Route 1414 Request Table. 1416 The number of Identification values to retain in each Route 1417 Request Table entry, RequestTableIds, MUST NOT be unlimited, since, 1418 in the worst case, when a node crashes and reboots, the first 1419 RequestTableIds Route Discoveries it initiates after rebooting 1420 could appear to be duplicates to the other nodes in the network. 1421 In addition, a node SHOULD base its initial Identification value, 1422 used for Route Discoveries after rebooting, on a battery backed-up 1423 clock or other persistent memory device, in order to help avoid 1424 any possible such delay in successfully discovering new routes 1425 after rebooting; if no such source of initial Identification 1426 value is available, a node after rebooting SHOULD base its initial 1427 Identification value on a random number. 1429 4.4. Gratuitous Route Reply Table 1431 The Gratuitous Route Reply Table of a node implementing DSR records 1432 information about "gratuitous" Route Replies sent by this node as 1433 part of automatic route shortening. As described in Section 3.4.3, 1434 a node returns a gratuitous Route Reply when it overhears a packet 1435 transmitted by some node, for which the node overhearing the 1436 packet was not the intended next-hop node but was named later in 1437 the unexpended hops of the source route in that packet; the node 1438 overhearing the packet returns a gratuitous Route Reply to the 1439 original sender of the packet, listing the shorter route (not 1440 including the hops of the source route "skipped over" by this 1441 packet). A node uses its Gratuitous Route Reply Table to limit the 1442 rate at which it originates gratuitous Route Replies to the same 1443 original sender for the same node from which it overheard a packet to 1444 trigger the gratuitous Route Reply. 1446 Each entry in the Gratuitous Route Reply Table of a node contains the 1447 following fields: 1449 - The address of the node to which this node originated a 1450 gratuitous Route Reply. 1452 - The address of the node from which this node overheard the packet 1453 triggering that gratuitous Route Reply. 1455 - The remaining time before which this entry in the Gratuitous 1456 Route Reply Table expires and SHOULD be deleted by the node. 1457 When a node creates a new entry in its Gratuitous Route Reply 1458 Table, the timeout value for that entry should be initialized to 1459 the value GratReplyHoldoff. 1461 When a node overhears a packet that would trigger a gratuitous 1462 Route Reply, if a corresponding entry already exists in the node's 1463 Gratuitous Route Reply Table, then the node SHOULD NOT send a 1464 gratuitous Route Reply for that packet. Otherwise (no corresponding 1465 entry already exists), the node SHOULD create a new entry in its 1466 Gratuitous Route Reply Table to record that gratuitous Route Reply, 1467 with a timeout value of GratReplyHoldoff. 1469 4.5. Network Interface Queue and Maintenance Buffer 1471 Depending on factors such as the structure and organization of 1472 the operating system, protocol stack implementation, network 1473 interface device driver, and network interface hardware, a packet 1474 being transmitted could be queued in a variety of ways. For 1475 example, outgoing packets from the network protocol stack might be 1476 queued at the operating system or link layer, before transmission 1477 by the network interface. The network interface might also 1478 provide a retransmission mechanism for packets, such as occurs in 1479 IEEE 802.11 [13]; the DSR protocol, as part of Route Maintenance, 1480 requires limited buffering of packets already transmitted for 1481 which the reachability of the next-hop destination has not yet been 1482 determined. The operation of DSR is defined here in terms of two 1483 conceptual data structures that together incorporate this queuing 1484 behavior. 1486 The Network Interface Queue of a node implementing DSR is an output 1487 queue of packets from the network protocol stack waiting to be 1488 transmitted by the network interface; for example, in the 4.4BSD 1489 Unix network protocol stack implementation, this queue for a network 1490 interface is represented as a "struct ifqueue" [38]. This queue is 1491 used to hold packets while the network interface is in the process of 1492 transmitting another packet. 1494 The Maintenance Buffer of a node implementing DSR is a queue of 1495 packets sent by this node that are awaiting next-hop reachability 1496 confirmation as part of Route Maintenance. For each packet in 1497 the Maintenance Buffer, a node maintains a count of the number 1498 of retransmissions and the time of the last retransmission. The 1499 Maintenance Buffer MAY be of limited size; when adding a new packet 1500 to the Maintenance Buffer, if the buffer size is insufficient to hold 1501 the new packet, the new packet SHOULD be silently discarded. If, 1502 after MaxMaintRexmt attempts to confirm next-hop reachability of 1503 some node, no confirmation is received, all packets in this node's 1504 Maintenance Buffer with this next-hop destination SHOULD be removed 1505 from the Maintenance Buffer; in this case, the node also SHOULD 1506 originate a Route Error for this packet to each original source of 1507 a packet removed in this way (Section 8.3) and SHOULD salvage each 1508 packet removed in this way (Section 8.3.6) if it has another route 1509 to that packet's IP Destination Address in its Route Cache. The 1510 definition of MaxMaintRexmt conceptually includes any retransmissions 1511 that might be attempted for a packet at the link layer or within 1512 the network interface hardware. The timeout value to use for each 1513 transmission attempt for an acknowledgement request depends on the 1514 type of acknowledgement mechanism used by Route Maintenance for that 1515 attempt, as described in Section 8.3. 1517 4.6. Blacklist 1519 When a node using the DSR protocol is connected through an 1520 interface that requires physically bidirectional links for unicast 1521 transmission, it MUST maintain a Blacklist. The Blacklist is a 1522 table, indexed by neighbor node address, that indicates that the 1523 link between this node and the specified neighbor node may not be 1524 bidirectional. A node places another node's address in this list 1525 when it believes that broadcast packets from that other node reach 1526 this node, but that unicast transmission between the two nodes is not 1527 possible. For example, if a node forwarding a Route Reply discovers 1528 that the next hop is unreachable, it places that next hop in the 1529 node's Blacklist. 1531 Once a node discovers that it can communicate bidirectionally with 1532 one of the nodes listed in the Blacklist, it SHOULD remove that 1533 node from the Blacklist. For example, if node A has node B listed 1534 in its Blacklist, but after transmitting a Route Request, node A 1535 hears B forward the Route Request with a hop list indicating that the 1536 broadcast from A to B was successful, then A SHOULD remove the entry 1537 for node B from its Blacklist. 1539 A node MUST associate a state with each node listed in its Blacklist, 1540 specifying whether the unidirectionality of the link to that node 1541 is "questionable" or "probable". Each time the unreachability is 1542 positively determined, the node SHOULD set the state to "probable". 1543 After the unreachability has not been positively determined for some 1544 amount of time, the state SHOULD revert to "questionable". A node 1545 MAY expire entries for nodes from its Blacklist after a reasonable 1546 amount of time. 1548 5. Additional Conceptual Data Structures for Flow State Extension 1550 This section defines additional conceptual data structures used by 1551 the optional "flow state" extension to DSR. In an implementation of 1552 the protocol, these data structures MAY be implemented in any manner 1553 consistent with the external behavior described in this document. 1555 5.1. Flow Table 1557 A node implementing the flow state extension MUST implement a Flow 1558 Table or other data structure consistent with the external behavior 1559 described in this section. A node not implementing the flow state 1560 extension SHOULD NOT implement a Flow Table. 1562 The Flow Table records information about flows from which packets 1563 recently have been sent or forwarded by this node. The table is 1564 indexed by a triple (IP Source Address, IP Destination Address, 1565 Flow ID), where Flow ID is a 16-bit token assigned by the source as 1566 described in Section 3.5.1. Each entry in the Flow Table contains 1567 the following fields: 1569 - The MAC address of the next-hop node along this flow. 1571 - An indication of the outgoing network interface on this node to 1572 be used in transmitting packets along this flow. 1574 - The MAC address of the previous-hop node along this flow. 1576 - An indication of the network interface on this node from which 1577 packets from that previous-hop node are received. 1579 - A timeout after which this entry in the Flow Table MUST be 1580 deleted. 1582 - The expected value of the Hop Count field in the DSR Flow State 1583 header for packets received for forwarding along this field (for 1584 use with packets containing a DSR Flow State header). 1586 - An indication of whether or not this flow can be used as a 1587 default flow for packets originated by this node (the flow IP 1588 MUST be odd). 1590 - The entry SHOULD record the complete source route for the flow. 1591 (Nodes not recording the complete source route cannot participate 1592 in Automatic Route Shortening.) 1594 - The entry MAY contain a field recording the time this entry was 1595 last used. 1597 The entry MUST be deleted when its timeout expires. 1599 5.2. Automatic Route Shortening Table 1601 A node implementing the flow state extension SHOULD implement an 1602 Automatic Route Shortening Table or other data structure consistent 1603 with the external behavior described in this section. A node 1604 not implementing the flow state extension SHOULD NOT implement an 1605 Automatic Route Shortening Table. 1607 The Automatic Route Shortening Table records information about 1608 received packets for which Automatic Route Shortening may be 1609 possible. The table is indexed by a triple (IP Source Address, IP 1610 Destination Address, Flow ID). Each entry in the Automatic Route 1611 Shortening Table contains a list of (packet identifier, Hop Count) 1612 pairs for that flow. The packet identifier in the list may be any 1613 unique identifier for the received packet; for example, for IPv4 1614 packets, the combination of the following fields from the packet's 1615 IP header MAY be used as a unique identifier for the packet: Source 1616 Address, Destination Address, Identification, Protocol, Fragment, 1617 and Total Length. The Hop Count in the list in the entry is copied 1618 from the Hop Count field in the DSR Flow State header of the received 1619 packet for which this table entry was created. Any packet identifier 1620 SHOULD appear at most once in the list in an entry, and this list 1621 item SHOULD record the minimum Hop Count value received for that 1622 packet (if the wireless signal strength or signal-to-noise ratio at 1623 which a packet is received is available to the DSR implementation 1624 in a node, the node MAY, for example, remember instead in this list 1625 the minimum Hop Count value for which the received packet's signal 1626 strength or signal-to-noise ratio exceeded some threshold). 1628 Space in the Automatic Route Shortening Table of a node MAY be 1629 dynamically managed by any local algorithm at the node. For example, 1630 in order to limit the amount of memory used to store the table, any 1631 existing entry MAY be deleted at any time, and the number of packets 1632 listed in each entry MAY be limited. However, when reclaiming space 1633 in the table, nodes SHOULD favor retaining information about more 1634 flows in the table rather than more packets listed in each entry 1635 in the table, as long as at least the listing of some small number 1636 of packets (e.g., 3) can be retained in each entry. In addition, 1637 subject to any implementation limit on the number of packets listed 1638 in each entry in the table, information about a packet listed in an 1639 entry SHOULD be retained until the expiration of the packet's IP TTL. 1641 5.3. Default Flow ID Table 1643 A node implementing the flow state extension MUST implement a Default 1644 Flow Table or other data structure consistent with the external 1645 behavior described in this section. A node not implementing the flow 1646 state extension SHOULD NOT implement a Default Flow Table. 1648 For each (source, destination) pair for which a node forwards 1649 packets, the node MUST record: 1651 - the largest odd Flow ID value seen 1653 - the time at which all of this (source, destination) pair's flows 1654 that are forwarded by this node expire 1656 - the current default Flow ID 1658 - a flag indicating whether or not the current default Flow ID is 1659 valid 1661 If a node deletes this record for a (source, destination) pair, 1662 it MUST also delete all Flow Table entries for that (source, 1663 destination) pair. Nodes MUST delete table entries if all of this 1664 (source, destination) pair's flows that are forwarded by this node 1665 expire. 1667 6. DSR Options Header Format 1669 The Dynamic Source Routing protocol makes use of a special header 1670 carrying control information that can be included in any existing 1671 IP packet. This DSR Options header in a packet contains a small 1672 fixed-sized, 4-octet portion, followed by a sequence of zero or more 1673 DSR options carrying optional information. The end of the sequence 1674 of DSR options in the DSR Options header is implied by total length 1675 of the DSR Options header. 1677 For IPv4, the DSR Options header MUST immediately follow the IP 1678 header in the packet. (If a Hop-by-Hop Options extension header, as 1679 defined in IPv6 [7], becomes defined for IPv4, the DSR Options header 1680 MUST immediately follow the Hop-by-Hop Options extension header, if 1681 one is present in the packet, and MUST otherwise immediately follow 1682 the IP header.) 1684 To add a DSR Options header to a packet, the DSR Options header is 1685 inserted following the packet's IP header, before any following 1686 header such as a traditional (e.g., TCP or UDP) transport layer 1687 header. Specifically, the Protocol field in the IP header is used 1688 to indicate that a DSR Options header follows the IP header, and the 1689 Next Header field in the DSR Options header is used to indicate the 1690 type of protocol header (such as a transport layer header) following 1691 the DSR Options header. 1693 If any headers follow the DSR Options header in a packet, the total 1694 length of the DSR Options header (and thus the total, combined length 1695 of all DSR options present) MUST be a multiple of 4 octets. This 1696 requirement preserves the alignment of these following headers in the 1697 packet. 1699 6.1. Fixed Portion of DSR Options Header 1701 The fixed portion of the DSR Options header is used to carry 1702 information that must be present in any DSR Options header. This 1703 fixed portion of the DSR Options header has the following format: 1705 0 1 2 3 1706 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 1707 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1708 | Next Header |F| Reserved | Payload Length | 1709 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1710 . . 1711 . Options . 1712 . . 1713 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1715 Next Header 1717 8-bit selector. Identifies the type of header immediately 1718 following the DSR Options header. Uses the same values as the 1719 IPv4 Protocol field [34]. 1721 Flow State Header (F) 1723 Flag bit. MUST be set to 0. This bit is set in a DSR Flow 1724 State header (Section 7.1) and clear in a DSR Options header. 1726 Reserved 1728 MUST be sent as 0 and ignored on reception. 1730 Payload Length 1732 The length of the DSR Options header, excluding the 4-octet 1733 fixed portion. The value of the Payload Length field defines 1734 the total length of all options carried in the DSR Options 1735 header. 1737 Options 1739 Variable-length field; the length of the Options field is 1740 specified by the Payload Length field in this DSR Options 1741 header. Contains one or more pieces of optional information 1742 (DSR options), encoded in type-length-value (TLV) format (with 1743 the exception of the Pad1 option, described in Section 6.8). 1745 The placement of DSR options following the fixed portion of the DSR 1746 Options header MAY be padded for alignment. However, due to the 1747 typically limited available wireless bandwidth in ad hoc networks, 1748 this padding is not required, and receiving nodes MUST NOT expect 1749 options within a DSR Options header to be aligned. 1751 Each DSR option is assigned a unique Option Type code. The most 1752 significant 3 bits (that is, Option Type & 0xE0) allow a node not 1753 implementing processing for this Option Type value to behave in the 1754 manner closest to correct for that type: 1756 - The most significant bit in the Option Type value (that is, 1757 Option Type & 0x80) represents whether or not a node receiving 1758 this Option Type SHOULD respond to such a DSR option with a Route 1759 Error of type OPTION_NOT_SUPPORTED, except that such a Route 1760 Error SHOULD never be sent in response to a packet containing a 1761 Route Request option. 1763 - The two follow bits in the Option Type value (that is, 1764 Option Type & 0x60) are a two-bit field indicating how such a 1765 node that does not support this Option Type MUST process the 1766 packet: 1768 00 = Ignore Option 1769 01 = Remove Option 1770 10 = Mark Option 1771 11 = Drop Packet 1773 When these two bits are zero (that is, Option Type & 0x60 == 0), 1774 a node not implementing processing for that Option Type 1775 MUST use the Opt Data Len field to skip over the option and 1776 continue processing. When these two bits are 01 (that is, 1777 Option Type & 0x60 == 0x20), a node not implementing processing 1778 for that Option Type MUST use the Opt Data Len field to remove 1779 the option from the packet and continue processing as if the 1780 option had not been included in the received packet. When these 1781 two bits are 10 (that is, Option Type & 0x60 == 0x40), a node not 1782 implementing processing for that Option Type MUST set the most 1783 significant bit following the Opt Data Len field, MUST ignore the 1784 contents of the option using the Opt Data Len field, and MUST 1785 continue processing the packet. Finally, when these two bits are 1786 11 (that is, Option Type & 0x60 == 0x60), a node not implementing 1787 processing for that Option Type MUST drop the packet. 1789 The following types of DSR options are defined in this document for 1790 use within a DSR Options header: 1792 - Route Request option (Section 6.2) 1794 - Route Reply option (Section 6.3) 1796 - Route Error option (Section 6.4) 1798 - Acknowledgement Request option (Section 6.5) 1800 - Acknowledgement option (Section 6.6) 1802 - DSR Source Route option (Section 6.7) 1804 - Pad1 option (Section 6.8) 1806 - PadN option (Section 6.9) 1808 In addition, Section 7 specifies further DSR options for use with the 1809 optional DSR flow state extension. 1811 6.2. Route Request Option 1813 The Route Request option in a DSR Options header is encoded as 1814 follows: 1816 0 1 2 3 1817 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 1818 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1819 | Option Type | Opt Data Len | Identification | 1820 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1821 | Target Address | 1822 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1823 | Address[1] | 1824 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1825 | Address[2] | 1826 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1827 | ... | 1828 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1829 | Address[n] | 1830 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1832 IP fields: 1834 Source Address 1836 MUST be set to the address of the node originating this packet. 1837 Intermediate nodes that retransmit the packet to propagate the 1838 Route Request MUST NOT change this field. 1840 Destination Address 1842 MUST be set to the IP limited broadcast address 1843 (255.255.255.255). 1845 Hop Limit (TTL) 1847 MAY be varied from 1 to 255, for example to implement 1848 non-propagating Route Requests and Route Request expanding-ring 1849 searches (Section 3.3.3). 1851 Route Request fields: 1853 Option Type 1855 1. Nodes not understanding this option will ignore this 1856 option. 1858 Opt Data Len 1860 8-bit unsigned integer. Length of the option, in octets, 1861 excluding the Option Type and Opt Data Len fields. 1863 Identification 1865 A unique value generated by the initiator (original sender) of 1866 the Route Request. Nodes initiating a Route Request generate 1867 a new Identification value for each Route Request, for example 1868 based on a sequence number counter of all Route Requests 1869 initiated by the node. 1871 This value allows a receiving node to determine whether it 1872 has recently seen a copy of this Route Request: if this 1873 Identification value is found by this receiving node in its 1874 Route Request Table (in the cache of Identification values 1875 in the entry there for this initiating node), this receiving 1876 node MUST discard the Route Request. When propagating a Route 1877 Request, this field MUST be copied from the received copy of 1878 the Route Request being propagated. 1880 Target Address 1882 The address of the node that is the target of the Route 1883 Request. 1885 Address[1..n] 1887 Address[i] is the address of the i-th node recorded in the 1888 Route Request option. The address given in the Source Address 1889 field in the IP header is the address of the initiator of 1890 the Route Discovery and MUST NOT be listed in the Address[i] 1891 fields; the address given in Address[1] is thus the address 1892 of the first node on the path after the initiator. The 1893 number of addresses present in this field is indicated by the 1894 Opt Data Len field in the option (n = (Opt Data Len - 6) / 4). 1895 Each node propagating the Route Request adds its own address to 1896 this list, increasing the Opt Data Len value by 4 octets. 1898 The Route Request option MUST NOT appear more than once within a DSR 1899 Options header. 1901 6.3. Route Reply Option 1903 The Route Reply option in a DSR Options header is encoded as follows: 1905 0 1 2 3 1906 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 1907 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1908 | Option Type | Opt Data Len |L| Reserved | 1909 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1910 | Address[1] | 1911 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1912 | Address[2] | 1913 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1914 | ... | 1915 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1916 | Address[n] | 1917 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1919 IP fields: 1921 Source Address 1923 Set to the address of the node sending the Route Reply. 1924 In the case of a node sending a reply from its Route 1925 Cache (Section 3.3.2) or sending a gratuitous Route Reply 1926 (Section 3.4.3), this address can differ from the address that 1927 was the target of the Route Discovery. 1929 Destination Address 1931 MUST be set to the address of the source node of the route 1932 being returned. Copied from the Source Address field of the 1933 Route Request generating the Route Reply, or in the case of a 1934 gratuitous Route Reply, copied from the Source Address field of 1935 the data packet triggering the gratuitous Reply. 1937 Route Reply fields: 1939 Option Type 1941 2. Nodes not understanding this option will ignore this 1942 option. 1944 Opt Data Len 1946 8-bit unsigned integer. Length of the option, in octets, 1947 excluding the Option Type and Opt Data Len fields. 1949 Last Hop External (L) 1951 Set to indicate that the last hop given by the Route Reply 1952 (the link from Address[n-1] to Address[n]) is actually an 1953 arbitrary path in a network external to the DSR network; the 1954 exact route outside the DSR network is not represented in the 1955 Route Reply. Nodes caching this hop in their Route Cache MUST 1956 flag the cached hop with the External flag. Such hops MUST NOT 1957 be returned in a cached Route Reply generated from this Route 1958 Cache entry, and selection of routes from the Route Cache to 1959 route a packet being sent MUST prefer routes that contain no 1960 hops flagged as External. 1962 Reserved 1964 MUST be sent as 0 and ignored on reception. 1966 Address[1..n] 1968 The source route being returned by the Route Reply. The route 1969 indicates a sequence of hops, originating at the source node 1970 specified in the Destination Address field of the IP header 1971 of the packet carrying the Route Reply, through each of the 1972 Address[i] nodes in the order listed in the Route Reply, 1973 ending with the destination node indicated by Address[n]. 1974 The number of addresses present in the Address[1..n] 1975 field is indicated by the Opt Data Len field in the option 1976 (n = (Opt Data Len - 1) / 4). 1978 A Route Reply option MAY appear one or more times within a DSR 1979 Options header. 1981 6.4. Route Error Option 1983 The Route Error option in a DSR Options header is encoded as follows: 1985 0 1 2 3 1986 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 1987 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1988 | Option Type | Opt Data Len | Error Type |Reservd|Salvage| 1989 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1990 | Error Source Address | 1991 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1992 | Error Destination Address | 1993 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1994 . . 1995 . Type-Specific Information . 1996 . . 1997 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1999 Option Type 2001 3. Nodes not understanding this option will ignore this 2002 option. 2004 Opt Data Len 2006 8-bit unsigned integer. Length of the option, in octets, 2007 excluding the Option Type and Opt Data Len fields. 2009 For the current definition of the Route Error option, 2010 this field MUST be set to 10, plus the size of any 2011 Type-Specific Information present in the Route Error. Further 2012 extensions to the Route Error option format may also be 2013 included after the Type-Specific Information portion of the 2014 Route Error option specified above. The presence of such 2015 extensions will be indicated by the Opt Data Len field. 2016 When the Opt Data Len is greater than that required for 2017 the fixed portion of the Route Error plus the necessary 2018 Type-Specific Information as indicated by the Option Type 2019 value in the option, the remaining octets are interpreted as 2020 extensions. Currently, no such further extensions have been 2021 defined. 2023 Error Type 2025 The type of error encountered. Currently, the following type 2026 values are defined: 2028 1 = NODE_UNREACHABLE 2029 2 = FLOW_STATE_NOT_SUPPORTED 2030 3 = OPTION_NOT_SUPPORTED 2032 Other values of the Error Type field are reserved for future 2033 use. 2035 Reservd 2037 Reserved. MUST be sent as 0 and ignored on reception. 2039 Salvage 2041 A 4-bit unsigned integer. Copied from the Salvage field in 2042 the DSR Source Route option of the packet triggering the Route 2043 Error. 2045 The "total salvage count" of the Route Error option is derived 2046 from the value in the Salvage field of this Route Error option 2047 and all preceding Route Error options in the packet as follows: 2048 the total salvage count is the sum of, for each such Route 2049 Error option, one plus the value in the Salvage field of that 2050 Route Error option. 2052 Error Source Address 2054 The address of the node originating the Route Error (e.g., the 2055 node that attempted to forward a packet and discovered the link 2056 failure). 2058 Error Destination Address 2060 The address of the node to which the Route Error must be 2061 delivered For example, when the Error Type field is set to 2062 NODE_UNREACHABLE, this field will be set to the address of the 2063 node that generated the routing information claiming that the 2064 hop from the Error Source Address to Unreachable Node Address 2065 (specified in the Type-Specific Information) was a valid hop. 2067 Type-Specific Information 2069 Information specific to the Error Type of this Route Error 2070 message. 2072 A Route Error option MAY appear one or more times within a DSR 2073 Options header. 2075 6.4.1. Node Unreachable Type-Specific Information 2077 When the Route Error is of type NODE_UNREACHABLE, the 2078 Type-Specific Information field is defined as follows: 2080 0 1 2 3 2081 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 2082 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2083 | Unreachable Node Address | 2084 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2086 Unreachable Node Address 2088 The address of the node that was found to be unreachable 2089 (the next-hop neighbor to which the node with address 2090 Error Source Address was attempting to transmit the packet). 2092 6.4.2. Flow State Not Supported Type-Specific Information 2094 When the Route Error is of type FLOW_STATE_NOT_SUPPORTED, the 2095 Type-Specific Information field is empty. 2097 6.4.3. Option Not Supported Type-Specific Information 2099 When the Route Error is of type OPTION_NOT_SUPPORTED, the 2100 Type-Specific Information field is defined as follows: 2102 0 1 2 3 4 5 6 7 2103 +-+-+-+-+-+-+-+-+ 2104 |Unsupported Opt| 2105 +-+-+-+-+-+-+-+-+ 2107 Unsupported Opt 2109 The type of option triggering the Route Error. 2111 6.5. Acknowledgement Request Option 2113 The Acknowledgement Request option in a DSR Options header is encoded 2114 as follows: 2116 0 1 2 3 2117 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 2118 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2119 | Option Type | Opt Data Len | Identification | 2120 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2122 Option Type 2124 160. Nodes not understanding this option will remove the 2125 option and return a Route Error. 2127 Opt Data Len 2129 8-bit unsigned integer. Length of the option, in octets, 2130 excluding the Option Type and Opt Data Len fields. 2132 Identification 2134 The Identification field is set to a unique value and is copied 2135 into the Identification field of the Acknowledgement option 2136 when returned by the node receiving the packet over this hop. 2138 An Acknowledgement Request option MUST NOT appear more than once 2139 within a DSR Options header. 2141 6.6. Acknowledgement Option 2143 The Acknowledgement option in a DSR Options header is encoded as 2144 follows: 2146 0 1 2 3 2147 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 2148 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2149 | Option Type | Opt Data Len | Identification | 2150 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2151 | ACK Source Address | 2152 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2153 | ACK Destination Address | 2154 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2156 Option Type 2158 32. Nodes not understanding this option will remove the 2159 option. 2161 Opt Data Len 2163 8-bit unsigned integer. Length of the option, in octets, 2164 excluding the Option Type and Opt Data Len fields. 2166 Identification 2168 Copied from the Identification field of the Acknowledgement 2169 Request option of the packet being acknowledged. 2171 ACK Source Address 2173 The address of the node originating the acknowledgement. 2175 ACK Destination Address 2177 The address of the node to which the acknowledgement is to be 2178 delivered. 2180 An Acknowledgement option MAY appear one or more times within a DSR 2181 Options header. 2183 6.7. DSR Source Route Option 2185 The DSR Source Route option in a DSR Options header is encoded as 2186 follows: 2188 0 1 2 3 2189 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 2190 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2191 | Option Type | Opt Data Len |F|L|Reservd|Salvage| Segs Left | 2192 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2193 | Address[1] | 2194 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2195 | Address[2] | 2196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2197 | ... | 2198 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2199 | Address[n] | 2200 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2202 Option Type 2204 96. Nodes not understanding this option will drop the packet. 2206 Opt Data Len 2208 8-bit unsigned integer. Length of the option, in octets, 2209 excluding the Option Type and Opt Data Len fields. For the 2210 format of the DSR Source Route option defined here, this field 2211 MUST be set to the value (n * 4) + 2, where n is the number of 2212 addresses present in the Address[i] fields. 2214 First Hop External (F) 2216 Set to indicate that the first hop indicated by the DSR 2217 Source Route option is actually an arbitrary path in a network 2218 external to the DSR network; the exact route outside the DSR 2219 network is not represented in the DSR Source Route option. 2220 Nodes caching this hop in their Route Cache MUST flag the 2221 cached hop with the External flag. Such hops MUST NOT be 2222 returned in a Route Reply generated from this Route Cache 2223 entry, and selection of routes from the Route Cache to route 2224 a packet being sent MUST prefer routes that contain no hops 2225 flagged as External. 2227 Last Hop External (L) 2229 Set to indicate that the last hop indicated by the DSR Source 2230 Route option is actually an arbitrary path in a network 2231 external to the DSR network; the exact route outside the DSR 2232 network is not represented in the DSR Source Route option. 2234 Nodes caching this hop in their Route Cache MUST flag the 2235 cached hop with the External flag. Such hops MUST NOT be 2236 returned in a Route Reply generated from this Route Cache 2237 entry, and selection of routes from the Route Cache to route 2238 a packet being sent MUST prefer routes that contain no hops 2239 flagged as External. 2241 Reserved 2243 MUST be sent as 0 and ignored on reception. 2245 Salvage 2247 A 4-bit unsigned integer. Count of number of times that 2248 this packet has been salvaged as a part of DSR routing 2249 (Section 3.4.1). 2251 Segments Left (Segs Left) 2253 Number of route segments remaining, i.e., number of explicitly 2254 listed intermediate nodes still to be visited before reaching 2255 the final destination. 2257 Address[1..n] 2259 The sequence of addresses of the source route. In routing 2260 and forwarding the packet, the source route is processed as 2261 described in Sections 8.1.3 and 8.1.5. The number of addresses 2262 present in the Address[1..n] field is indicated by the 2263 Opt Data Len field in the option (n = (Opt Data Len - 2) / 4). 2265 When forwarding a packet along a DSR source route using a DSR Source 2266 Route option in the packet's DSR Options header, the Destination 2267 Address field in the packet's IP header is always set to the address 2268 of the packet's ultimate destination. A node receiving a packet 2269 containing a DSR Options header with a DSR Source Route option MUST 2270 examine the indicated source route to determine if it is the intended 2271 next-hop node for the packet and determine how to forward the packet, 2272 as defined in Sections 8.1.4 and 8.1.5. 2274 6.8. Pad1 Option 2276 The Pad1 option in a DSR Options header is encoded as follows: 2278 +-+-+-+-+-+-+-+-+ 2279 | Option Type | 2280 +-+-+-+-+-+-+-+-+ 2282 Option Type 2284 224. Nodes not understanding this option will drop the packet 2285 and return a Route Error. 2287 A Pad1 option MAY be included in the Options field of a DSR Options 2288 header in order to align subsequent DSR options, but such alignment 2289 is not required and MUST NOT be expected by a node receiving a packet 2290 containing a DSR Options header. 2292 If any headers follow the DSR Options header in a packet, the total 2293 length of a DSR Options header, indicated by the Payload Length field 2294 in the DSR Options header MUST be a multiple of 4 octets. In this 2295 case, when building a DSR Options header in a packet, sufficient Pad1 2296 or PadN options MUST be included in the Options field of the DSR 2297 Options header to make the total length a multiple of 4 octets. 2299 If more than one consecutive octet of padding is being inserted in 2300 the Options field of a DSR Options header, the PadN option, described 2301 next, SHOULD be used, rather than multiple Pad1 options. 2303 Note that the format of the Pad1 option is a special case; it does 2304 not have an Opt Data Len or Option Data field. 2306 6.9. PadN Option 2308 The PadN option in a DSR Options header is encoded as follows: 2310 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 2311 | Option Type | Opt Data Len | Option Data 2312 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 2314 Option Type 2316 0. Nodes not understanding this option will ignore this 2317 option. 2319 Opt Data Len 2321 8-bit unsigned integer. Length of the option, in octets, 2322 excluding the Option Type and Opt Data Len fields. 2324 Option Data 2326 A number of zero-valued octets equal to the Opt Data Len. 2328 A PadN option MAY be included in the Options field of a DSR Options 2329 header in order to align subsequent DSR options, but such alignment 2330 is not required and MUST NOT be expected by a node receiving a packet 2331 containing a DSR Options header. 2333 If any headers follow the DSR Options header in a packet, the total 2334 length of a DSR Options header, indicated by the Payload Length field 2335 in the DSR Options header MUST be a multiple of 4 octets. In this 2336 case, when building a DSR Options header in a packet, sufficient Pad1 2337 or PadN options MUST be included in the Options field of the DSR 2338 Options header to make the total length a multiple of 4 octets. 2340 7. Additional Header Formats and Options for Flow State Extension 2342 The optional DSR flow state extension requires a new header type, the 2343 DSR Flow State header. 2345 In addition, the DSR flow state extension adds the following options 2346 for the DSR Options header defined in Section 6: 2348 - Timeout option (Section 7.2.1 2350 - Destination and Flow ID option (Section 7.2.2 2352 Two new Error Type values are also defined for use in the Route Error 2353 option in a DSR Options header: 2355 - Unknown Flow 2357 - Default Flow Unknown 2359 Finally, an extension to the Acknowledgement Request option in a DSR 2360 Options header is also defined: 2362 - Previous Hop Address 2364 This section defines each of these new header or option formats. 2366 7.1. DSR Flow State Header 2368 The DSR Flow State header is a small 4-byte header optionally used 2369 to carry the flow ID and hop count for a packet being sent along a 2370 DSR flow. It is distinguished from the fixed DSR Options header 2371 (Section 6.1) in that the Flow State Header (F) bit is set in the DSR 2372 Flow State header and is clear in the fixed DSR Options header. 2374 0 1 2 3 2375 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 2376 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2377 | Next Header |F| Hop Count | Flow Identifier | 2378 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2380 Next Header 2382 8-bit selector. Identifies the type of header immediately 2383 following the DSR Flow State header. Uses the same values as 2384 the IPv4 Protocol field [34]. 2386 Flow State Header (F) 2388 Flag bit. MUST be set to 1. This bit is set in a DSR Flow 2389 State header and clear in a DSR Options header (Section 6.1). 2391 Hop Count 2393 7-bit unsigned integer. The number of hops through which this 2394 packet has been forwarded. 2396 Flow Identification 2398 The flow ID for this flow, as described in Section 3.5.1. 2400 7.2. New Options and Extensions in DSR Options Header 2402 7.2.1. Timeout Option 2404 The Timeout option is defined for use in a DSR Options header to 2405 indicate the amount of time before the expiration of the flow ID 2406 along which the packet is being sent. 2408 0 1 2 3 2409 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 2410 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2411 | Option Type | Option Length | Timeout | 2412 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2414 Option Type 2416 128. Nodes not understanding this option will ignore the 2417 option and return a Route Error. 2419 Opt Data Len 2421 8-bit unsigned integer. Length of the option, in octets, 2422 excluding the Option Type and Opt Data Len fields. 2424 When no extensions are present, the Opt Data Len of a Timeout 2425 option is 2. Further extensions to DSR may include additional 2426 data in a Timeout option. The presence of such extensions is 2427 indicated by an Opt Data Len greater than 2. Currently, no 2428 such extensions have been defined. 2430 Timeout 2432 The number of seconds for which this flow remains valid. 2434 The Timeout option MUST NOT appear more than once within a DSR 2435 Options header. 2437 7.2.2. Destination and Flow ID Option 2439 The Destination and Flow ID option is defined for use in a DSR 2440 Options header to send a packet to an intermediate host along one 2441 flow, for eventual forwarding to the final destination along a 2442 different flow. This option enables the aggregation of the state of 2443 multiple flows. 2445 0 1 2 3 2446 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 2447 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2448 | Option Type | Option Length | New Flow Identifier | 2449 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2450 | New IP Destination Address | 2451 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2453 Option Type 2455 129. Nodes not understanding this option will ignore the 2456 option and return a Route Error. 2458 Opt Data Len 2460 8-bit unsigned integer. Length of the option, in octets, 2461 excluding the Option Type and Opt Data Len fields. 2463 When no extensions are present, the Opt Data Len of a 2464 Destination and Flow ID option is 6. Further extensions to 2465 DSR may include additional data in a Destination and Flow ID 2466 option. The presence of such extensions is indicated by an 2467 Opt Data Len greater than 6. Currently, no such extensions 2468 have been defined. 2470 New Flow Identifier 2472 Indicates the next identifier to store in the Flow ID field of 2473 the DSR Options header. 2475 New IP Destination Address 2477 Indicates the next address to store in the Destination Address 2478 field of the IP header. 2480 The Destination and Flow ID option MAY appear one or more times 2481 within a DSR Options header. 2483 7.3. New Error Types for Route Error Option 2485 7.3.1. Unknown Flow Type-Specific Information 2487 A new Error Type value of 129 (Unknown Flow) is defined for use in 2488 a Route Error option in a DSR Options header. The Type-Specific 2489 Information for errors of this type is encoded as follows: 2491 0 1 2 3 2492 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 2493 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2494 | Original IP Destination Address | 2495 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2496 | Flow ID | 2497 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2499 Original IP Destination Address 2501 The IP Destination Address of the packet that caused the error. 2503 Flow ID 2505 The Flow ID contained in the DSR Flow ID option that caused the 2506 error. 2508 7.3.2. Default Flow Unknown Type-Specific Information 2510 A new Error Type value of 130 (Default Flow Unknown) is defined 2511 for use in a Route Error option in a DSR Options header. The 2512 Type-Specific Information for errors of this type is encoded as 2513 follows: 2515 0 1 2 3 2516 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 2517 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2518 | Original IP Destination Address | 2519 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2521 Original IP Destination Address 2523 The IP Destination Address of the packet that caused the error. 2525 7.4. New Acknowledgement Request Option Extension 2527 7.4.1. Previous Hop Address Extension 2529 When the Option Length field of an Acknowledgement Request option 2530 in a DSR Options header is greater than or equal to 6, a Previous 2531 Hop Address Extension is present. The option is then formatted as 2532 follows: 2534 0 1 2 3 2535 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 2536 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2537 | Option Type | Option Length | Packet Identifier | 2538 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2539 | ACK Request Source Address | 2540 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2542 Option Type 2544 5 2546 Option Length 2548 8-bit unsigned integer. Length of the option, in octets, 2549 excluding the Option Type and Option Length fields. 2551 When no extensions are presents, the Option Length of a 2552 Acknowledgement Request option is 2. Further extensions to 2553 DSR may include additional data in a Acknowledgement Request 2554 option. The presence of such extensions is indicated by an 2555 Opt Data Len greater than 2. 2557 Currently, one such extension has been defined. If the 2558 Option Length is at least 6, then a ACK Request Source Address 2559 is present. 2561 Packet Identifier 2563 The Packet Identifier field is set to a unique number and is 2564 copied into the Identification field of the DSR Acknowledgement 2565 option when returned by the node receiving the packet over this 2566 hop. 2568 ACK Request Source Address 2570 The address of the node requesting the DSR Acknowledgement. 2572 8. Detailed Operation 2574 8.1. General Packet Processing 2576 8.1.1. Originating a Packet 2578 When originating any packet, a node using DSR routing MUST perform 2579 the following sequence of steps: 2581 - Search the node's Route Cache for a route to the address given in 2582 the IP Destination Address field in the packet's header. 2584 - If no such route is found in the Route Cache, then perform 2585 Route Discovery for the Destination Address, as described in 2586 Section 8.2. Initiating a Route Discovery for this target node 2587 address results in the node adding a Route Request option in 2588 a DSR Options header in this existing packet, or saving this 2589 existing packet to its Send Buffer and initiating the Route 2590 Discovery by sending a separate packet containing such a Route 2591 Request option. If the node chooses to initiate the Route 2592 Discovery by adding the Route Request option to this existing 2593 packet, it will replace the IP Destination Address field with the 2594 IP "limited broadcast" address (255.255.255.255) [3], copying the 2595 original IP Destination Address to the Target Address field of 2596 the new Route Request option added to the packet, as described in 2597 Section 8.2.1. 2599 - If the packet now does not contain a Route Request option, 2600 then this node must have a route to the Destination Address 2601 of the packet; if the node has more than one route to this 2602 Destination Address, the node selects one to use for this packet. 2603 If the length of this route is greater than 1 hop, or if the 2604 node determines to request a DSR network-layer acknowledgement 2605 from the first-hop node in that route, then insert a DSR Options 2606 header into the packet, as described in Section 8.1.2, and insert 2607 a DSR Source Route option, as described in Section 8.1.3. The 2608 source route in the packet is initialized from the selected route 2609 to the Destination Address of the packet. 2611 - Transmit the packet to the first-hop node address given in 2612 selected source route, using Route Maintenance to determine the 2613 reachability of the next hop, as described in Section 8.3. 2615 8.1.2. Adding a DSR Options Header to a Packet 2617 A node originating a packet adds a DSR Options header to the packet, 2618 if necessary, to carry information needed by the routing protocol. 2619 A packet MUST NOT contain more than one DSR Options header. A DSR 2620 Options header is added to a packet by performing the following 2621 sequence of steps (these steps assume that the packet contains no 2622 other headers that MUST be located in the packet before the DSR 2623 Options header): 2625 - Insert a DSR Options header after the IP header but before any 2626 other header that may be present. 2628 - Set the Next Header field of the DSR Options header to the 2629 Protocol number field of the packet's IP header. 2631 - Set the Protocol field of the packet's IP header to the Protocol 2632 number assigned for DSR (TBA???). 2634 8.1.3. Adding a DSR Source Route Option to a Packet 2636 A node originating a packet adds a DSR Source Route option to the 2637 packet, if necessary, in order to carry the source route from this 2638 originating node to the final destination address of the packet. 2639 Specifically, the node adding the DSR Source Route option constructs 2640 the DSR Source Route option and modifies the IP packet according to 2641 the following sequence of steps: 2643 - The node creates a DSR Source Route option, as described 2644 in Section 6.7, and appends it to the DSR Options header in 2645 the packet. (A DSR Options header is added, as described in 2646 Section 8.1.2, if not already present.) 2648 - The number of Address[i] fields to include in the DSR Source 2649 Route option (n) is the number of intermediate nodes in the 2650 source route for the packet (i.e., excluding address of the 2651 originating node and the final destination address of the 2652 packet). The Segments Left field in the DSR Source Route option 2653 is initialized equal to n. 2655 - The addresses within the source route for the packet are copied 2656 into sequential Address[i] fields in the DSR Source Route option, 2657 for i = 1, 2, ..., n. 2659 - The First Hop External (F) bit in the DSR Source Route option is 2660 copied from the External bit flagging the first hop in the source 2661 route for the packet, as indicated in the Route Cache. 2663 - The Last Hop External (L) bit in the DSR Source Route option is 2664 copied from the External bit flagging the last hop in the source 2665 route for the packet, as indicated in the Route Cache. 2667 - The Salvage field in the DSR Source Route option is 2668 initialized to 0. 2670 8.1.4. Processing a Received Packet 2672 When a node receives any packet (whether for forwarding, overheard, 2673 or as the final destination of the packet), if that packet contains 2674 a DSR Options header, then that node MUST process any options 2675 contained in that DSR Options header, in the order contained there. 2676 Specifically: 2678 - If the DSR Options header contains a Route Request option, the 2679 node SHOULD extract the source route from the Route Request and 2680 add this routing information to its Route Cache, subject to the 2681 conditions identified in Section 3.3.1. The routing information 2682 from the Route Request is the sequence of hop addresses 2684 initiator, Address[1], Address[2], ..., Address[n] 2686 where initiator is the value of the Source Address field in 2687 the IP header of the packet carrying the Route Request (the 2688 address of the initiator of the Route Discovery), and each 2689 Address[i] is a node through which this Route Request has passed, 2690 in turn, during this Route Discovery. The value n here is the 2691 number of addresses recorded in the Route Request option, or 2692 (Opt Data Len - 6) / 4. 2694 After possibly updating the node's Route Cache in response to 2695 the routing information in the Route Request option, the node 2696 MUST then process the Route Request option as described in 2697 Section 8.2.2. 2699 - If the DSR Options header contains a Route Reply option, the node 2700 SHOULD extract the source route from the Route Reply and add this 2701 routing information to its Route Cache, subject to the conditions 2702 identified in Section 3.3.1. The source route from the Route 2703 Reply is the sequence of hop addresses 2705 initiator, Address[1], Address[2], ..., Address[n] 2707 where initiator is the value of the Destination Address field in 2708 the IP header of the packet carrying the Route Reply (the address 2709 of the initiator of the Route Discovery), and each Address[i] 2710 is a node through which the source route passes, in turn, on 2711 the route to the target of the Route Discovery. Address[n] is 2712 the address of the target. If the Last Hop External (L) bit is 2713 set in the Route Reply, the node MUST flag the last hop from 2714 the Route Reply (the link from Address[n-1] to Address[n]) in 2715 its Route Cache as External. The value n here is the number of 2716 addresses in the source route being returned in the Route Reply 2717 option, or (Opt Data Len - 1) / 4. 2719 After possibly updating the node's Route Cache in response to 2720 the routing information in the Route Reply option, then if the 2721 packet's IP Destination Address matches one of this node's IP 2722 addresses, the node MUST then process the Route Reply option as 2723 described in Section 8.2.6. 2725 - If the DSR Options header contains a Route Error option, 2726 the node MUST process the Route Error option as described in 2727 Section 8.3.5. 2729 - If the DSR Options header contains an Acknowledgement Request 2730 option, the node MUST process the Acknowledgement Request option 2731 as described in Section 8.3.3. 2733 - If the DSR Options header contains an Acknowledgement option, 2734 then subject to the conditions identified in Section 3.3.1, the 2735 node SHOULD add to its Route Cache the single link from the node 2736 identified by the ACK Source Address field to the node identified 2737 by the ACK Destination Address field. 2739 After possibly updating the node's Route Cache in response to 2740 the routing information in the Acknowledgement option, the node 2741 MUST then process the Acknowledgement option as described in 2742 Section 8.3.3. 2744 - If the DSR Options header contains a DSR Source Route option, the 2745 node SHOULD extract the source route from the DSR Source Route 2746 and add this routing information to its Route Cache, subject to 2747 the conditions identified in Section 3.3.1. If the value of the 2748 Salvage field in the DSR Source Route option is zero, then the 2749 routing information from the DSR Source Route is the sequence of 2750 hop addresses 2752 source, Address[1], Address[2], ..., Address[n], destination 2754 and otherwise (Salvage is nonzero), the routing information from 2755 the DSR Source Route is the sequence of hop addresses 2757 Address[1], Address[2], ..., Address[n], destination 2759 where source is the value of the Source Address field in the IP 2760 header of the packet carrying the DSR Source Route option (the 2761 original sender of the packet), each Address[i] is the value in 2762 the Address[i] field in the DSR Source Route, and destination is 2763 the value of the Destination Address field in the packet's IP 2764 header (the last-hop address of the source route). The value n 2765 here is the number of addresses in source route in the DSR Source 2766 Route option, or (Opt Data Len - 2) / 4. 2768 After possibly updating the node's Route Cache in response to 2769 the routing information in the DSR Source Route option, the node 2770 MUST then process the DSR Source Route option as described in 2771 Section 8.1.5. 2773 - Any Pad1 or PadN options in the DSR Options header are ignored. 2775 Finally, if the Destination Address in the packet's IP header matches 2776 one of this receiving node's own IP address(es), remove the DSR 2777 Options header and all the included DSR options in the header, and 2778 pass the rest of the packet to the network layer. 2780 8.1.5. Processing a Received DSR Source Route Option 2782 When a node receives a packet containing a DSR Source Route option 2783 (whether for forwarding, overheard, or as the final destination of 2784 the packet), that node SHOULD examine the packet to determine if 2785 the receipt of that packet indicates an opportunity for automatic 2786 route shortening, as described in Section 3.4.3. Specifically, if 2787 this node is not the intended next-hop destination for the packet 2788 but is named in the later unexpended portion of the source route in 2789 the packet's DSR Source Route option, then this packet indicates an 2790 opportunity for automatic route shortening: the intermediate nodes 2791 after the node from which this node overheard the packet and before 2792 this node itself, are no longer necessary in the source route. In 2793 this case, this node SHOULD perform the following sequence of steps 2794 as part of automatic route shortening: 2796 - The node searches its Gratuitous Route Reply Table for an entry 2797 describing a gratuitous Route Reply earlier sent by this node, 2798 for which the original sender of the packet triggering the 2799 gratuitous Route Reply and the transmitting node from which this 2800 node overheard that packet in order to trigger the gratuitous 2801 Route Reply, both match the respective node addresses for this 2802 new received packet. If such an entry is found in the node's 2803 Gratuitous Route Reply Table, the node SHOULD NOT perform 2804 automatic route shortening in response to this receipt of this 2805 packet. 2807 - Otherwise, the node creates an entry for this overheard packet in 2808 its Gratuitous Route Reply Table. The timeout value for this new 2809 entry SHOULD be initialized to the value GratReplyHoldoff. After 2810 this timeout has expired, the node SHOULD delete this entry from 2811 its Gratuitous Route Reply Table. 2813 - After creating the new Gratuitous Route Reply Table entry 2814 above, the node originates a gratuitous Route Reply to the 2815 IP Source Address of this overheard packet, as described in 2816 Section 3.4.3. 2818 If the MAC protocol in use in the network is not capable of 2819 transmitting unicast packets over unidirectional links, as 2820 discussed in Section 3.3.1, then in originating this Route Reply, 2821 the node MUST use a source route for routing the Route Reply 2822 packet that is obtained by reversing the sequence of hops over 2823 which the packet triggering the gratuitous Route Reply was routed 2824 in reaching and being overheard by this node; this reversing of 2825 the route uses the gratuitous Route Reply to test this sequence 2826 of hops for bidirectionality, preventing the gratuitous Route 2827 Reply from being received by the initiator of the Route Discovery 2828 unless each of the hops over which the gratuitous Route Reply is 2829 returned is bidirectional. 2831 - Discard the overheard packet, since the packet has been received 2832 before its normal traversal of the packet's source route would 2833 have caused it to reach this receiving node. Another copy of 2834 the packet will normally arrive at this node as indicated in 2835 the packet's source route; discarding this initial copy of the 2836 packet, which triggered the gratuitous Route Reply, will prevent 2837 the duplication of this packet that would otherwise occur. 2839 If the packet is not discarded as part of automatic route shortening 2840 above, then the node MUST process the Source Route option according 2841 to the following sequence of steps: 2843 - If the value of the Segments Left field in the DSR Source Route 2844 option equals 0, then remove the DSR Source Route option from the 2845 DSR Options header. 2847 - Else, let n equal (Opt Data Len - 2) / 4. This is the number of 2848 addresses in the DSR Source Route option. 2850 - If the value of the Segments Left field is greater than n, then 2851 send an ICMP Parameter Problem, Code 0, message [31] to the IP 2852 Source Address, pointing to the Segments Left field, and discard 2853 the packet. Do not process the DSR Source Route option further. 2855 - Else, decrement the value of the Segments Left field by 1. Let i 2856 equal n minus Segments Left. This is the index of the next 2857 address to be visited in the Address vector. 2859 - If Address[i] or the IP Destination Address is a multicast 2860 address, then discard the packet. Do not process the DSR Source 2861 Route option further. 2863 - If this node has more than one network interface and if 2864 Address[i] is the address of one this node's network interfaces, 2865 then this indicates a change in the network interface to use in 2866 forwarding the packet, as described in Section 8.4. In this 2867 case, decrement the value of the Segments Left field by 1 to 2868 skip over this address (that indicated the change of network 2869 interface) and go to the first step above (checking the value of 2870 the Segments Left field) to continue processing this Source Route 2871 option; in further processing of this Source Route option, the 2872 indicated new network interface MUST be used in forwarding the 2873 packet. 2875 - If the MTU of the link over which this node would transmit 2876 the packet to forward it to the node Address[i] is less than 2877 the size of the packet, the node MUST either discard the 2878 packet and send an ICMP Packet Too Big message to the packet's 2879 Source Address [31] or fragment it as specified in Section 8.5. 2881 - Forward the packet to the IP address specified in the Address[i] 2882 field of the IP header, following normal IP forwarding 2883 procedures, including checking and decrementing the Time-to-Live 2884 (TTL) field in the packet's IP header [32, 3]. In this 2885 forwarding of the packet, the next-hop node (identified by 2886 Address[i]) MUST be treated as a direct neighbor node: the 2887 transmission to that next node MUST be done in a single IP 2888 forwarding hop, without Route Discovery and without searching the 2889 Route Cache. 2891 - In forwarding the packet, perform Route Maintenance for the 2892 next hop of the packet, by verifying that the next-hop node is 2893 reachable, as described in Section 8.3. 2895 Multicast addresses MUST NOT appear in a DSR Source Route option or 2896 in the IP Destination Address field of a packet carrying a DSR Source 2897 Route option in a DSR Options header. 2899 8.1.6. Handling an Unknown DSR Option 2901 Nodes implementing DSR MUST handle all options specified in this 2902 document, except those options pertaining to the optional flow 2903 state extension (Section 7). However, further extensions to 2904 DSR may include other option types that may not be understood by 2905 implementations conforming to this version of the DSR specification. 2906 In DSR, Option Type codes encode required behavior for nodes not 2907 implementing that type of option. These behaviors are included in 2908 the most significant three bits of the Option Type. 2910 If the most significant bit of the Option Type is set (that is, 2911 Option Type & 0x80 is nonzero), and this packet does not contain 2912 a Route Request option, a node SHOULD return a Route Error to the 2913 IP Source Address, following the steps described in Section 8.3.4, 2914 except that the Error Type MUST be set to OPTION_NOT_SUPPORTED and 2915 the Unsupported Opt field MUST be set to the Option Type triggering 2916 the Route Error. 2918 Whether or not a Route Error is sent in response to this DSR option, 2919 as described above, the node also MUST examine the next two most 2920 significant bits (that is, Option Type & 0x60): 2922 - When these two bits are zero (that is, Option Type & 0x60 == 0), 2923 a node not implementing processing for that Option Type MUST 2924 use the Opt Data Len field to skip over the option and continue 2925 processing. 2927 - When these two bits are 01 (that is, Option Type & 0x60 == 0x20), 2928 a node not implementing processing for that Option Type MUST use 2929 the Opt Data Len field to remove the option from the packet and 2930 continue processing as if the option had not been included in the 2931 received packet. 2933 - When these two bits are 10 (that is, Option Type & 0x60 == 0x40), 2934 a node not implementing processing for that Option Type MUST set 2935 the most significant bit following the Opt Data Len field; in 2936 addition, the node MUST then ignore the contents of the option 2937 using the Opt Data Len field, and MUST continue processing the 2938 packet. 2940 - Finally, when these two bits are 11 (that is, 2941 Option Type & 0x60 == 0x60), a node not implementing processing 2942 for that Option Type MUST drop the packet. 2944 8.2. Route Discovery Processing 2946 Route Discovery is the mechanism by which a node S wishing to send a 2947 packet to a destination node D obtains a source route to D. Route 2948 Discovery is used only when S attempts to send a packet to D and 2949 does not already know a route to D. The node initiating a Route 2950 Discovery is known as the "initiator" of the Route Discovery, and the 2951 destination node for which the Route Discovery is initiated is known 2952 as the "target" of the Route Discovery. 2954 Route Discovery operates entirely on demand, with a node initiating 2955 Route Discovery based on its own origination of new packets for 2956 some destination address to which it does not currently know a 2957 route. Route Discovery does not depend on any periodic or background 2958 exchange of routing information or neighbor node detection at any 2959 layer in the network protocol stack at any node. 2961 The Route Discovery procedure utilizes two types of messages, a Route 2962 Request (Section 6.2) and a Route Reply (Section 6.3), to actively 2963 search the ad hoc network for a route to the desired destination. 2964 These DSR messages MAY be carried in any type of IP packet, through 2965 use of the DSR Options header as described in Section 6. 2967 Except as discussed in Section 8.3.5, a Route Discovery for a 2968 destination address SHOULD NOT be initiated unless the initiating 2969 node has a packet in its Send Buffer requiring delivery to that 2970 destination. A Route Discovery for a given target node MUST NOT be 2971 initiated unless permitted by the rate-limiting information contained 2972 in the Route Request Table. After each Route Discovery attempt, the 2973 interval between successive Route Discoveries for this target SHOULD 2974 be doubled, up to a maximum of MaxRequestPeriod, until a valid Route 2975 Reply is received for this target. 2977 8.2.1. Originating a Route Request 2979 A node initiating a Route Discovery for some target creates and 2980 initializes a Route Request option in a DSR Options header in some 2981 IP packet. This MAY be a separate IP packet, used only to carry 2982 this Route Request option, or the node MAY include the Route Request 2983 option in some existing packet that it needs to send to the target 2984 node (e.g., the IP packet originated by this node, that caused the 2985 node to attempt Route Discovery for the destination address of the 2986 packet). The Route Request option MUST be included in a DSR Options 2987 header in the packet. To initialize the Route Request option, the 2988 node performs the following sequence of steps: 2990 - The Option Type in the option MUST be set to the value 2. 2992 - The Opt Data Len field in the option MUST be set to the value 6. 2993 The total size of the Route Request option when initiated 2994 is 8 octets; the Opt Data Len field excludes the size of the 2995 Option Type and Opt Data Len fields themselves. 2997 - The Identification field in the option MUST be set to a new 2998 value, different from that used for other Route Requests recently 2999 initiated by this node for this same target address. For 3000 example, each node MAY maintain a single counter value for 3001 generating a new Identification value for each Route Request it 3002 initiates. 3004 - The Target Address field in the option MUST be set to the IP 3005 address that is the target of this Route Discovery. 3007 The Source Address in the IP header of this packet MUST be the node's 3008 own IP address. The Destination Address in the IP header of this 3009 packet MUST be the IP "limited broadcast" address (255.255.255.255). 3011 A node MUST maintain in its Route Request Table, information about 3012 Route Requests that it initiates. When initiating a new Route 3013 Request, the node MUST use the information recorded in the Route 3014 Request Table entry for the target of that Route Request, and it MUST 3015 update that information in the table entry for use in the next Route 3016 Request initiated for this target. In particular: 3018 - The Route Request Table entry for a target node records the 3019 Time-to-Live (TTL) field used in the IP header of the Route 3020 Request for the last Route Discovery initiated by this node for 3021 that target node. This value allows the node to implement a 3022 variety of algorithms for controlling the spread of its Route 3023 Request on each Route Discovery initiated for a target. As 3024 examples, two possible algorithms for this use of the TTL field 3025 are described in Section 3.3.3. 3027 - The Route Request Table entry for a target node records the 3028 number of consecutive Route Requests initiated for this target 3029 since receiving a valid Route Reply giving a route to that target 3030 node, and the remaining amount of time before which this node MAY 3031 next attempt at a Route Discovery for that target node. 3033 A node MUST use these values to implement a back-off algorithm to 3034 limit the rate at which this node initiates new Route Discoveries 3035 for the same target address. In particular, until a valid Route 3036 Reply is received for this target node address, the timeout 3037 between consecutive Route Discovery initiations for this target 3038 node with the same hop limit SHOULD increase by doubling the 3039 timeout value on each new initiation. 3041 The behavior of a node processing a packet containing DSR Options 3042 header with both a DSR Source Route option and a Route Request option 3043 is unspecified. Packets SHOULD NOT contain both a DSR Source Route 3044 option and a Route Request option. 3046 Packets containing a Route Request option SHOULD NOT include 3047 an Acknowledgement Request option, SHOULD NOT expect link-layer 3048 acknowledgement or passive acknowledgement, and SHOULD NOT be 3049 retransmitted. The retransmission of packets containing a Route 3050 Request option is controlled solely by the logic described in this 3051 section. 3053 8.2.2. Processing a Received Route Request Option 3055 When a node receives a packet containing a Route Request option, that 3056 node MUST process the option according to the following sequence of 3057 steps: 3059 - If the Target Address field in the Route Request matches this 3060 node's own IP address, then the node SHOULD return a Route Reply 3061 to the initiator of this Route Request (the Source Address in the 3062 IP header of the packet), as described in Section 8.2.4. The 3063 source route for this Reply is the sequence of hop addresses 3065 initiator, Address[1], Address[2], ..., Address[n], target 3067 where initiator is the address of the initiator of this 3068 Route Request, each Address[i] is an address from the Route 3069 Request, and target is the target of the Route Request (the 3070 Target Address field in the Route Request). The value n here 3071 is the number of addresses recorded in the Route Request, or 3072 (Opt Data Len - 6) / 4. 3074 The node then MUST replace the Destination Address field in 3075 the Route Request packet's IP header with the value in the 3076 Target Address field in the Route Request option, and continue 3077 processing the rest of the Route Request packet normally. The 3078 node MUST NOT process the Route Request option further and MUST 3079 NOT retransmit the Route Request to propagate it to other nodes 3080 as part of the Route Discovery. 3082 - Else, the node MUST examine the route recorded in the Route 3083 Request option (the IP Source Address field and the sequence of 3084 Address[i] fields) to determine if this node's own IP address 3085 already appears in this list of addresses. If so, the node MUST 3086 discard the entire packet carrying the Route Request option. 3088 - Else, if the Route Request was received through a network 3089 interface that requires physically bidirectional links for 3090 unicast transmission, the node MUST check if the Route Request 3091 was last forwarded by a node on its Blacklist (Section 4.6). 3092 If such an entry is found in the Blacklist, and the state of 3093 the unidirectional link is "probable", then the Request MUST be 3094 silently discarded. 3096 - Else, if the Route Request was received through a network 3097 interface that requires physically bidirectional links for 3098 unicast transmission, the node MUST check if the Route Request 3099 was last forwarded by a node on its Blacklist. If such an entry 3100 is found in the Blacklist, and the state of the unidirectional 3101 link is "questionable", then the node MUST create and unicast 3102 a Route Request packet to that previous node, setting the 3103 IP Time-To-Live (TTL) to 1 to prevent the Request from being 3104 propagated. If the node receives a Route Reply in response to 3105 the new Request, it MUST remove the Blacklist entry for that 3106 node, and SHOULD continue processing. If the node does not 3107 receive a Route Reply within some reasonable amount of time, the 3108 node MUST silently discard the Route Request packet. 3110 - Else, the node MUST search its Route Request Table for an entry 3111 for the initiator of this Route Request (the IP Source Address 3112 field). If such an entry is found in the table, the node MUST 3113 search the cache of Identification values of recently received 3114 Route Requests in that table entry, to determine if an entry 3115 is present in the cache matching the Identification value 3116 and target node address in this Route Request. If such an 3117 (Identification, target address) entry is found in this cache in 3118 this entry in the Route Request Table, then the node MUST discard 3119 the entire packet carrying the Route Request option. 3121 - Else, this node SHOULD further process the Route Request 3122 according to the following sequence of steps: 3124 o Add an entry for this Route Request in its cache of 3125 (Identification, target address) values of recently received 3126 Route Requests. 3128 o Conceptually create a copy of this entire packet and perform 3129 the following steps on the copy of the packet. 3131 o Append this node's own IP address to the list of Address[i] 3132 values in the Route Request, and increase the value of the 3133 Opt Data Len field in the Route Request by 4 (the size of 3134 an IP address). However, if the node has multiple network 3135 interfaces, this step MUST be modified by the special 3136 processing specified in Section sec:multiple. 3138 o This node SHOULD search its own Route Cache for a route 3139 (from itself, as if it were the source of a packet) to the 3140 target of this Route Request. If such a route is found in 3141 its Route Cache, then this node SHOULD follow the procedure 3142 outlined in Section 8.2.3 to return a "cached Route Reply" 3143 to the initiator of this Route Request, if permitted by the 3144 restrictions specified there. 3146 o If the node does not return a cached Route Reply, then this 3147 node SHOULD transmit this copy of the packet as a link-layer 3148 broadcast, with a short jitter delay before the broadcast is 3149 sent. The jitter period SHOULD be chosen as a random period, 3150 uniformly distributed between 0 and BroadcastJitter. 3152 8.2.3. Generating a Route Reply using the Route Cache 3154 As described in Section 3.3.2, it is possible for a node processing a 3155 received Route Request to avoid propagating the Route Request further 3156 toward the target of the Request, if this node has in its Route Cache 3157 a route from itself to this target. Such a Route Reply generated by 3158 a node from its own cached route to the target of a Route Request is 3159 called a "cached Route Reply", and this mechanism can greatly reduce 3160 the overall overhead of Route Discovery on the network by reducing 3161 the flood of Route Requests. The general processing of a received 3162 Route Request is described in Section 8.2.2; this section specifies 3163 the additional requirements that MUST be met before a cached Route 3164 Reply may be generated and returned and specifies the procedure for 3165 returning such a cached Route Reply. 3167 While processing a received Route Request, for a node to possibly 3168 return a cached Route Reply, it MUST have in its Route Cache a route 3169 from itself to the target of this Route Request. However, before 3170 generating a cached Route Reply for this Route Request, the node MUST 3171 verify that there are no duplicate addresses listed in the route 3172 accumulated in the Route Request together with the route from this 3173 node's Route Cache. Specifically, there MUST be no duplicates among 3174 the following addresses: 3176 - The IP Source Address of the packet containing the Route Request, 3178 - The Address[i] fields in the Route Request, and 3180 - The nodes listed in the route obtained from this node's Route 3181 Cache, excluding the address of this node itself (this node 3182 itself is the common point between the route accumulated in the 3183 Route Request and the route obtained from the Route Cache). 3185 If any duplicates exist among these addresses, then the node MUST NOT 3186 send a cached Route Reply. The node SHOULD continue to process the 3187 Route Request as described in Section 8.2.2. 3189 If the Route Request and the route from the Route Cache meet the 3190 restriction above, then the node SHOULD construct and return a cached 3191 Route Reply as follows: 3193 - The source route for this reply is the sequence of hop addresses 3195 initiator, Address[1], Address[2], ..., Address[n], c-route 3197 where initiator is the address of the initiator of this Route 3198 Request, each Address[i] is an address from the Route Request, 3199 and c-route is the sequence of hop addresses in the source route 3200 to this target node, obtained from the node's Route Cache. In 3201 appending this cached route to the source route for the reply, 3202 the address of this node itself MUST be excluded, since it is 3203 already listed as Address[n]. 3205 - Send a Route Reply to the initiator of the Route Request, using 3206 the procedure defined in Section 8.2.4. The initiator of the 3207 Route Request is indicated in the Source Address field in the 3208 packet's IP header. 3210 Before sending the cached Route Reply, however, the node MAY delay 3211 the Reply in order to help prevent a possible Route Reply "storm", as 3212 described in Section 8.2.5. 3214 If the node returns a cached Route Reply as described above, 3215 then the node MUST NOT propagate the Route Request further (i.e., 3216 the node MUST NOT rebroadcast the Route Request). In this case, 3217 instead, if the packet contains no other DSR options and contains 3218 no payload after the DSR Options header (e.g., the Route Request is 3219 not piggybacked on a TCP or UDP packet), then the node SHOULD simply 3220 discard the packet. Otherwise (if the packet contains other DSR 3221 options or contains any payload after the DSR Options header), the 3222 node SHOULD forward the packet along the cached route to the target 3223 of the Route Request. Specifically, if the node does so, it MUST use 3224 the following steps: 3226 - Copy the Target Address from the Route Request option in the DSR 3227 Options header to the Destination Address field in the packet's 3228 IP header. 3230 - Remove the Route Request option from the DSR Options header in 3231 the packet, and add a DSR Source Route option to the packet's DSR 3232 Options header. 3234 - In the DSR Source Route option, set the Address[i] fields 3235 to represent the source route found in this node's Route 3236 Cache to the original target of the Route Discovery (the 3237 new IP Destination Address of the packet). Specifically, 3238 the node copies the hop addresses of the source route into 3239 sequential Address[i] fields in the DSR Source Route option, 3240 for i = 1, 2, ..., n. Address[1] here is the address of this 3241 node itself (the first address in the source route found from 3242 this node to the original target of the Route Discovery). The 3243 value n here is the number of hop addresses in this source route, 3244 excluding the destination of the packet (which is instead already 3245 represented in the Destination Address field in the packet's IP 3246 header). 3248 - Initialize the Segments Left field in the DSR Source Route option 3249 to n as defined above. 3251 - The First Hop External (F) bit in the DSR Source Route option is 3252 copied from the External bit flagging the first hop in the source 3253 route for the packet, as indicated in the Route Cache. 3255 - The Last Hop External (L) bit in the DSR Source Route option is 3256 copied from the External bit flagging the last hop in the source 3257 route for the packet, as indicated in the Route Cache. 3259 - The Salvage field in the DSR Source Route option MUST be 3260 initialized to some nonzero value; the particular nonzero value 3261 used SHOULD be MAX_SALVAGE_COUNT. By initializing this field to 3262 a nonzero value, nodes forwarding or overhearing this packet will 3263 not consider a link to exist between the IP Source Address of the 3264 packet and the Address[1] address in the DSR Source Route option 3265 (e.g., they will not attempt to add this to their Route Cache as 3266 a link). By choosing MAX_SALVAGE_COUNT as the nonzero value to 3267 which the node initializes this field, nodes furthermore will not 3268 attempt to salvage this packet. 3270 - Transmit the packet to the next-hop node on the new source route 3271 in the packet, using the forwarding procedure described in 3272 Section 8.1.5. 3274 8.2.4. Originating a Route Reply 3276 A node originates a Route Reply in order to reply to a received and 3277 processed Route Request, according to the procedures described in 3278 Sections 8.2.2 and 8.2.3. The Route Reply is returned in a Route 3279 Reply option (Section 6.3). The Route Reply option MAY be returned 3280 to the initiator of the Route Request in a separate IP packet, used 3281 only to carry this Route Reply option, or it MAY be included in any 3282 other IP packet being sent to this address. 3284 The Route Reply option MUST be included in a DSR Options header in 3285 the packet returned to the initiator. To initialize the Route Reply 3286 option, the node performs the following sequence of steps: 3288 - The Option Type in the option MUST be set to the value 3. 3290 - The Opt Data Len field in the option MUST be set to the value 3291 (n * 4) + 3, where n is the number of addresses in the source 3292 route being returned (excluding the Route Discovery initiator 3293 node's address). 3295 - The Last Hop External (L) bit in the option MUST be 3296 initialized to 0. 3298 - The Reserved field in the option MUST be initialized to 0. 3300 - The Route Request Identifier MUST be initialized to the 3301 Identifier field of the Route Request that this reply is sent in 3302 response to. 3304 - The sequence of hop addresses in the source route are copied into 3305 the Address[i] fields of the option. Address[1] MUST be set to 3306 the first-hop address of the route after the initiator of the 3307 Route Discovery, Address[n] MUST be set to the last-hop address 3308 of the source route (the address of the target node), and each 3309 other Address[i] MUST be set to the next address in sequence in 3310 the source route being returned. 3312 The Destination Address field in the IP header of the packet carrying 3313 the Route Reply option MUST be set to the address of the initiator 3314 of the Route Discovery (i.e., for a Route Reply being returned in 3315 response to some Route Request, the IP Source Address of the Route 3316 Request). 3318 After creating and initializing the Route Reply option and the IP 3319 packet containing it, send the Route Reply. In sending the Route 3320 Reply from this node (but not from nodes forwarding the Route Reply), 3321 this node SHOULD delay the Reply by a small jitter period chosen 3322 randomly between 0 and BroadcastJitter. 3324 When returning any Route Reply in the case in which the MAC protocol 3325 in use in the network is not capable of transmitting unicast packets 3326 over unidirectional links, the source route used for routing the 3327 Route Reply packet MUST be obtained by reversing the sequence of 3328 hops in the Route Request packet (the source route that is then 3329 returned in the Route Reply). This restriction on returning a Route 3330 Reply enables the Route Reply to test this sequence of hops for 3331 bidirectionality, preventing the Route Reply from being received by 3332 the initiator of the Route Discovery unless each of the hops over 3333 which the Route Reply is returned (and thus each of the hops in the 3334 source route being returned in the Reply) is bidirectional. 3336 If sending a Route Reply to the initiator of the Route Request 3337 requires performing a Route Discovery, the Route Reply option MUST 3338 be piggybacked on the packet that contains the Route Request. This 3339 piggybacking prevents a loop wherein the target of the new Route 3340 Request (which was itself the initiator of the original Route 3341 Request) must do another Route Request in order to return its 3342 Route Reply. 3344 If sending the Route Reply to the initiator of the Route Request 3345 does not require performing a Route Discovery, a node SHOULD send a 3346 unicast Route Reply in response to every Route Request it receives 3347 for which it is the target node. 3349 8.2.5. Preventing Route Reply Storms 3351 The ability for nodes to reply to a Route Request based on 3352 information in their Route Caches, as described in Sections 3.3.2 3353 and 8.2.3, could result in a possible Route Reply "storm" in some 3354 cases. In particular, if a node broadcasts a Route Request for a 3355 target node for which the node's neighbors have a route in their 3356 Route Caches, each neighbor may attempt to send a Route Reply, 3357 thereby wasting bandwidth and possibly increasing the number of 3358 network collisions in the area. 3360 For example, the figure below shows a situation in which nodes B, C, 3361 D, E, and F all receive A's Route Request for target G, and each has 3362 the indicated route cached for this target: 3364 +-----+ +-----+ 3365 | D |< >| C | 3366 +-----+ \ / +-----+ 3367 Cache: C - B - G \ / Cache: B - G 3368 \ +-----+ / 3369 -| A |- 3370 +-----+\ +-----+ +-----+ 3371 | | \--->| B | | G | 3372 / \ +-----+ +-----+ 3373 / \ Cache: G 3374 v v 3375 +-----+ +-----+ 3376 | E | | F | 3377 +-----+ +-----+ 3378 Cache: F - B - G Cache: B - G 3380 Normally, each of these nodes would attempt to reply from its own 3381 Route Cache, and they would thus all send their Route Replies at 3382 about the same time, since they all received the broadcast Route 3383 Request at about the same time. Such simultaneous Route Replies 3384 from different nodes all receiving the Route Request may cause local 3385 congestion in the wireless network and may create packet collisions 3386 among some or all of these Replies if the MAC protocol in use does 3387 not provide sufficient collision avoidance for these packets. In 3388 addition, it will often be the case that the different replies will 3389 indicate routes of different lengths, as shown in this example. 3391 In order to reduce these effects, if a node can put its network 3392 interface into promiscuous receive mode, it MAY delay sending its 3393 own Route Reply for a short period, while listening to see if the 3394 initiating node begins using a shorter route first. Specifically, 3395 this node MAY delay sending its own Route Reply for a random period 3397 d = H * (h - 1 + r) 3399 where h is the length in number of network hops for the route to be 3400 returned in this node's Route Reply, r is a random floating point 3401 number between 0 and 1, and H is a small constant delay (at least 3402 twice the maximum wireless link propagation delay) to be introduced 3403 per hop. This delay effectively randomizes the time at which each 3404 node sends its Route Reply, with all nodes sending Route Replies 3405 giving routes of length less than h sending their Replies before this 3406 node, and all nodes sending Route Replies giving routes of length 3407 greater than h sending their Replies after this node. 3409 Within the delay period, this node promiscuously receives all 3410 packets, looking for data packets from the initiator of this Route 3411 Discovery destined for the target of the Discovery. If such a data 3412 packet received by this node during the delay period uses a source 3413 route of length less than or equal to h, this node may infer that the 3414 initiator of the Route Discovery has already received a Route Reply 3415 giving an equally good or better route. In this case, this node 3416 SHOULD cancel its delay timer and SHOULD NOT send its Route Reply for 3417 this Route Discovery. 3419 8.2.6. Processing a Received Route Reply Option 3421 Section 8.1.4 describes the general processing for a received packet, 3422 including the addition of routing information from options in the 3423 packet's DSR Options header to the receiving node's Route Cache. 3425 If the received packet contains a Route Reply, no additional special 3426 processing of the Route Reply option is required beyond what is 3427 described there. As described in Section 4.1 anytime a node adds 3428 new information to its Route Cache (including the information added 3429 from this Route Reply option), the node SHOULD check each packet in 3430 its own Send Buffer (Section 4.2) to determine whether a route to 3431 that packet's IP Destination Address now exists in the node's Route 3432 Cache (including the information just added to the Cache). If so, 3433 the packet SHOULD then be sent using that route and removed from the 3434 Send Buffer. This general procedure handles all processing required 3435 for a received Route Reply option. 3437 When using a MAC protocol that requires bidirectional links for 3438 unicast transmission, a unidirectional link may be discovered by the 3439 propagation of the Route Request. When the Route Reply is sent over 3440 the reverse path, a forwarding node may discover that the next-hop is 3441 unreachable. In this case, it MUST add the next-hop address to its 3442 Blacklist (Section 4.6). 3444 8.3. Route Maintenance Processing 3446 Route Maintenance is the mechanism by which a source node S is able 3447 to detect, while using a source route to some destination node D, 3448 if the network topology has changed such that it can no longer use 3449 its route to D because a link along the route no longer works. When 3450 Route Maintenance indicates that a source route is broken, S can 3451 attempt to use any other route it happens to know to D, or can invoke 3452 Route Discovery again to find a new route for subsequent packets 3453 to D. Route Maintenance for this route is used only when S is 3454 actually sending packets to D. 3456 Specifically, when forwarding a packet, a node MUST attempt 3457 to confirm the reachability of the next-hop node, unless such 3458 confirmation had been received in the last MaintHoldoffTime. 3459 Individual implementations MAY choose to bypass such confirmation 3460 for some limited number of packets, as long as those packets all 3461 fall within MaintHoldoffTime within the last confirmation. If no 3462 confirmation is received after the retransmission of MaxMaintRexmt 3463 acknowledgement requests, after the initial transmission of the 3464 packet, and conceptually including all retransmissions provided 3465 by the MAC layer, the node determines that the link for this 3466 next-hop node of the source route is "broken". This confirmation 3467 from the next-hop node for Route Maintenance can be implemented 3468 using a link-layer acknowledgement (Section 8.3.1), using a 3469 "passive acknowledgement" (Section 8.3.2), or using a network-layer 3470 acknowledgement (Section 8.3.3); the particular strategy for 3471 retransmission timing depends on the type of acknowledgement 3472 mechanism used. When passive acknowledgements are being used, each 3473 retransmitted acknowledgement request SHOULD be explicit software 3474 acknowledgement requests. If no acknowledgement is received after 3475 MaxMaintRexmt retransmissions (if necessary), the node SHOULD 3476 originate a Route Error to the original sender of the packet, as 3477 described in Section 8.3.4. 3479 In deciding whether or not to send a Route Error in response to 3480 attempting to forward a packet from some sender over a broken link, 3481 a node MUST limit the number of consecutive packets from a single 3482 sender that the node attempts to forward over this same broken 3483 link for which the node chooses not to return a Route Error; this 3484 requirement MAY be satisfied by returning a Route Error for each 3485 packet that the node attempts to forward over a broken link. 3487 8.3.1. Using Link-Layer Acknowledgements 3489 If the MAC protocol in use provides feedback as to the successful 3490 delivery of a data packet (such as is provided by the link-layer 3491 acknowledgement frame defined by IEEE 802.11 [13]), then the use 3492 of the DSR Acknowledgement Request and Acknowledgement options 3493 is not necessary. If such link-layer feedback is available, it 3494 SHOULD be used instead of any other acknowledgement mechanism 3495 for Route Maintenance, and the node SHOULD NOT use either passive 3496 acknowledgements or network-layer acknowledgements for Route 3497 Maintenance. 3499 When using link-layer acknowledgements for Route Maintenance, the 3500 retransmission timing and the timing at which retransmission attempts 3501 are scheduled are generally controlled by the particular link layer 3502 implementation in use in the network. For example, in IEEE 802.11, 3503 the link-layer acknowledgement is returned after the data packet as 3504 a part of the basic access method of of the IEEE 802.11 Distributed 3505 Coordination Function (DCF) MAC protocol; the time at which the 3506 acknowledgement is expected to arrive and the time at which the next 3507 retransmission attempt (if necessary) will occur are controlled by 3508 the MAC protocol implementation. 3510 When a node receives a link-layer acknowledgement for any packet in 3511 its Maintenance Buffer, that node SHOULD remove that packet, as well 3512 as any other packets in its Maintenance Buffer with the same next-hop 3513 destination, from its Maintenance Buffer. 3515 8.3.2. Using Passive Acknowledgements 3517 When link-layer acknowledgements are not available, but passive 3518 acknowledgements [18] are available, passive acknowledgements SHOULD 3519 be used for Route Maintenance when originating or forwarding a packet 3520 along any hop other than the last hop (the hop leading to the IP 3521 Destination Address node of the packet). In particular, passive 3522 acknowledgements SHOULD be used for Route Maintenance in such cases 3523 if the node can place its network interface into "promiscuous" 3524 receive mode, and network links used for data packets generally 3525 operate bidirectionally. 3527 A node MUST NOT attempt to use passive acknowledgements for Route 3528 Maintenance for a packet originated or forwarded over its last hop 3529 (the hop leading to the IP Destination Address node of the packet), 3530 since the receiving node will not be forwarding the packet and thus 3531 no passive acknowledgement will be available to be heard by this 3532 node. Beyond this restriction, a node MAY utilize a variety of 3533 strategies in using passive acknowledgements for Route Maintenance of 3534 a packet that it originates or forwards. For example, the following 3535 two strategies are possible: 3537 - Each time a node receives a packet to be forwarded to a node 3538 other than the final destination (the IP Destination Address 3539 of the packet), that node sends the original transmission of 3540 that packet without requesting a network-layer acknowledgement 3541 for it. If no passive acknowledgement is received within 3542 PassiveAckTimeout after this transmission, the node retransmits 3543 the packet, again without requesting a network-layer 3544 acknowledgement for it; the same PassiveAckTimeout timeout value 3545 is used for each such attempt. If no acknowledgement has been 3546 received after a total of TryPassiveAcks retransmissions of 3547 the packet, network-layer acknowledgements (as described in 3548 Section 8.3.3) are used for all remaining attempts for that 3549 packet. 3551 - Each node maintains a table of possible next-hop destination 3552 nodes, noting whether or not passive acknowledgements can 3553 typically be expected from transmission to that node, and the 3554 expected latency and jitter of a passive acknowledgement from 3555 that node. Each time a node receives a packet to be forwarded 3556 to a node other than the IP Destination Address, the node checks 3557 its table of next-hop destination nodes to determine whether to 3558 use a passive acknowledgement or a network-layer acknowledgement 3559 for that transmission to that node. The timeout for this packet 3560 can also be derived from this table. A node using this method 3561 SHOULD prefer using passive acknowledgements to network-layer 3562 acknowledgements. 3564 In using passive acknowledgements for a packet that it originates or 3565 forwards, a node considers the later receipt of a new packet (e.g., 3566 with promiscuous receive mode enabled on its network interface) to be 3567 an acknowledgement of this first packet if both of the following two 3568 tests succeed: 3570 - The Source Address, Destination Address, Protocol, 3571 Identification, and Fragment Offset fields in the IP header 3572 of the two packets MUST match [32], and 3574 - If either packet contains a DSR Source Route header, both packets 3575 MUST contain one, and the value in the Segments Left field in the 3576 DSR Source Route header of the new packet MUST be less than that 3577 in the first packet. 3579 When a node hears such a passive acknowledgement for any packet in 3580 its Maintenance Buffer, that node SHOULD remove that packet, as well 3581 as any other packets in its Maintenance Buffer with the same next-hop 3582 destination, from its Maintenance Buffer. 3584 8.3.3. Using Network-Layer Acknowledgements 3586 When a node originates or forwards a packet and has no other 3587 mechanism of acknowledgement available to determine reachability 3588 of the next-hop node in the source route for Route Maintenance, 3589 that node SHOULD request a network-layer acknowledgement from that 3590 next-hop node. To do so, the node inserts an Acknowledgement Request 3591 option in the DSR Options header in the packet. The Identification 3592 field in that Acknowledgement Request option MUST be set to a value 3593 unique over all packets transmitted by this node to the same next-hop 3594 node that are either unacknowledged or recently acknowledged. 3596 When a node receives a packet containing an Acknowledgement Request 3597 option, then that node performs the following tests on the packet: 3599 - If the indicated next-hop node address for this packet does not 3600 match any of this node's own IP addresses, then this node MUST 3601 NOT process the Acknowledgement Request option. The indicated 3602 next-hop node address is the next Address[i] field in the DSR 3603 Source Route option in the DSR Options header in the packet, or 3604 is the IP Destination Address in the packet if the packet does 3605 not contain a DSR Source Route option or the Segments Left there 3606 is zero. 3608 - If the packet contains an Acknowledgement option, then this node 3609 MUST NOT process the Acknowledgement Request option. 3611 If neither of the tests above fails, then this node MUST process the 3612 Acknowledgement Request option by sending an Acknowledgement option 3613 to the previous-hop node; to do so, the node performs the following 3614 sequence of steps: 3616 - Create a packet and set the IP Protocol field to the protocol 3617 number assigned for DSR (TBA???). 3619 - Set the IP Source Address field in this packet to the IP address 3620 of this node, copied from the source route in the DSR Source 3621 Route option in that packet (or from the IP Destination Address 3622 field of the packet, if the packet does not contain a DSR Source 3623 Route option). 3625 - Set the IP Destination Address field in this packet to the IP 3626 address of the previous-hop node, copied from the source route 3627 in the DSR Source Route option in that packet (or from the IP 3628 Source Address field of the packet, if the packet does not 3629 contain a DSR Source Route option). 3631 - Add a DSR Options header to the packet, and set the DSR Options 3632 header's Next Header field to the "No Next Header" value. 3634 - Add an Acknowledgement option to the DSR Options header in the 3635 packet; set the Acknowledgement option's Option Type field to 6 3636 and the Opt Data Len field to 10. 3638 - Copy the Identification field from the received Acknowledgement 3639 Request option into the Identification field in the 3640 Acknowledgement option. 3642 - Set the ACK Source Address field in the Acknowledgement option to 3643 be the IP Source Address of this new packet (set above to be the 3644 IP address of this node). 3646 - Set the ACK Destination Address field in the Acknowledgement 3647 option to be the IP Destination Address of this new packet (set 3648 above to be the IP address of the previous-hop node). 3650 - Send the packet as described in Section 8.1.1. 3652 Packets containing an Acknowledgement option SHOULD NOT be placed in 3653 the Maintenance Buffer. 3655 When a node receives a packet with both an Acknowledgement option 3656 and an Acknowledgement Request option, if that node is not the 3657 destination of the Acknowledgement option (the IP Destination Address 3658 of the packet), then the Acknowledgement Request option MUST 3659 be ignored. Otherwise (that node is the destination of the 3660 Acknowledgement option), that node MUST process the Acknowledgement 3661 Request option by returning an Acknowledgement option according to 3662 the following sequence of steps: 3664 - Create a packet and set the IP Protocol field to the protocol 3665 number assigned for DSR (TBA???). 3667 - Set the IP Source Address field in this packet to the IP address 3668 of this node, copied from the source route in the DSR Source 3669 Route option in that packet (or from the IP Destination Address 3670 field of the packet, if the packet does not contain a DSR Source 3671 Route option). 3673 - Set the IP Destination Address field in this packet to the IP 3674 address of the node originating the Acknowledgement option. 3676 - Add a DSR Options header to the packet, and set the DSR Options 3677 header's Next Header field to the "No Next Header" value. 3679 - Add an Acknowledgement option to the DSR Options header in this 3680 packet; set the Acknowledgement option's Option Type field to 6 3681 and the Opt Data Len field to 10. 3683 - Copy the Identification field from the received Acknowledgement 3684 Request option into the Identification field in the 3685 Acknowledgement option. 3687 - Set the ACK Source Address field in the option to be the IP 3688 Source Address of this new packet (set above to be the IP address 3689 of this node). 3691 - Set the ACK Destination Address field in the option to be the IP 3692 Destination Address of this new packet (set above to be the IP 3693 address of the node originating the Acknowledgement option.) 3695 - Send the packet directly to the destination. The IP 3696 Destination Address MUST be treated as a direct neighbor node: 3697 the transmission to that node MUST be done in a single IP 3698 forwarding hop, without Route Discovery and without searching 3699 the Route Cache. In addition, this packet MUST NOT contain a 3700 DSR Acknowledgement Request, MUST NOT be retransmitted for Route 3701 Maintenance, and MUST NOT expect a link-layer acknowledgement or 3702 passive acknowledgement. 3704 When using network-layer acknowledgements for Route Maintenance, 3705 a node SHOULD use an adaptive algorithm in determining the 3706 retransmission timeout for each transmission attempt of an 3707 acknowledgement request. For example, a node SHOULD maintain a 3708 separate round-trip time (RTT) estimate for each to which it has 3709 recently attempted to transmit packets, and it SHOULD use this RTT 3710 estimate in setting the timeout for each retransmission attempt 3711 for Route Maintenance. The TCP RTT estimation algorithm has been 3712 shown to work well for this purpose in implementation and testbed 3713 experiments with DSR [22, 24]. 3715 8.3.4. Originating a Route Error 3717 When a node is unable to verify reachability of a next-hop node after 3718 reaching a maximum number of retransmission attempts, a node SHOULD 3719 send a Route Error to the IP Source Address of the packet. When 3720 sending a Route Error for a packet containing either a Route Error 3721 option or an Acknowledgement option, a node SHOULD add these existing 3722 options to its Route Error, subject to the limit described below. 3724 A node transmitting a Route Error MUST perform the following steps: 3726 - Create an IP packet and set the Source Address field in this 3727 packet's IP header to the address of this node. 3729 - If the Salvage field in the DSR Source Route option in the 3730 packet triggering the Route Error is zero, then copy the 3731 Source Address field of the packet triggering the Route Error 3732 into the Destination Address field in the new packet's IP 3733 header; otherwise, copy the Address[1] field from the DSR Source 3734 Route option of the packet triggering the Route Error into the 3735 Destination Address field in the new packet's IP header 3737 - Insert a DSR Options header into the new packet. 3739 - Add a Route Error Option to the new packet, setting the Error 3740 Type to NODE_UNREACHABLE, the Salvage value to the Salvage 3741 value from the DSR Source Route option of the packet triggering 3742 the Route Error, and the Unreachable Node Address field to 3743 the address of the next-hop node from the original source 3744 route. Set the Error Source Address field to this node's IP 3745 address, and the Error Destination field to the new packet's IP 3746 Destination Address. 3748 - If the packet triggering the Route Error contains any Route Error 3749 or Acknowledgement options, the node MAY append to its Route 3750 Error each of these options, with the following constraints: 3752 o The node MUST NOT include any Route Error option from the 3753 packet triggering the new Route Error, for which the total 3754 salvage count (Section 6.4) of that included Route Error 3755 would be greater than MAX_SALVAGE_COUNT in the new packet. 3757 o If any Route Error option from the packet triggering the new 3758 Route Error is not included in the packet, the node MUST NOT 3759 include any following Route Error or Acknowledgement options 3760 from the packet triggering the new Route Error. 3762 o Any appended options from the packet triggering the Route 3763 Error MUST follow the new Route Error in the packet. 3765 o In appending these options to the new Route Error, the order 3766 of these options from the packet triggering the Route Error 3767 MUST be preserved. 3769 - Send the packet as described in Section 8.1.1. 3771 8.3.5. Processing a Received Route Error Option 3773 When a node receives a packet containing a Route Error option, that 3774 node MUST process the Route Error option according to the following 3775 sequence of steps: 3777 - The node MUST remove from its Route Cache the link from the 3778 node identified by the Error Source Address field to the node 3779 identified by the Unreachable Node Address field (if this link is 3780 present in its Route Cache). If the node implements its Route 3781 Cache as a link cache, as described in Section 4.1, only this 3782 single link is removed; if the node implements its Route Cache as 3783 a path cache, however, all routes (paths) that use this link are 3784 removed. 3786 - If the option following the Route Error is an Acknowledgement 3787 or Route Error option sent by this node (that is, with 3788 Acknowledgement or Error Source Address equal to this node's 3789 address), copy the DSR options following the current Route 3790 Error into a new packet with IP Source Address equal to this 3791 node's own IP address and IP Destination Address equal to the 3792 Acknowledgement or Error Destination Address. Transmit this 3793 packet as described in Section 8.1.1, with the salvage count 3794 in the DSR Source Route option set to the Salvage value of the 3795 Route Error. 3797 In addition, after processing the Route Error as described above, 3798 the node MAY initiate a new Route Discovery for any destination node 3799 for which it then has no route in its Route Cache as a result of 3800 processing this Route Error, if the node has indication that a route 3801 to that destination is needed. For example, if the node has an open 3802 TCP connection to some destination node, then if the processing of 3803 this Route Error removed the only route to that destination from this 3804 node's Route Cache, then this node MAY initiate a new Route Discovery 3805 for that destination node. Any node, however, MUST limit the rate at 3806 which it initiates new Route Discoveries for any single destination 3807 address, and any new Route Discovery initiated in this way as part of 3808 processing this Route Error MUST conform to this limit. 3810 8.3.6. Salvaging a Packet 3812 When an intermediate node forwarding a packet detects through Route 3813 Maintenance that the next-hop link along the route for that packet is 3814 broken (Section 8.3), if the node has another route to the packet's 3815 IP Destination Address in its Route Cache, the node SHOULD "salvage" 3816 the packet rather than discarding it. To do so using the route found 3817 in its Route Cache, this node processes the packet as follows: 3819 - If the MAC protocol in use in the network is not capable of 3820 transmitting unicast packets over unidirectional links, as 3821 discussed in Section 3.3.1, then if this packet contains a Route 3822 Reply option, remove and discard the Route Reply option in the 3823 packet; if the DSR Options header in the packet then contains no 3824 DSR options, remove the DSR Options header from the packet. If 3825 the resulting packet then contains only an IP header, the node 3826 SHOULD NOT salvage the packet and instead SHOULD discard the 3827 entire packet. 3829 When returning any Route Reply in the case in which the MAC 3830 protocol in use in the network is not capable of transmitting 3831 unicast packets over unidirectional links, the source route 3832 used for routing the Route Reply packet MUST be obtained by 3833 reversing the sequence of hops in the Route Request packet (the 3834 source route that is then returned in the Route Reply). This 3835 restriction on returning a Route Reply and on salvaging a packet 3836 that contains a Route Reply option enables the Route Reply to 3837 test this sequence of hops for bidirectionality, preventing the 3838 Route Reply from being received by the initiator of the Route 3839 Discovery unless each of the hops over which the Route Reply is 3840 returned (and thus each of the hops in the source route being 3841 returned in the Reply) is bidirectional. 3843 - Modify the existing DSR Source Route option in the packet so 3844 that the Address[i] fields represent the source route found in 3845 this node's Route Cache to this packet's IP Destination Address. 3846 Specifically, the node copies the hop addresses of the source 3847 route into sequential Address[i] fields in the DSR Source Route 3848 option, for i = 1, 2, ..., n. Address[1] here is the address 3849 of the salvaging node itself (the first address in the source 3850 route found from this node to the IP Destination Address of the 3851 packet). The value n here is the number of hop addresses in this 3852 source route, excluding the destination of the packet (which is 3853 instead already represented in the Destination Address field in 3854 the packet's IP header). 3856 - Initialize the Segments Left field in the DSR Source Route option 3857 to n as defined above. 3859 - The First Hop External (F) bit in the DSR Source Route option is 3860 copied from the External bit flagging the first hop in the source 3861 route for the packet, as indicated in the Route Cache. 3863 - The Last Hop External (L) bit in the DSR Source Route option is 3864 copied from the External bit flagging the last hop in the source 3865 route for the packet, as indicated in the Route Cache. 3867 - The Salvage field in the DSR Source Route option is set to 1 plus 3868 the value of the Salvage field in the DSR Source Route option of 3869 the packet that caused the error. 3871 - Transmit the packet to the next-hop node on the new source route 3872 in the packet, using the forwarding procedure described in 3873 Section 8.1.5. 3875 As described in Section 8.3.4, the node in this case also SHOULD 3876 return a Route Error to the original sender of the packet. If the 3877 node chooses to salvage the packet, it SHOULD do so after originating 3878 the Route Error. 3880 8.4. Multiple Network Interface Support 3882 A node using DSR MAY have multiple network interfaces that support 3883 ad hoc network routing. This section describes special packet 3884 processing at such nodes. 3886 A node with multiple network interfaces MUST have some policy for 3887 determining which Route Request packets are forwarded out which 3888 network interfaces. For example, a node MAY choose to forward all 3889 Route Requests out all network interfaces. 3891 When a node with multiple network interfaces propagates a Route 3892 Request on an network interface other than the one one which it 3893 received the Route Request, it MUST modify the address list between 3894 receipt and propagation as follows: 3896 - Append the address of the incoming network interface. 3898 - Append the address of the outgoing network interface. 3900 When a node forwards a packet containing a source route, it MUST 3901 assume that the next-hop node is reachable on the incoming network 3902 interface, unless the next hop is the address of one of this node's 3903 network interfaces, in which case this node MUST skip over this 3904 address in the source route and process the packet in the same way as 3905 if it had just received it from that network interface, as described 3906 in section 8.1.5. 3908 If a node that previously had multiple network interfaces receives 3909 a packet sent with a source route specifying a change to a network 3910 interface that is no longer available, it MAY send a Route Error to 3911 the source of the packet without attempting to forward the packet 3912 on the incoming network interface, unless the network uses an 3913 autoconfiguration mechanism that may have allowed another node to 3914 acquire the now unused address of the unavailable network interface. 3916 8.5. IP Fragmentation and Reassembly 3918 When a node using DSR wishes to fragment a packet that contains a DSR 3919 header not containing a Route Request option, it MUST perform the 3920 following sequence of steps: 3922 - Remove the DSR Options header from the packet. 3924 - Fragment the packet. When determining the size of each fragment 3925 to create from the original packet, the fragment size MUST be 3926 reduced by the size of the DSR Options header from the original 3927 packet. 3929 - IP-in-IP encapsulate each fragment [28]. The IP Destination 3930 address of the outer (encapsulating) packet MUST be set equal to 3931 the IP Destination address of the original packet. 3933 - Add the DSR Options header from the original packet to each 3934 resulting encapsulating packet. If a Source Route header is 3935 present in the DSR Options header, increment the Salvage field. 3937 When a node using the DSR protocol receives an IP-in-IP encapsulated 3938 packet destined to itself, it SHOULD decapsulate the packet [28] and 3939 then process the inner packet according to standard IP reassembly 3940 processing [32]. 3942 8.6. Flow State Processing 3944 A node implementing the optional DSR flow state extension MUST follow 3945 these additional processing steps. 3947 8.6.1. Originating a Packet 3949 When originating any packet to be routed using flow state, a node 3950 using DSR flow state MUST: 3952 - If the route to be used for this packet has never had a DSR 3953 flow state established along it (or the existing flow state has 3954 expired): 3956 o Generate a 16-bit Flow ID larger than any unexpired Flow IDs 3957 used for this destination. Odd Flow IDs MUST be chosen for 3958 "default" flows; even Flow IDs MUST be chosen for non-default 3959 flows. 3961 o Add a DSR Options header, as described in Section 8.1.2. 3963 o Add a DSR Flow State header, as described in Section 8.6.2. 3965 o Initialize the Hop Count field in the DSR Flow State header 3966 to 0. 3968 o Set the Flow ID field in the DSR Flow State header to the 3969 Flow ID generated in the first step. 3971 o Add a Timeout option to the DSR Options header. 3973 o Add a Source Route option after the Timeout option. with the 3974 route to be used, as described in Section 8.1.3. 3976 o The source SHOULD record this flow in its Flow Table. 3978 o If this flow is recorded in the Flow Table, the TTL MUST be 3979 set to be the TTL of the flow establishment packet. 3981 o If this flow is recorded in the Flow Table, the timeout MUST 3982 be set to a value no less than the value specified in the 3983 Timeout option. 3985 - If the route to be used for this packet has had DSR flow state 3986 established along it, but has not been established end-to-end: 3988 o Add a DSR Options header, as described in Section 8.1.2. 3990 o Add a DSR Flow State header, as described in Section 8.6.2. 3992 o Initialize the Hop Count field in the DSR Flow State header 3993 to 0. 3995 o The Flow ID field of the DSR Flow State header SHOULD be the 3996 Flow ID previously used for this route. If it is not, the 3997 steps for sending packets along never before established 3998 routes MUST be followed in place of these. 4000 o Add a Timeout option to the DSR Options header, setting the 4001 Timeout to a value not greater than the timeout remaining for 4002 this flow in the Flow Table. 4004 o Add a Source Route option after the Timeout option with the 4005 route to be used, as described in Section 8.1.3 4007 o If the IP TTL is not equal to the TTL specified in the Flow 4008 Table, the source MUST set a flag to indicate that this flow 4009 cannot be used as default. 4011 - If the route the node wishes to use for this packet has been 4012 established end-to-end and is not the default flow: 4014 o Add a DSR Flow State header, as described in Section 8.6.2. 4016 o Initialize the Hop Count field in the DSR Flow State header 4017 to 0. 4019 o The Flow ID field of the DSR Flow State header SHOULD be the 4020 Flow ID previously used for this route. If it is not, the 4021 steps for sending packets along never before established 4022 routes MUST be followed in place of these. 4024 o If the next hop requires a Hop-by-Hop acknowledgement, 4025 add a DSR Options header, as described in Section 8.1.2, 4026 and an Acknowledgement Request option, as described in 4027 Section 8.3.3. 4029 o A DSR Options header SHOULD NOT be added to a packet, unless 4030 it is added to carry an Acknowledgement Request option, in 4031 which case: 4033 + A Source Route option in the DSR Options header SHOULD 4034 NOT be added. 4036 + If a Source Route option in the DSR Options header is 4037 added, the steps for sending packets along routes not 4038 yet established end-to-end MUST be followed in place of 4039 these. 4041 + A Timeout option SHOULD NOT be added. 4043 + If a Timeout option is added, it MUST specify a timeout 4044 not greater than the timeout remaining for this flow in 4045 the Flow Table. 4047 - If the route the node wishes to use for this packet has been 4048 established end-to-end and is the current default flow: 4050 o If the IP TTL is not equal to the TTL specified in the Flow 4051 Table, the source MUST follow the steps for sending a packet 4052 along a non-default flow that has been established end-to-end 4053 in place of these steps. 4055 o If the next hop requires a Hop-by-Hop acknowledgement, 4056 the sending node MUST add a DSR Options header and 4057 an Acknowledgement Request option, as described in 4058 Section 8.3.3. The sending node MUST NOT add any additional 4059 options to this header. 4061 o A DSR Options header SHOULD NOT be added, except as specified 4062 in the previous step. If one is added in a way inconsistent 4063 with the previous step, the source MUST follow the steps 4064 for sending a packet along a non-default flow that has been 4065 established end-to-end in place of these steps. 4067 8.6.2. Inserting a DSR Flow State Header 4069 A node originating a packet adds a DSR Flow State header to the 4070 packet, if necessary, to carry information needed by the routing 4071 protocol. Only one DSR Flow State header may be in any packet. 4072 A DSR Flow State header is added to a packet by performing the 4073 following sequence of steps: 4075 - Insert a DSR Flow State header after the IP header and any 4076 Hop-by-Hop Options header that may already be in the packet, but 4077 before any other header that may be present. 4079 - Set the Next Header field of the DSR Flow State header to the 4080 Next Header field of the previous header (either an IP header or 4081 a Hop-by-Hop Options header). 4083 - Set the Next Header field of the previous header to the Protocol 4084 number assigned for DSR (TBA???). 4086 8.6.3. Receiving a Packet 4088 This section describes processing only for packets that are sent to 4089 the processing node as the next-hop node; that is, when the MAC-layer 4090 destination address is the MAC address of this node. Otherwise, the 4091 process described in Sections 8.6.5 should be followed. 4093 The flow along which a packet is being sent is considered to be in 4094 the Flow Table if the triple (IP Source Address, IP Destination 4095 Address, Flow ID) has an unexpired entry in the Flow Table. 4097 When a node using DSR flow state receives a packet, it MUST follow 4098 the following steps for processing: 4100 - If a DSR Flow State header is present, increment the Hop Count 4101 field. 4103 - In addition, if a DSR Flow State header is present, then if the 4104 triple (IP Source Address, IP Destination Address, Flow ID) is 4105 in this node's Automatic Route Shortening Table and the packet 4106 is listed in the entry, then the node MAY send a gratuitous 4107 Route Reply as described in Section 4.4, subject to the rate 4108 limiting specified in Section 4.4. This gratuitous Route Reply 4109 gives the route by which the packet originally reached this 4110 node. Specifically, the node sending the gratuitous Route Reply 4111 constructs the route to return in the Route Reply as follows: 4113 o Let k = (packet Hop Count) - (table Hop Count), where 4114 packet Hop Count is the value of the Hop Count field in this 4115 received packet, and table Hop Count is the Hop Count value 4116 stored for this packet in the corresponding entry in this 4117 node's Automatic Route Shortening Table. 4119 o Copy the complete source route for this flow from the 4120 corresponding entry in the node's Flow Table. 4122 o Remove from this route the k hops immediately preceding this 4123 node in the route, since these are the hops "skipped over" 4124 by the packet as recorded in the Automatic Route Shortening 4125 Table entry. 4127 - Process each of the DSR options within the DSR Options header in 4128 order: 4130 o On receiving a Pad1 or PadN option, skip over the option 4132 o On receiving a Route Request for which this node is the 4133 destination, remove the option and return a Route Reply as 4134 specified in Section 8.2.2. 4136 o On receiving a broadcast Route Request that this node has not 4137 previously seen for which this node is not the destination, 4138 append this node's incoming interface address to the Route 4139 Request, continue propagating the Route Request as specified 4140 in Section 8.2.2, send the payload, if any, to the network 4141 layer, and stop processing. 4143 o On receiving a Route Request that this node has not 4144 previously seen for which this node is not the destination, 4145 discard the packet and stop processing. 4147 o On receiving any Route Request, add appropriate links to the 4148 cache, as specified in Section 8.2.2. 4150 o On receiving a Route Reply that this node is the Requester 4151 for, remove the Route Reply from the packet and process it as 4152 specified in Section 8.2.6. 4154 o On receiving any Route Reply, add appropriate links to the 4155 cache, as specified in Section 8.2.6. 4157 o On receiving any Route Error of type NODE_UNREACHABLE, 4158 remove appropriate links to the cache, as specified in 4159 Section 8.3.5. 4161 o On receiving a Route Error of type NODE_UNREACHABLE that 4162 this node is the Error Destination Address of, remove the 4163 Route Error from the packet and process it as specified 4164 in Section 8.3.5. It also MUST stop originating packets 4165 along any flows using the link from Error Source Address to 4166 Unreachable Node, and it MAY remove from its Flow Table any 4167 flows using the link from Error Source Address to Unreachable 4168 Node. 4170 o On receiving a Route Error of type UNKNOWN_FLOW that this 4171 node is not the Error Destination Address of, the node checks 4172 if the Route Error corresponds to a flow in its Flow Table. 4173 If it does not, the node silently discards the Route Error; 4174 otherwise, it forwards the packet to the expected previous 4175 hop of the corresponding flow. If Route Maintenance cannot 4176 confirm the reachability of the previous hop, the node checks 4177 if the network interface requires bidirectional links for 4178 operation. If it does, the node silently discards the Error; 4179 otherwise, it sends the Error as if it were originating it, 4180 as described in Section 8.1.1. 4182 o On receiving a Route Error of type UNKNOWN_FLOW that this 4183 node is the Error Destination Address of, remove the Route 4184 Error from the packet and mark the flow specified by the 4185 triple (Error Destination Address, Original IP Destination 4186 Address, Flow ID) as not having been established end-to-end. 4188 o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN 4189 that this node is not the Error Destination Address of, the 4190 node checks if the Route Error corresponds to a flow in 4191 its Default Flow Table. If it does not, the node silently 4192 discards the Route Error; otherwise, it forwards the packet 4193 to the expected previous hop of the corresponding flow. 4194 If Route Maintenance cannot confirm the reachability of 4195 the previous hop, the node checks if the network interface 4196 requires bidirectional links for operation. If it does, 4197 the node silently discards the Error; otherwise, it sends 4198 the Error as if it were originating it, as described in 4199 Section 8.1.1. 4201 o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN that 4202 this node is the Error Destination Address of, remove the 4203 Route Error from the packet and mark the default flow between 4204 the Error Destination Address and the Original IP Destination 4205 Address as not having been established end-to-end. 4207 o On receiving a Acknowledgement Request option, the receiving 4208 node removes the Acknowledgement Request option and replies 4209 to the previous hop with a Acknowledgement option. If the 4210 previous hop cannot be determined, the Acknowledgement 4211 Request option is discarded, and processing continues. 4213 o On receiving a Acknowledgement option, the receiving node 4214 removes the Acknowledgement option and processes it. 4216 o On receiving any Acknowledgement option, add the appropriate 4217 link to the cache, as specified in Section 8.1.4 4219 o On receiving any Source Route option, add appropriate links 4220 to the cache, as specified in Section 8.1.4. 4222 o On receiving a Source Route option and either no DSR Flow 4223 State header is present, the flow this packet is being sent 4224 along is in the Flow Table, or no Timeout option preceded the 4225 Source Route option in this DSR Options header, process it 4226 as specified in Section 8.1.4. Stop processing this packet 4227 unless the last address in the Source Route option is an 4228 address of this node. 4230 o On receiving a Source Route option in a packet with a DSR 4231 Flow State header, and the Flow ID specified in the DSR Flow 4232 State header is not in the Flow Table, add the flow to the 4233 Flow Table, setting the Timeout value to a value not greater 4234 than the Timeout field of the Timeout option in this header. 4235 If no Timeout option preceded the Source Route option in this 4236 header, the flow MUST NOT be added to the Flow Table. 4238 If the Flow ID is odd and larger than any unexpired, odd 4239 Flow IDs, it is set to be default in the Default Flow ID 4240 Table. 4242 Then process the Route option as specified in Section 8.1.4. 4243 Stop processing this packet unless the last address in the 4244 Source Route option is an address of this node. 4246 o On receiving a Timeout option, check if this packet contains 4247 a DSR Flow State header. If this packet does not contain a 4248 DSR Flow State header, discard the DSR option. Otherwise, 4249 record the Timeout value in the option for future reference. 4250 The value recorded SHOULD be discarded when the node has 4251 finished processing this DSR Options header. If the flow 4252 that this packet is being sent along is in the Flow Table, it 4253 MAY set the flow to time out no more than Timeout seconds in 4254 the future. 4256 o On receiving a Destination and Flow ID option, if the 4257 IP Destination Address is not an address of this node, 4258 forward the packet according to the Flow ID, as described in 4259 Section 8.6.4, and stop processing this packet. 4261 o On receiving a Destination and Flow ID option, if the IP 4262 Destination Address is an address of this node, set the 4263 IP Destination Address to the New IP Destination Address 4264 specified in the option, and set the Flow ID to the New 4265 Flow Identifier. Then remove the DSR option from the packet 4266 and continue processing. 4268 - If the IP Destination Address is an address of this node, remove 4269 the DSR Options header, if any, and pass the packet up the 4270 network stack and stop processing. 4272 - If there is still a DSR Options header containing no options, 4273 remove the DSR Options header. 4275 - If there is still a DSR Flow State header, forward the packet 4276 according to the Flow ID, as described in Section 8.6.4. 4278 - If there is neither a DSR Options header nor a DSR Flow State 4279 header, but there is an entry in the Default Flow Table for the 4280 (IP Source Address, IP Destination Address) pair: 4282 o If the IP TTL is not equal to the TTL expected in the Flow 4283 Table, insert a DSR Flow State header, setting Hop Count 4284 equal to the Hop Count of this node, and the Flow ID equal 4285 to the default Flow ID found in the table, and forward 4286 this packet according to the Flow ID, as described in 4287 Section 8.6.4. 4289 o Otherwise, follow the steps for forwarding the packet using 4290 Flow IDs described in Section 8.6.4, but taking the Flow ID 4291 to be the default Flow ID found in the table. 4293 - If there is no DSR Options header, no DSR Flow State header, and 4294 no default flow can be found, the node returns a Route Error of 4295 type Default Flow Unknown to the IP Source Address, specifying 4296 the IP Destination Address as the Original IP Destination in the 4297 type-specific field. 4299 8.6.4. Forwarding a Packet Using Flow IDs 4301 To forward a packet using Flow IDs, a node MUST follow the following 4302 sequence of steps: 4304 - If the triple (IP Source Address, IP Destination Address, 4305 Flow ID) is not in the Flow Table, return a Route Error of type 4306 Unknown Flow. 4308 - If a hop-by-hop acknowledgement is required for the next hop, the 4309 node MUST include an Acknowledegment Request option as specified 4310 in Section 8.3.3. If no DSR Options header is in the packet for 4311 the Acknowledgement Request option to be attached to, it MUST be 4312 included, as described in Section 8.1.2, except that it MUST be 4313 added after the DSR Flow State header, if one is present. 4315 - Attempt to transmit this packet to the next hop as specified in 4316 the Flow Table, performing Route Maintenance to detect broken 4317 routes. 4319 8.6.5. Promiscuously Receiving a Packet 4321 This section describes processing only for packets that have MAC 4322 destinations other than the processing node. Otherwise, the process 4323 described in Section 8.6.3 should be followed. 4325 When a node using DSR flow state promiscuously overhears a packet, it 4326 SHOULD follow the following steps for processing: 4328 - If the packet contains a DSR Flow State header, and if the triple 4329 (IP Source Address, IP Destination Address, Flow ID) is in the 4330 Flow Table and the Hop Count is less than the Hop Count in the 4331 flow's entry, the node MAY retain the packet in the Automatic 4332 Route Shortening Table. If it can be determined that this 4333 Flow ID has been recently used, it SHOULD retain the packet in 4334 the Automatic Route Shortening Table. 4336 - If the packet contains neither a DSR Flow State header nor a 4337 Source Route option, and a Default Flow ID can be found in 4338 the Default Flow Table for (IP Source Address, IP Destination 4339 Address), and the IP TTL is greater than the TTL in the table 4340 for the default flow, the node MAY retain the packet in the 4341 Automatic Route Shortening Table. If it can be determined that 4342 this Flow ID has been used recently, the node SHOULD retain the 4343 packet in the Automatic Route Shortening Table. 4345 8.6.6. Operation where the Layer below DSR Decreases 4346 the IP TTL Non-Uniformly 4348 Some nodes may use an IP tunnel as a DSR hop. If different packets 4349 sent along this IP tunnel can take different routes, the reduction 4350 in IP TTL across this link may be different for different packets. 4351 This prevents the Automatic Route Shortening and Loop Detection 4352 functionality from working properly when used in conjunction with 4353 default routes. 4355 Nodes forwarding packets without a Source Route option onto a link 4356 with unpredictable TTL changes MUST ensure that a DSR Flow State 4357 header is present, indicating the correct Hop Count and Flow ID. 4359 8.6.7. Salvage Interactions with DSR 4361 Nodes salvaging packets MUST remove the DSR Flow State header, if 4362 present. 4364 Any time this document refers to the Salvage field in the Source 4365 Route option, packets without a Source Route option are considered to 4366 have the value zero in the Salvage field. 4368 9. Protocol Constants and Configuration Variables 4370 Any DSR implementation MUST support the following configuration 4371 variables and MUST support a mechanism enabling the value of these 4372 variables to be modified by system management. The specific variable 4373 names are used for demonstration purposes only, and an implementation 4374 is not required to use these names for the configuration variables, 4375 so long as the external behavior of the implementation is consistent 4376 with that described in this document. 4378 For each configuration variable below, the default value is specified 4379 to simplify configuration. In particular, the default values given 4380 below are chosen for a DSR network running over 2 Mbps IEEE 802.11 4381 network interfaces using the Distributed Coordination Function (DCF) 4382 MAC with RTS and CTS [13, 5]. 4384 DiscoveryHopLimit 255 hops 4386 BroadcastJitter 10 milliseconds 4388 RouteCacheTimeout 300 seconds 4390 SendBufferTimeout 30 seconds 4392 RequestTableSize 64 nodes 4393 RequestTableIds 16 identifiers 4394 MaxRequestRexmt 16 retransmissions 4395 MaxRequestPeriod 10 seconds 4396 RequestPeriod 500 milliseconds 4397 NonpropRequestTimeout 30 milliseconds 4399 RexmtBufferSize 50 packets 4401 MaintHoldoffTime 250 milliseconds 4403 MaxMaintRexmt 2 retransmissions 4405 TryPassiveAcks 1 attempt 4406 PassiveAckTimeout 100 milliseconds 4408 GratReplyHoldoff 1 second 4410 In addition, the following protocol constant MUST be supported by any 4411 implementation of the DSR protocol: 4413 MAX_SALVAGE_COUNT 15 salvages 4415 10. IANA Considerations 4417 This document specifies the DSR Options header and DSR Flow State 4418 header, which require an IP Protocol number. A single IP protocol 4419 number can be used for both header types, since they can be 4420 distinguished by the Flow State Header (F) bit in each header. 4422 In addition, this document proposes use of the value "No Next Header" 4423 (originally defined for use in IPv6) within an IPv4 packet, to 4424 indicate that no further header follows a DSR Options header. 4426 Finally, this document introduces a number of DSR options for use in 4427 the DSR Options header, and additional new DSR options may be defined 4428 in the future. Each of these options requires a unique Option Type 4429 value, with the most significant 3 bits (that is, Option Type & 0xE0) 4430 encoded as defined in Section 6.1. It is necessary only that each 4431 Option Type value be unique, not that they be unique in the remaining 4432 5 bits of the value after these 3 most significant bits. Assignment 4433 of new values for DSR options will be by Expert Review [25], with the 4434 authors of this document serving as the Designated Experts. 4436 11. Security Considerations 4438 This document does not specifically address security concerns. This 4439 document does assume that all nodes participating in the DSR protocol 4440 do so in good faith and without malicious intent to corrupt the 4441 routing ability of the network. 4443 Depending on the threat model, a number of different mechanisms can 4444 be used to secure DSR. For example, in an environment where node 4445 compromise is unrealistic and where where all the nodes participating 4446 in the DSR protocol share a common goal that motivates their 4447 participation in the protocol, the communications between the nodes 4448 can be encrypted at the physical channel or link layer to prevent 4449 attack by outsiders. Cryptographic approaches, such as that provided 4450 by Ariadne [12] or SRP [27], can resist stronger attacks. 4452 Appendix A. Link-MaxLife Cache Description 4454 As guidance to implementors of DSR, the description below outlines 4455 the operation of a possible implementation of a Route Cache for DSR 4456 that has been shown to outperform other other caches studied in 4457 detailed simulations. Use of this design for the Route Cache is 4458 recommended in implementations of DSR. 4460 This cache, called "Link-MaxLife" [10], is a link cache, in that each 4461 individual link (hop) in the routes returned in Route Reply packets 4462 (or otherwise learned from the header of overhead packets) is added 4463 to a unified graph data structure of this node's current view of the 4464 network topology, as described in Section 4.1. To search for a route 4465 in this cache to some destination node, the sending node uses a graph 4466 search algorithm, such as the well-known Dijkstra's shortest-path 4467 algorithm, to find the current best path through the graph to the 4468 destination node. 4470 The Link-MaxLife form of link cache is adaptive in that each link in 4471 the cache has a timeout that is determined dynamically by the caching 4472 node according to its observed past behavior of the two nodes at the 4473 ends of the link; in addition, when selecting a route for a packet 4474 being sent to some destination, among cached routes of equal length 4475 (number of hops) to that destination, Link-MaxLife selects the route 4476 with the longest expected lifetime (highest minimum timeout of any 4477 link in the route). 4479 Specifically, in Link-MaxLife, a link's timeout in the Route Cache 4480 is chosen according to a "Stability Table" maintained by the caching 4481 node. Each entry in a node's Stability Table records the address of 4482 another node and a factor representing the perceived "stability" of 4483 this node. The stability of each other node in a node's Stability 4484 Table is initialized to InitStability. When a link from the Route 4485 Cache is used in routing a packet originated or salvaged by that 4486 node, the stability metric for each of the two endpoint nodes of that 4487 link is incremented by the amount of time since that link was last 4488 used, multiplied by StabilityIncrFactor (StabilityIncrFactor >= 1); 4489 when a link is observed to break and the link is thus removed 4490 from the Route Cache, the stability metric for each of the two 4491 endpoint nodes of that link is multiplied by StabilityDecrFactor 4492 (StabilityDecrFactor < 1). 4494 When a node adds a new link to its Route Cache, the node assigns a 4495 lifetime for that link in the Cache equal to the stability of the 4496 less "stable" of the two endpoint nodes for the link, except that a 4497 link is not allowed to be given a lifetime less than MinLifetime. 4498 When a link is used in a route chosen for a packet originated or 4499 salvaged by this node, the link's lifetime is set to be at least 4500 UseExtends into the future; if the lifetime of that link in the 4501 Route Cache is already further into the future, the lifetime remains 4502 unchanged. 4504 When a node using Link-MaxLife selects a route from its Route Cache 4505 for a packet being originated or salvaged by this node, it selects 4506 the shortest-length route that has the longest expected lifetime 4507 (highest minimum timeout of any link in the route), as opposed to 4508 simply selecting an arbitrary route of shortest length. 4510 The following configuration variables are used in the description 4511 of Link-MaxLife above. The specific variable names are used for 4512 demonstration purposes only, and an implementation is not required 4513 to use these names for these configuration variables. For each 4514 configuration variable below, the default value is specified to 4515 simplify configuration. In particular, the default values given 4516 below are chosen for a DSR network where nodes move at relative 4517 velocities between 12 and 25 seconds per transmission radius. 4519 InitStability 25 seconds 4520 StabilityIncrFactor 4 4521 StabilityDecrFactor 1/2 4523 MinLifetime 1 second 4524 UseExtends 120 seconds 4526 Appendix B. Location of DSR in the ISO Network Reference Model 4528 When designing DSR, we had to determine at what layer within 4529 the protocol hierarchy to implement ad hoc network routing. We 4530 considered two different options: routing at the link layer (ISO 4531 layer 2) and routing at the network layer (ISO layer 3). Originally, 4532 we opted to route at the link layer for several reasons: 4534 - Pragmatically, running the DSR protocol at the link layer 4535 maximizes the number of mobile nodes that can participate in 4536 ad hoc networks. For example, the protocol can route equally 4537 well between IPv4 [32], IPv6 [7], and IPX [37] nodes. 4539 - Historically [15, 16], DSR grew from our contemplation of 4540 a multi-hop propagating version of the Internet's Address 4541 Resolution Protocol (ARP) [30], as well as from the routing 4542 mechanism used in IEEE 802 source routing bridges [29]. These 4543 are layer 2 protocols. 4545 - Technically, we designed DSR to be simple enough that it could 4546 be implemented directly in the firmware inside wireless network 4547 interface cards [15, 16], well below the layer 3 software within 4548 a mobile node. We see great potential in this for DSR running 4549 inside a cloud of mobile nodes around a fixed base station, 4550 where DSR would act to transparently extend the coverage range 4551 to these nodes. Mobile nodes that would otherwise be unable 4552 to communicate with the base station due to factors such as 4553 distance, fading, or local interference sources could then reach 4554 the base station through their peers. 4556 Ultimately, however, we decided to specify and to implement [22] 4557 DSR as a layer 3 protocol, since this is the only layer at which we 4558 could realistically support nodes with multiple network interfaces of 4559 different types forming an ad hoc network. 4561 Appendix C. Implementation and Evaluation Status 4563 The initial design of the DSR protocol, including DSR's basic Route 4564 Discovery and Route Maintenance mechanisms, was first published in 4565 December 1994 [15], with significant additional design details and 4566 initial simulation results published in early 1996 [16]. 4568 The DSR protocol has been extensively studied since then through 4569 additional detailed simulations. In particular, we have implemented 4570 DSR in the ns-2 network simulator [26, 5] and performed extensive 4571 simulations of DSR using ns-2 (e.g., [5, 21]). We have also 4572 conducted evaluations of the different caching strategies in this 4573 document [10]. 4575 We have also implemented the DSR protocol under the FreeBSD 2.2.7 4576 operating system running on Intel x86 platforms. FreeBSD [9] is 4577 based on a variety of free software, including 4.4 BSD Lite from the 4578 University of California, Berkeley. For the environments in which 4579 we used it, this implementation is functionally equivalent to the 4580 version of the DSR protocol specified in this document. 4582 During the 7 months from August 1998 to February 1999, we designed 4583 and implemented a full-scale physical testbed to enable the 4584 evaluation of ad hoc network performance in the field, in an actively 4585 mobile ad hoc network under realistic communication workloads. The 4586 last week of February and the first week of March of 1999 included 4587 demonstrations of this testbed to a number of our sponsors and 4588 partners, including Lucent Technologies, Bell Atlantic, and DARPA. 4589 A complete description of the testbed is available as a Technical 4590 Report [22]. 4592 We have since ported this implementation of DSR to FreeBSD 3.3, and 4593 we have also added a preliminary version of Quality of Service (QoS) 4594 support for DSR. A demonstration of this modified version of DSR was 4595 presented in July 2000. These QoS features are not included in this 4596 document, and will be added later in a separate document on top of 4597 the base protocol specified here. 4599 DSR has also been implemented under Linux by Alex Song at the 4600 University of Queensland, Australia [36]. This implementation 4601 supports the Intel x86 PC platform and the Compaq iPAQ. 4603 The Network and Telecommunications Research Group at Trinity College 4604 Dublin have implemented a version of DSR on Windows CE. 4606 Microsoft Research has implemented a version of DSR on Windows XP, 4607 and has used it in testbeds of over 15 nodes. Several machines use 4608 this implementation as their primary means of accessing the Internet. 4610 Several other independent groups have also used DSR as a platform for 4611 their own research, or and as a basis of comparison between ad hoc 4612 network routing protocols. 4614 A preliminary version of the optional DSR flow state extension was 4615 implemented in FreeBSD 3.3. A demonstration of this modified version 4616 of DSR was presented in July 2000. The DSR flow state extension has 4617 also been extensively evaluated using simulation [11]. 4619 Changes from Previous Version of the Draft 4621 This appendix briefly lists some of the major changes in this 4622 draft relative to the previous version of this same draft, 4623 draft-ietf-manet-dsr-09.txt: 4625 - Changed the values used for the Route Request and Route Reply 4626 options so that they are assigned in a more logical order (Route 4627 Request is now 1 and Route Reply is 2, rather than the other way 4628 around). 4630 - Specification of interaction of DSR with ARP. 4632 - Better integration of multiple network interfaces into the main 4633 packet processing specification in Section 8. 4635 - Removal of optimizations for unidirectional links, based on 4636 special 127.0.0.1 and 127.0.0.2 flags in a Route Request and 4637 Route Reply. These optimizations were not fully specified in 4638 the draft and will be included in future versions of the DSR 4639 specification. 4641 - Clarification of rules for IP fragmentation in Section 8.5. 4643 - Revisions to the IANA Considerations section to state that the 4644 DSR Options header and DSR Flow State header can share a single 4645 IP protocol number assignment, and to add of a policy for DSR 4646 options assignments. 4648 - Other general clarification of the specification, based on 4649 feedback received in Area Director review comments. 4651 Acknowledgements 4653 The protocol described in this document has been designed and 4654 developed within the Monarch Project, a research project at Rice 4655 University (previously at Carnegie Mellon University) that is 4656 developing adaptive networking protocols and protocol interfaces to 4657 allow truly seamless wireless and mobile node networking [17, 35]. 4659 The authors would like to acknowledge the substantial contributions 4660 of Josh Broch in helping to design, simulate, and implement the DSR 4661 protocol. We thank him for his contributions to earlier versions of 4662 this document. 4664 We would also like to acknowledge the assistance of Robert V. Barron 4665 at Carnegie Mellon University. Bob ported our DSR implementation 4666 from FreeBSD 2.2.7 into FreeBSD 3.3. 4668 Many valuable suggestions came from participants in the IETF process. 4669 We would particularly like to acknowledge Fred Baker, who provided 4670 extensive feedback on a previous version of this document, as well as 4671 the working group chairs, for their suggestions of previous versions 4672 of the document. 4674 References 4676 [1] David F. Bantz and Frederic J. Bauchot. Wireless LAN Design 4677 Alternatives. IEEE Network, 8(2):43--53, March/April 1994. 4679 [2] Vaduvur Bharghavan, Alan Demers, Scott Shenker, and Lixia 4680 Zhang. MACAW: A Media Access Protocol for Wireless LAN's. In 4681 Proceedings of the ACM SIGCOMM '94 Conference, pages 212--225, 4682 August 1994. 4684 [3] Robert T. Braden, editor. Requirements for Internet 4685 Hosts---Communication Layers. RFC 1122, October 1989. 4687 [4] Scott Bradner. Key words for use in RFCs to Indicate 4688 Requirement Levels. RFC 2119, March 1997. 4690 [5] Josh Broch, David A. Maltz, David B. Johnson, Yih-Chun Hu, 4691 and Jorjeta Jetcheva. A Performance Comparison of Multi-Hop 4692 Wireless Ad Hoc Network Routing Protocols. In Proceedings of 4693 the Fourth Annual ACM/IEEE International Conference on Mobile 4694 Computing and Networking, pages 85--97, October 1998. 4696 [6] David D. Clark. The Design Philosophy of the DARPA Internet 4697 Protocols. In Proceedings of the ACM SIGCOMM '88 Conference, 4698 pages 106--114, August 1988. 4700 [7] Stephen E. Deering and Robert M. Hinden. Internet Protocol 4701 Version 6 (IPv6) Specification. RFC 2460, December 1998. 4703 [8] Ralph Droms. Dynamic Host Configuration Protocol. RFC 2131, 4704 March 1997. 4706 [9] The FreeBSD Project. Project web page available at 4707 http://www.freebsd.org/. 4709 [10] Yih-Chun Hu and David B. Johnson. Caching Strategies in 4710 On-Demand Routing Protocols for Wireless Ad Hoc Networks. In 4711 Proceedings of the Sixth Annual ACM International Conference on 4712 Mobile Computing and Networking, August 2000. 4714 [11] Yih-Chun Hu and David B. Johnson. Implicit Source Routing 4715 in On-Demand Ad Hoc Network Routing. In Proceedings of the 4716 Second Symposium on Mobile Ad Hoc Networking and Computing 4717 (MobiHoc 2001), pages 1--10, October 2001. 4719 [12] Yih-Chun Hu, Adrian Perrig, and David B. Johnson. Ariadne: 4720 A Secure On-Demand Routing Protocol for Ad Hoc Networks. In 4721 Proceedings of the Eighth Annual International Conference on 4722 Mobile Computing and Networking (MobiCom 2002), pages 12--23, 4723 September 2002. 4725 [13] IEEE Computer Society LAN MAN Standards Committee. Wireless 4726 LAN Medium Access Control (MAC) and Physical Layer (PHY) 4727 Specifications, IEEE Std 802.11-1997. The Institute of 4728 Electrical and Electronics Engineers, New York, New York, 1997. 4730 [14] Per Johansson, Tony Larsson, Nicklas Hedman, Bartosz Mielczarek, 4731 and Mikael Degermark. Scenario-based Performance Analysis of 4732 Routing Protocols for Mobile Ad-hoc Networks. In Proceedings 4733 of the Fifth Annual ACM/IEEE International Conference on Mobile 4734 Computing and Networking, pages 195--206, August 1999. 4736 [15] David B. Johnson. Routing in Ad Hoc Networks of Mobile Hosts. 4737 In Proceedings of the IEEE Workshop on Mobile Computing Systems 4738 and Applications, pages 158--163, December 1994. 4740 [16] David B. Johnson and David A. Maltz. Dynamic Source Routing in 4741 Ad Hoc Wireless Networks. In Mobile Computing, edited by Tomasz 4742 Imielinski and Hank Korth, chapter 5, pages 153--181. Kluwer 4743 Academic Publishers, 1996. 4745 [17] David B. Johnson and David A. Maltz. Protocols for Adaptive 4746 Wireless and Mobile Networking. IEEE Personal Communications, 4747 3(1):34--42, February 1996. 4749 [18] John Jubin and Janet D. Tornow. The DARPA Packet Radio Network 4750 Protocols. Proceedings of the IEEE, 75(1):21--32, January 1987. 4752 [19] Phil Karn. MACA---A New Channel Access Method for Packet Radio. 4753 In ARRL/CRRL Amateur Radio 9th Computer Networking Conference, 4754 pages 134--140, September 1990. 4756 [20] Gregory S. Lauer. Packet-Radio Routing. In Routing in 4757 Communications Networks, edited by Martha E. Steenstrup, 4758 chapter 11, pages 351--396. Prentice-Hall, Englewood Cliffs, 4759 New Jersey, 1995. 4761 [21] David A. Maltz, Josh Broch, Jorjeta Jetcheva, and David B. 4762 Johnson. The Effects of On-Demand Behavior in Routing Protocols 4763 for Multi-Hop Wireless Ad Hoc Networks. IEEE Journal on 4764 Selected Areas of Communications, 17(8):1439--1453, August 1999. 4766 [22] David A. Maltz, Josh Broch, and David B. Johnson. Experiences 4767 Designing and Building a Multi-Hop Wireless Ad Hoc Network 4768 Testbed. Technical Report CMU-CS-99-116, School of Computer 4769 Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, 4770 March 1999. 4772 [23] David A. Maltz, Josh Broch, and David B. Johnson. Quantitative 4773 Lessons From a Full-Scale Multi-Hop Wireless Ad Hoc Network 4774 Testbed. In Proceedings of the IEEE Wireless Communications and 4775 Networking Conference, September 2000. 4777 [24] David A. Maltz, Josh Broch, and David B. Johnson. Lessons From 4778 a Full-Scale MultiHop Wireless Ad Hoc Network Testbed. IEEE 4779 Personal Communications, 8(1):8--15, February 2001. 4781 [25] Thomas Narten and Harald Tveit Alvestrand. Guidelines for 4782 Writing an IANA Considerations Section in RFCs. RFC 2434, 4783 October 1998. 4785 [26] The Network Simulator -- ns-2. Project web page available at 4786 http://www.isi.edu/nsnam/ns/. 4788 [27] Panagiotis Papadimitratos and Zygmunt J. Haas. Secure Routing 4789 for Mobile Ad Hoc Networks. In SCS Communication Networks and 4790 Distributed Systems Modeling and Simulation Conference (CNDS 4791 2002), January 2002. 4793 [28] Charles Perkins. IP Encapsulation within IP. RFC 2003, October 4794 1996. 4796 [29] Radia Perlman. Interconnections: Bridges and Routers. 4797 Addison-Wesley, Reading, Massachusetts, 1992. 4799 [30] David C. Plummer. An Ethernet Address Resolution Protocol: 4800 Or Converting Network Protocol Addresses to 48.bit Ethernet 4801 Addresses for Transmission on Ethernet Hardware. RFC 826, 4802 November 1982. 4804 [31] J. B. Postel, editor. Internet Control Message Protocol. 4805 RFC 792, September 1981. 4807 [32] J. B. Postel, editor. Internet Protocol. RFC 791, September 4808 1981. 4810 [33] J. B. Postel, editor. Transmission Control Protocol. RFC 793, 4811 September 1981. 4813 [34] Joyce K. Reynolds and Jon Postel. Assigned Numbers. RFC 1700, 4814 October 1994. See also http://www.iana.org/numbers.html. 4816 [35] Rice University Monarch Project. Monarch Project Home Page. 4817 Available at http://www.monarch.cs.rice.edu/. 4819 [36] Alex Song. picoNet II: A Wireless Ad Hoc Network for Mobile 4820 Handheld Devices. Submitted for the degree of Bachelor of 4821 Engineering (Honours) in the division of Electrical Engineering, 4822 Department of Information Technology and Electrical Engineering, 4823 University of Queensland, Australia, October 2001. Available at 4824 http://student.uq.edu.au/~s369677/main.html. 4826 [37] Paul Turner. NetWare Communications Processes. NetWare 4827 Application Notes, Novell Research, pages 25--91, September 4828 1990. 4830 [38] Gary R. Wright and W. Richard Stevens. TCP/IP Illustrated, 4831 Volume 2: The Implementation. Addison-Wesley, Reading, 4832 Massachusetts, 1995. 4834 Chair's Address 4836 The MANET Working Group can be contacted via its current chairs: 4838 M. Scott Corson Phone: +1 908 947-7033 4839 Flarion Technologies, Inc. Email: corson@flarion.com 4840 Bedminster One 4841 135 Route 202/206 South 4842 Bedminster, NJ 07921 4843 USA 4845 Joseph Macker Phone: +1 202 767-2001 4846 Information Technology Division Email: macker@itd.nrl.navy.mil 4847 Naval Research Laboratory 4848 Washington, DC 20375 4849 USA 4851 Authors' Addresses 4853 Questions about this document can also be directed to the authors: 4855 David B. Johnson Phone: +1 713 348-3063 4856 Rice University Fax: +1 713 348-5930 4857 Computer Science Department, MS 132 Email: dbj@cs.rice.edu 4858 6100 Main Street 4859 Houston, TX 77005-1892 4860 USA 4862 David A. Maltz Phone: +1 412 268-5329 4863 Carnegie Mellon University Fax: +1 412 268-5576 4864 Computer Science Department Email: dmaltz@cs.cmu.edu 4865 5000 Forbes Avenue 4866 Pittsburgh, PA 15213 4867 USA 4869 Yih-Chun Hu Phone: +1 412 268-3075 4870 Rice University Fax: +1 412 268-5576 4871 Computer Science Department, MS 132 Email: yihchun@cs.cmu.edu 4872 6100 Main Street 4873 Houston, TX 77005-1892 4874 USA