idnits 2.17.1 draft-ietf-manet-dsr-08.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 4 instances 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' -- Possible downref: Non-RFC (?) normative reference: ref. '25' -- Possible downref: Non-RFC (?) normative reference: ref. '26' -- Possible downref: Non-RFC (?) normative reference: ref. '27' ** Obsolete normative reference: RFC 793 (ref. '31') (Obsoleted by RFC 9293) ** Obsolete normative reference: RFC 1700 (ref. '32') (Obsoleted by RFC 3232) -- Possible downref: Non-RFC (?) normative reference: ref. '33' -- Possible downref: Non-RFC (?) normative reference: ref. '34' -- Possible downref: Non-RFC (?) normative reference: ref. '35' -- Possible downref: Non-RFC (?) normative reference: ref. '36' Summary: 5 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 24 February 2003 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 42 for any existing network infrastructure or administration. The 43 protocol is composed of the two main mechanisms of "Route Discovery" 44 and "Route Maintenance", which work together to allow nodes to 45 discover and maintain routes to arbitrary destinations in the ad hoc 46 network. All aspects of the protocol operate entirely on-demand, 47 allowing the routing packet overhead of DSR to scale automatically 48 to only that needed to react to changes in the routes currently in 49 use. The protocol allows multiple routes to any destination and 50 allows each sender to select and control the routes used in routing 51 its packets, for example for use in load balancing or for increased 52 robustness. Other advantages of the DSR protocol include easily 53 guaranteed loop-free routing, support for use in networks containing 54 unidirectional links, use of only "soft state" in routing, and very 55 rapid recovery when routes in the network change. The DSR protocol 56 is designed mainly for mobile ad hoc networks of up to about two 57 hundred nodes, and is designed to work well with even very high 58 rates of mobility. This document specifies the operation of the DSR 59 protocol for routing unicast IPv4 packets. 61 Contents 63 Status of This Memo i 65 Abstract ii 67 1. Introduction 1 69 2. Assumptions 3 71 3. DSR Protocol Overview 5 73 3.1. Basic DSR Route Discovery . . . . . . . . . . . . . . . . 5 74 3.2. Basic DSR Route Maintenance . . . . . . . . . . . . . . . 8 75 3.3. Additional Route Discovery Features . . . . . . . . . . . 10 76 3.3.1. Caching Overheard Routing Information . . . . . . 10 77 3.3.2. Replying to Route Requests using Cached Routes . 11 78 3.3.3. Preventing Route Reply Storms . . . . . . . . . . 12 79 3.3.4. Route Request Hop Limits . . . . . . . . . . . . 14 80 3.4. Additional Route Maintenance Features . . . . . . . . . . 15 81 3.4.1. Packet Salvaging . . . . . . . . . . . . . . . . 15 82 3.4.2. Queued Packets Destined over a Broken Link . . . 15 83 3.4.3. Automatic Route Shortening . . . . . . . . . . . 16 84 3.4.4. Increased Spreading of Route Error Messages . . . 17 85 3.5. Optional DSR Flow State Extension . . . . . . . . . . . . 17 86 3.5.1. Flow Establishment . . . . . . . . . . . . . . . 18 87 3.5.2. Receiving and Forwarding Establishment Packets . 19 88 3.5.3. Sending Packets Along Established Flows . . . . . 19 89 3.5.4. Receiving and Forwarding Packets Sent Along 90 Established Flows . . . . . . . . . . . . 20 91 3.5.5. Processing Route Errors . . . . . . . . . . . . . 21 92 3.5.6. Interaction with Automatic Route Shortening . . . 21 93 3.5.7. Loop Detection . . . . . . . . . . . . . . . . . 22 94 3.5.8. Acknowledgement Destination . . . . . . . . . . . 22 95 3.5.9. Crash Recovery . . . . . . . . . . . . . . . . . 22 96 3.5.10. Rate Limiting . . . . . . . . . . . . . . . . . . 22 97 3.5.11. Interaction with Packet Salvaging . . . . . . . . 23 99 4. Conceptual Data Structures 24 101 4.1. Route Cache . . . . . . . . . . . . . . . . . . . . . . . 24 102 4.2. Send Buffer . . . . . . . . . . . . . . . . . . . . . . . 27 103 4.3. Route Request Table . . . . . . . . . . . . . . . . . . . 28 104 4.4. Gratuitous Route Reply Table . . . . . . . . . . . . . . 29 105 4.5. Network Interface Queue and Maintenance Buffer . . . . . 30 106 4.6. Blacklist . . . . . . . . . . . . . . . . . . . . . . . . 31 108 5. Additional Conceptual Data Structures for Flow State Extension 32 110 5.1. Flow Table . . . . . . . . . . . . . . . . . . . . . . . 32 111 5.2. Automatic Route Shortening Table . . . . . . . . . . . . 33 112 5.3. Default Flow ID Table . . . . . . . . . . . . . . . . . . 33 114 6. DSR Options Header Format 35 116 6.1. Fixed Portion of DSR Options Header . . . . . . . . . . . 36 117 6.2. Route Request Option . . . . . . . . . . . . . . . . . . 39 118 6.3. Route Reply Option . . . . . . . . . . . . . . . . . . . 41 119 6.4. Route Error Option . . . . . . . . . . . . . . . . . . . 43 120 6.4.1. Node Unreachable Type-Specific Information . . . 45 121 6.4.2. Flow State Not Supported Type-Specific Information 45 122 6.4.3. Option Not Supported Type-Specific Information . 45 123 6.5. Acknowledgement Request Option . . . . . . . . . . . . . 46 124 6.6. Acknowledgement Option . . . . . . . . . . . . . . . . . 47 125 6.7. DSR Source Route Option . . . . . . . . . . . . . . . . . 48 126 6.8. Pad1 Option . . . . . . . . . . . . . . . . . . . . . . . 50 127 6.9. PadN Option . . . . . . . . . . . . . . . . . . . . . . . 51 129 7. Additional Header Formats and Options for Flow State Extension 52 131 7.1. DSR Flow State Header . . . . . . . . . . . . . . . . . . 53 132 7.2. Options and Extensions in DSR Options Header . . . . . . 54 133 7.2.1. Timeout Option . . . . . . . . . . . . . . . . . 54 134 7.2.2. Destination and Flow ID Option . . . . . . . . . 55 135 7.2.3. New Error Type Value for Unknown Flow . . . . . . 56 136 7.2.4. New Error Type Value for Default Flow Unknown . . 57 137 7.2.5. Acknowledgement Request Option 138 Previous Hop Address Extension . . . . . . 58 140 8. Detailed Operation 59 142 8.1. General Packet Processing . . . . . . . . . . . . . . . . 59 143 8.1.1. Originating a Packet . . . . . . . . . . . . . . 59 144 8.1.2. Adding a DSR Options Header to a Packet . . . . . 59 145 8.1.3. Adding a DSR Source Route Option to a Packet . . 60 146 8.1.4. Processing a Received Packet . . . . . . . . . . 61 147 8.1.5. Processing a Received DSR Source Route Option . . 63 148 8.1.6. Handling an Unknown DSR Option . . . . . . . . . 65 149 8.2. Route Discovery Processing . . . . . . . . . . . . . . . 67 150 8.2.1. Originating a Route Request . . . . . . . . . . . 67 151 8.2.2. Processing a Received Route Request Option . . . 69 152 8.2.3. Generating a Route Reply using the Route Cache . 71 153 8.2.4. Originating a Route Reply . . . . . . . . . . . . 73 154 8.2.5. Processing a Received Route Reply Option . . . . 75 155 8.3. Route Maintenance Processing . . . . . . . . . . . . . . 76 156 8.3.1. Using Link-Layer Acknowledgements . . . . . . . . 76 157 8.3.2. Using Passive Acknowledgements . . . . . . . . . 77 158 8.3.3. Using Network-Layer Acknowledgements . . . . . . 78 159 8.3.4. Originating a Route Error . . . . . . . . . . . . 81 160 8.3.5. Processing a Received Route Error Option . . . . 82 161 8.3.6. Salvaging a Packet . . . . . . . . . . . . . . . 83 162 8.4. Multiple Interface Support . . . . . . . . . . . . . . . 85 163 8.5. Fragmentation and Reassembly . . . . . . . . . . . . . . 86 164 8.6. Flow State Processing . . . . . . . . . . . . . . . . . . 87 165 8.6.1. Originating a Packet . . . . . . . . . . . . . . 87 166 8.6.2. Inserting a DSR Flow State Header . . . . . . . . 89 167 8.6.3. Receiving a Packet . . . . . . . . . . . . . . . 89 168 8.6.4. Forwarding a Packet Using Flow IDs . . . . . . . 94 169 8.6.5. Promiscuously Receiving a Packet . . . . . . . . 94 170 8.6.6. Operation where the Layer below DSR Decreases 171 the IP TTL Non-Uniformly . . . . . . . . . 95 172 8.6.7. Salvage Interactions with DSR . . . . . . . . . . 95 174 9. Protocol Constants and Configuration Variables 96 176 10. IANA Considerations 97 178 11. Security Considerations 98 180 Appendix A. Link-MaxLife Cache Description 99 182 Appendix B. Location of DSR in the ISO Network Reference Model 101 184 Appendix C. Implementation and Evaluation Status 102 186 Changes from Previous Version of the Draft 104 188 Acknowledgements 105 190 References 106 192 Chair's Address 110 194 Authors' Addresses 111 195 1. Introduction 197 The Dynamic Source Routing protocol (DSR) [15, 16] is a simple and 198 efficient routing protocol designed specifically for use in multi-hop 199 wireless ad hoc networks of mobile nodes. Using DSR, the network 200 is completely self-organizing and self-configuring, requiring no 201 existing network infrastructure or administration. Network nodes 202 cooperate to forward packets for each other to allow communication 203 over multiple "hops" between nodes not directly within wireless 204 transmission range of one another. As nodes in the network move 205 about or join or leave the network, and as wireless transmission 206 conditions such as sources of interference change, all routing is 207 automatically determined and maintained by the DSR routing protocol. 208 Since the number or sequence of intermediate hops needed to reach any 209 destination may change at any time, the resulting network topology 210 may be quite rich and rapidly changing. 212 In designing DSR, we sought to create a routing protocol that had 213 very low overhead yet was able to react very quickly to changes in 214 the network. The DSR protocol provides highly reactive service in 215 order to help ensure successful delivery of data packets in spite of 216 node movement or other changes in network conditions. 218 The DSR protocol is composed of two main mechanisms that work 219 together to allow the discovery and maintenance of source routes in 220 the ad hoc network: 222 - Route Discovery is the mechanism by which a node S wishing to 223 send a packet to a destination node D obtains a source route 224 to D. Route Discovery is used only when S attempts to send a 225 packet to D and does not already know a route to D. 227 - Route Maintenance is the mechanism by which node S is able 228 to detect, while using a source route to D, if the network 229 topology has changed such that it can no longer use its route 230 to D because a link along the route no longer works. When Route 231 Maintenance indicates a source route is broken, S can attempt to 232 use any other route it happens to know to D, or can invoke Route 233 Discovery again to find a new route for subsequent packets to D. 234 Route Maintenance for this route is used only when S is actually 235 sending packets to D. 237 In DSR, Route Discovery and Route Maintenance each operate entirely 238 "on demand". In particular, unlike other protocols, DSR requires no 239 periodic packets of any kind at any layer within the network. For 240 example, DSR does not use any periodic routing advertisement, link 241 status sensing, or neighbor detection packets, and does not rely on 242 these functions from any underlying protocols in the network. This 243 entirely on-demand behavior and lack of periodic activity allows 244 the number of overhead packets caused by DSR to scale all the way 245 down to zero, when all nodes are approximately stationary with 246 respect to each other and all routes needed for current communication 247 have already been discovered. As nodes begin to move more or 248 as communication patterns change, the routing packet overhead of 249 DSR automatically scales to only that needed to track the routes 250 currently in use. Network topology changes not affecting routes 251 currently in use are ignored and do not cause reaction from the 252 protocol. 254 All state maintained by DSR is "soft state" [6], in that the loss 255 of any state will not interfere with the correct operation of the 256 protocol; all state is discovered as needed and can easily and 257 quickly be rediscovered if needed after a failure without significant 258 impact on the protocol. This use of only soft state allows the 259 routing protocol to be very robust to problems such as dropped or 260 delayed routing packets or node failures. In particular, a node in 261 DSR that fails and reboots can easily rejoin the network immediately 262 after rebooting; if the failed node was involved in forwarding 263 packets for other nodes as an intermediate hop along one or more 264 routes, it can also resume this forwarding quickly after rebooting, 265 with no or minimal interruption to the routing protocol. 267 In response to a single Route Discovery (as well as through routing 268 information from other packets overheard), a node may learn and 269 cache multiple routes to any destination. This support for multiple 270 routes allows the reaction to routing changes to be much more rapid, 271 since a node with multiple routes to a destination can try another 272 cached route if the one it has been using should fail. This caching 273 of multiple routes also avoids the overhead of needing to perform a 274 new Route Discovery each time a route in use breaks. The sender of 275 a packet selects and controls the route used for its own packets, 276 which together with support for multiple routes also allows features 277 such as load balancing to be defined. In addition, all routes used 278 are easily guaranteed to be loop-free, since the sender can avoid 279 duplicate hops in the routes selected. 281 The operation of both Route Discovery and Route Maintenance in DSR 282 are designed to allow unidirectional links and asymmetric routes 283 to be easily supported. In particular, as noted in Section 2, in 284 wireless networks, it is possible that a link between two nodes may 285 not work equally well in both directions, due to differing antenna 286 or propagation patterns or sources of interference. DSR allows such 287 unidirectional links to be used when necessary, improving overall 288 performance and network connectivity in the system. 290 This document specifies the operation of the DSR protocol for 291 routing unicast IPv4 packets in multi-hop wireless ad hoc networks. 292 Advanced, optional features, such as Quality of Service (QoS) support 293 and efficient multicast routing, and operation of DSR with IPv6 [7], 294 are covered in other documents. The specification of DSR in this 295 document provides a compatible base on which such features can be 296 added, either independently or by integration with the DSR operation 297 specified here. 299 The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 300 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 301 document are to be interpreted as described in RFC 2119 [4]. 303 2. Assumptions 305 The DSR protocol as described here is designed mainly for mobile 306 ad hoc networks of up to about two hundred nodes, and is designed 307 to work well with even very high rates of mobility. Other protocol 308 features and enhancements that may allow DSR to scale to larger 309 networks are outside the scope of this document. 311 We assume in this document that all nodes wishing to communicate with 312 other nodes within the ad hoc network are willing to participate 313 fully in the protocols of the network. In particular, each node 314 participating in the ad hoc network SHOULD also be willing to forward 315 packets for other nodes in the network. 317 The diameter of an ad hoc network is the minimum number of hops 318 necessary for a packet to reach from any node located at one extreme 319 edge of the ad hoc network to another node located at the opposite 320 extreme. We assume that this diameter will often be small (e.g., 321 perhaps 5 or 10 hops), but may often be greater than 1. 323 Packets may be lost or corrupted in transmission on the wireless 324 network. We assume that a node receiving a corrupted packet can 325 detect the error and discard the packet. 327 Nodes within the ad hoc network MAY move at any time without notice, 328 and MAY even move continuously, but we assume that the speed with 329 which nodes move is moderate with respect to the packet transmission 330 latency and wireless transmission range of the particular underlying 331 network hardware in use. In particular, DSR can support very 332 rapid rates of arbitrary node mobility, but we assume that nodes do 333 not continuously move so rapidly as to make the flooding of every 334 individual data packet the only possible routing protocol. 336 A common feature of many network interfaces, including most current 337 LAN hardware for broadcast media such as wireless, is the ability 338 to operate the network interface in "promiscuous" receive mode. 339 This mode causes the hardware to deliver every received packet to 340 the network driver software without filtering based on link-layer 341 destination address. Although we do not require this facility, some 342 of our optimizations can take advantage of its availability. Use 343 of promiscuous mode does increase the software overhead on the CPU, 344 but we believe that wireless network speeds are more the inherent 345 limiting factor to performance in current and future systems; we also 346 believe that portions of the protocol are suitable for implementation 347 directly within a programmable network interface unit to avoid this 348 overhead on the CPU [16]. Use of promiscuous mode may also increase 349 the power consumption of the network interface hardware, depending 350 on the design of the receiver hardware, and in such cases, DSR can 351 easily be used without the optimizations that depend on promiscuous 352 receive mode, or can be programmed to only periodically switch the 353 interface into promiscuous mode. Use of promiscuous receive mode is 354 entirely optional. 356 Wireless communication ability between any pair of nodes may at 357 times not work equally well in both directions, due for example to 358 differing antenna or propagation patterns or sources of interference 359 around the two nodes [1, 20]. That is, wireless communications 360 between each pair of nodes will in many cases be able to operate 361 bidirectionally, but at times the wireless link between two nodes 362 may be only unidirectional, allowing one node to successfully send 363 packets to the other while no communication is possible in the 364 reverse direction. Although many routing protocols operate correctly 365 only over bidirectional links, DSR can successfully discover and 366 forward packets over paths that contain unidirectional links. Some 367 MAC protocols, however, such as MACA [19], MACAW [2], or IEEE 368 802.11 [13], limit unicast data packet transmission to bidirectional 369 links, due to the required bidirectional exchange of RTS and CTS 370 packets in these protocols and due to the link-layer acknowledgement 371 feature in IEEE 802.11; when used on top of MAC protocols such as 372 these, DSR can take advantage of additional optimizations, such as 373 the ability to reverse a source route to obtain a route back to the 374 origin of the original route. 376 The IP address used by a node using the DSR protocol MAY be assigned 377 by any mechanism (e.g., static assignment or use of DHCP for dynamic 378 assignment [8]), although the method of such assignment is outside 379 the scope of this specification. 381 3. DSR Protocol Overview 383 This section provides an overview of the operation of the DSR 384 protocol. The basic version of DSR uses explicit "source routing", 385 in which each data packet sent carries in its header the complete, 386 ordered list of nodes through which the packet will pass. This use 387 of explicit source routing allows the sender to select and control 388 the routes used for its own packets, supports the use of multiple 389 routes to any destination (for example, for load balancing), and 390 allows a simple guarantee that the routes used are loop-free; by 391 including this source route in the header of each data packet, other 392 nodes forwarding or overhearing any of these packets can also easily 393 cache this routing information for future use. Section 3.1 describes 394 this basic operation of Route Discovery, Section 3.2 describes basic 395 Route Maintenance, and Sections 3.3 and 3.4 describe additional 396 features of these two parts of DSR's operation. Section 3.5 then 397 describes an optional, compatible extension to DSR, known as "flow 398 state", that allows the routing of most packets without an explicit 399 source route header in the packet, while still preserves the 400 fundamental properties of DSR's operation. 402 3.1. Basic DSR Route Discovery 404 When some source node originates a new packet addressed to some 405 destination node, the source node places in the header of the packet 406 a "source route" giving the sequence of hops that the packet is to 407 follow on its way to the destination. Normally, the sender will 408 obtain a suitable source route by searching its "Route Cache" of 409 routes previously learned; if no route is found in its cache, it will 410 initiate the Route Discovery protocol to dynamically find a new route 411 to this destination node. In this case, we call the source node 412 the "initiator" and the destination node the "target" of the Route 413 Discovery. 415 For example, suppose a node A is attempting to discover a route to 416 node E. The Route Discovery initiated by node A in this example 417 would proceed as follows: 419 ^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D" 420 | id=2 | id=2 | id=2 | id=2 421 +-----+ +-----+ +-----+ +-----+ +-----+ 422 | A |---->| B |---->| C |---->| D |---->| E | 423 +-----+ +-----+ +-----+ +-----+ +-----+ 424 | | | | 425 v v v v 427 To initiate the Route Discovery, node A transmits a "Route 428 Request" as a single local broadcast packet, which is received by 429 (approximately) all nodes currently within wireless transmission 430 range of A, including node B in this example. Each Route Request 431 identifies the initiator and target of the Route Discovery, and 432 also contains a unique request identification (2, in this example), 433 determined by the initiator of the Request. Each Route Request also 434 contains a record listing the address of each intermediate node 435 through which this particular copy of the Route Request has been 436 forwarded. This route record is initialized to an empty list by the 437 initiator of the Route Discovery. In this example, the route record 438 initially lists only node A. 440 When another node receives this Route Request (such as node B in this 441 example), if it is the target of the Route Discovery, it returns 442 a "Route Reply" to the initiator of the Route Discovery, giving 443 a copy of the accumulated route record from the Route Request; 444 when the initiator receives this Route Reply, it caches this route 445 in its Route Cache for use in sending subsequent packets to this 446 destination. 448 Otherwise, if this node receiving the Route Request has recently seen 449 another Route Request message from this initiator bearing this same 450 request identification and target address, or if this node's own 451 address is already listed in the route record in the Route Request, 452 this node discards the Request. Otherwise, this node appends its 453 own address to the route record in the Route Request and propagates 454 it by transmitting it as a local broadcast packet (with the same 455 request identification). In this example, node B broadcast the Route 456 Request, which is received by node C; nodes C and D each also, in 457 turn, broadcast the Request, resulting in a copy of the Request being 458 received by node E. 460 In returning the Route Reply to the initiator of the Route Discovery, 461 such as in this example, node E replying back to node A, node E will 462 typically examine its own Route Cache for a route back to A, and if 463 found, will use it for the source route for delivery of the packet 464 containing the Route Reply. Otherwise, E SHOULD perform its own 465 Route Discovery for target node A, but to avoid possible infinite 466 recursion of Route Discoveries, it MUST piggyback this Route Reply 467 on the packet containing its own Route Request for A. It is also 468 possible to piggyback other small data packets, such as a TCP SYN 469 packet [31], on a Route Request using this same mechanism. 471 Node E could instead simply reverse the sequence of hops in the route 472 record that it is trying to send in the Route Reply, and use this as 473 the source route on the packet carrying the Route Reply itself. For 474 MAC protocols such as IEEE 802.11 that require a bidirectional frame 475 exchange as part of the MAC protocol [13], the discovered source 476 route MUST be reversed in this way to return the Route Reply since it 477 tests the discovered route to ensure it is bidirectional before the 478 Route Discovery initiator begins using the route; this route reversal 479 also avoids the overhead of a possible second Route Discovery. 481 However, this route reversal technique will prevent the discovery of 482 routes using unidirectional links, and in wireless environments where 483 the use of unidirectional links is permitted, such routes may in some 484 cases be more efficient than those with only bidirectional links, or 485 they may be the only way to achieve connectivity to the target node. 487 When initiating a Route Discovery, the sending node saves a copy of 488 the original packet (that triggered the Discovery) in a local buffer 489 called the "Send Buffer". The Send Buffer contains a copy of each 490 packet that cannot be transmitted by this node because it does not 491 yet have a source route to the packet's destination. Each packet in 492 the Send Buffer is logically associated with the time that it was 493 placed into the Send Buffer and is discarded after residing in the 494 Send Buffer for some timeout period; if necessary for preventing the 495 Send Buffer from overflowing, a FIFO or other replacement strategy 496 MAY also be used to evict packets even before they expire. 498 While a packet remains in the Send Buffer, the node SHOULD 499 occasionally initiate a new Route Discovery for the packet's 500 destination address. However, the node MUST limit the rate at which 501 such new Route Discoveries for the same address are initiated, since 502 it is possible that the destination node is not currently reachable. 503 In particular, due to the limited wireless transmission range and the 504 movement of the nodes in the network, the network may at times become 505 partitioned, meaning that there is currently no sequence of nodes 506 through which a packet could be forwarded to reach the destination. 507 Depending on the movement pattern and the density of nodes in the 508 network, such network partitions may be rare or may be common. 510 If a new Route Discovery was initiated for each packet sent by a 511 node in such a partitioned network, a large number of unproductive 512 Route Request packets would be propagated throughout the subset 513 of the ad hoc network reachable from this node. In order to 514 reduce the overhead from such Route Discoveries, a node SHOULD use 515 an exponential back-off algorithm to limit the rate at which it 516 initiates new Route Discoveries for the same target, doubling the 517 timeout between each successive Discovery initiated for the same 518 target. If the node attempts to send additional data packets to this 519 same destination node more frequently than this limit, the subsequent 520 packets SHOULD be buffered in the Send Buffer until a Route Reply is 521 received giving a route to this destination, but the node MUST NOT 522 initiate a new Route Discovery until the minimum allowable interval 523 between new Route Discoveries for this target has been reached. This 524 limitation on the maximum rate of Route Discoveries for the same 525 target is similar to the mechanism required by Internet nodes to 526 limit the rate at which ARP Requests are sent for any single target 527 IP address [3]. 529 3.2. Basic DSR Route Maintenance 531 When originating or forwarding a packet using a source route, each 532 node transmitting the packet is responsible for confirming that data 533 can flow over the link from that node to the next hop. For example, 534 in the situation shown below, node A has originated a packet for 535 node E using a source route through intermediate nodes B, C, and D: 537 +-----+ +-----+ +-----+ +-----+ +-----+ 538 | A |---->| B |---->| C |-->? | D | | E | 539 +-----+ +-----+ +-----+ +-----+ +-----+ 541 In this case, node A is responsible for the link from A to B, node B 542 is responsible for the link from B to C, node C is responsible for 543 the link from C to D, node D is responsible for the link from D to E. 545 An acknowledgement can provide confirmation that a link is capable of 546 carrying data, and in wireless networks, acknowledgements are often 547 provided at no cost, either as an existing standard part of the MAC 548 protocol in use (such as the link-layer acknowledgement frame defined 549 by IEEE 802.11 [13]), or by a "passive acknowledgement" [18] (in 550 which, for example, B confirms receipt at C by overhearing C transmit 551 the packet when forwarding it on to D). 553 If a built-in acknowledgement mechanism is not available, the 554 node transmitting the packet can explicitly request a DSR-specific 555 software acknowledgement be returned by the next node along the 556 route; this software acknowledgement will normally be transmitted 557 directly to the sending node, but if the link between these two nodes 558 is unidirectional, this software acknowledgement could travel over a 559 different, multi-hop path. 561 After an acknowledgement has been received from some neighbor, a node 562 MAY choose to not require acknowledgements from that neighbor for a 563 brief period of time, unless the network interface connecting a node 564 to that neighbor always receives an acknowledgement in response to 565 unicast traffic. 567 When a software acknowledgement is used, the acknowledgement 568 request SHOULD be retransmitted up to a maximum number of times. 569 A retransmission of the acknowledgement request can be sent as a 570 separate packet, piggybacked on a retransmission of the original 571 data packet, or piggybacked on any packet with the same next-hop 572 destination that does not also contain a software acknowledgement. 574 After the acknowledgement request has been retransmitted the maximum 575 number of times, if no acknowledgement has been received, then the 576 sender treats the link to this next-hop destination as currently 577 "broken". It SHOULD remove this link from its Route Cache and 578 SHOULD return a "Route Error" to each node that has sent a packet 579 routed over that link since an acknowledgement was last received. 580 For example, in the situation shown above, if C does not receive 581 an acknowledgement from D after some number of requests, it would 582 return a Route Error to A, as well as any other node that may have 583 used the link from C to D since C last received an acknowledgement 584 from D. Node A then removes this broken link from its cache; any 585 retransmission of the original packet can be performed by upper 586 layer protocols such as TCP, if necessary. For sending such a 587 retransmission or other packets to this same destination E, if A has 588 in its Route Cache another route to E (for example, from additional 589 Route Replies from its earlier Route Discovery, or from having 590 overheard sufficient routing information from other packets), it 591 can send the packet using the new route immediately. Otherwise, it 592 SHOULD perform a new Route Discovery for this target (subject to the 593 back-off described in Section 3.1). 595 3.3. Additional Route Discovery Features 597 3.3.1. Caching Overheard Routing Information 599 A node forwarding or otherwise overhearing any packet SHOULD add all 600 usable routing information from that packet to its own Route Cache. 601 The usefulness of routing information in a packet depends on the 602 directionality characteristics of the physical medium (Section 2), as 603 well as the MAC protocol being used. Specifically, three distinct 604 cases are possible: 606 - Links in the network frequently are capable of operating only 607 unidirectionally (not bidirectionally), and the MAC protocol in 608 use in the network is capable of transmitting unicast packets 609 over unidirectional links. 611 - Links in the network occasionally are capable of operating only 612 unidirectionally (not bidirectionally), but this unidirectional 613 restriction on any link is not persistent, almost all links 614 are physically bidirectional, and the MAC protocol in use in 615 the network is capable of transmitting unicast packets over 616 unidirectional links. 618 - The MAC protocol in use in the network is not capable of 619 transmitting unicast packets over unidirectional links; 620 only bidirectional links can be used by the MAC protocol for 621 transmitting unicast packets. For example, the IEEE 802.11 622 Distributed Coordination Function (DCF) MAC protocol [13] 623 is capable of transmitting a unicast packet only over a 624 bidirectional link, since the MAC protocol requires the return of 625 a link-level acknowledgement packet from the receiver and also 626 optionally requires the bidirectional exchange of an RTS and CTS 627 packet between the transmitter and receiver nodes. 629 In the first case above, for example, the source route used in a data 630 packet, the accumulated route record in a Route Request, or the route 631 being returned in a Route Reply SHOULD all be cached by any node in 632 the "forward" direction; any node SHOULD cache this information from 633 any such packet received, whether the packet was addressed to this 634 node, sent to a broadcast (or multicast) MAC address, or overheard 635 while the node's network interface is in promiscuous mode. However, 636 the "reverse" direction of the links identified in such packet 637 headers SHOULD NOT be cached. 639 For example, in the situation shown below, node A is using a source 640 route to communicate with node E: 642 +-----+ +-----+ +-----+ +-----+ +-----+ 643 | A |---->| B |---->| C |---->| D |---->| E | 644 +-----+ +-----+ +-----+ +-----+ +-----+ 646 As node C forwards a data packet along the route from A to E, it 647 SHOULD add to its cache the presence of the "forward" direction 648 links that it learns from the headers of these packets, from itself 649 to D and from D to E. Node C SHOULD NOT, in this case, cache the 650 "reverse" direction of the links identified in these packet headers, 651 from itself back to B and from B to A, since these links might be 652 unidirectional. 654 In the second case above, in which links may occasionally operate 655 unidirectionally, the links described above SHOULD be cached in both 656 directions. Furthermore, in this case, if node X overhears (e.g., 657 through promiscuous mode) a packet transmitted by node C that is 658 using a source route from node A to E, node X SHOULD cache all of 659 these links as well, also including the link from C to X over which 660 it overheard the packet. 662 In the final case, in which the MAC protocol requires physical 663 bidirectionality for unicast operation, links from a source route 664 SHOULD be cached in both directions, except when the packet also 665 contains a Route Reply, in which case only the links already 666 traversed in this source route SHOULD be cached, but the links not 667 yet traversed in this route SHOULD NOT be cached. 669 3.3.2. Replying to Route Requests using Cached Routes 671 A node receiving a Route Request for which it is not the target, 672 searches its own Route Cache for a route to the target of the 673 Request. If found, the node generally returns a Route Reply to the 674 initiator itself rather than forwarding the Route Request. In the 675 Route Reply, this node sets the route record to list the sequence of 676 hops over which this copy of the Route Request was forwarded to it, 677 concatenated with the source route to this target obtained from its 678 own Route Cache. 680 However, before transmitting a Route Reply packet that was generated 681 using information from its Route Cache in this way, a node MUST 682 verify that the resulting route being returned in the Route Reply, 683 after this concatenation, contains no duplicate nodes listed in the 684 route record. For example, the figure below illustrates a case in 685 which a Route Request for target E has been received by node F, and 686 node F already has in its Route Cache a route from itself to E: 688 +-----+ +-----+ +-----+ +-----+ 689 | A |---->| B |- >| D |---->| E | 690 +-----+ +-----+ \ / +-----+ +-----+ 691 \ / 692 \ +-----+ / 693 >| C |- 694 +-----+ 695 | ^ 696 v | 697 Route Request +-----+ 698 Route: A - B - C - F | F | Cache: C - D - E 699 +-----+ 701 The concatenation of the accumulated route record from the Route 702 Request and the cached route from F's Route Cache would include a 703 duplicate node in passing from C to F and back to C. 705 Node F in this case could attempt to edit the route to eliminate the 706 duplication, resulting in a route from A to B to C to D and on to E, 707 but in this case, node F would not be on the route that it returned 708 in its own Route Reply. DSR Route Discovery prohibits node F 709 from returning such a Route Reply from its cache; this prohibition 710 increases the probability that the resulting route is valid, since 711 node F in this case should have received a Route Error if the route 712 had previously stopped working. Furthermore, this prohibition 713 means that a future Route Error traversing the route is very likely 714 to pass through any node that sent the Route Reply for the route 715 (including node F), which helps to ensure that stale data is removed 716 from caches (such as at F) in a timely manner; otherwise, the next 717 Route Discovery initiated by A might also be contaminated by a Route 718 Reply from F containing the same stale route. If node F, due to this 719 restriction on returning a Route Reply based on information from its 720 Route Cache, does not return such a Route Reply, node F propagates 721 the Route Request normally. 723 3.3.3. Preventing Route Reply Storms 725 The ability for nodes to reply to a Route Request based on 726 information in their Route Caches, as described in Section 3.3.2, 727 could result in a possible Route Reply "storm" in some cases. In 728 particular, if a node broadcasts a Route Request for a target node 729 for which the node's neighbors have a route in their Route Caches, 730 each neighbor may attempt to send a Route Reply, thereby wasting 731 bandwidth and possibly increasing the number of network collisions in 732 the area. 734 For example, the figure below shows a situation in which nodes B, C, 735 D, E, and F all receive A's Route Request for target G, and each has 736 the indicated route cached for this target: 738 +-----+ +-----+ 739 | D |< >| C | 740 +-----+ \ / +-----+ 741 Cache: C - B - G \ / Cache: B - G 742 \ +-----+ / 743 -| A |- 744 +-----+\ +-----+ +-----+ 745 | | \--->| B | | G | 746 / \ +-----+ +-----+ 747 / \ Cache: G 748 v v 749 +-----+ +-----+ 750 | E | | F | 751 +-----+ +-----+ 752 Cache: F - B - G Cache: B - G 754 Normally, each of these nodes would attempt to reply from its own 755 Route Cache, and they would thus all send their Route Replies at 756 about the same time, since they all received the broadcast Route 757 Request at about the same time. Such simultaneous Route Replies 758 from different nodes all receiving the Route Request may cause local 759 congestion in the wireless network and may create packet collisions 760 among some or all of these Replies if the MAC protocol in use does 761 not provide sufficient collision avoidance for these packets. In 762 addition, it will often be the case that the different replies will 763 indicate routes of different lengths, as shown in this example. 765 In order to reduce these effects, if a node can put its network 766 interface into promiscuous receive mode, it MAY delay sending its 767 own Route Reply for a short period, while listening to see if the 768 initiating node begins using a shorter route first. Specifically, 769 this node MAY delay sending its own Route Reply for a random period 771 d = H * (h - 1 + r) 773 where h is the length in number of network hops for the route to be 774 returned in this node's Route Reply, r is a random floating point 775 number between 0 and 1, and H is a small constant delay (at least 776 twice the maximum wireless link propagation delay) to be introduced 777 per hop. This delay effectively randomizes the time at which each 778 node sends its Route Reply, with all nodes sending Route Replies 779 giving routes of length less than h sending their Replies before this 780 node, and all nodes sending Route Replies giving routes of length 781 greater than h sending their Replies after this node. 783 Within the delay period, this node promiscuously receives all 784 packets, looking for data packets from the initiator of this Route 785 Discovery destined for the target of the Discovery. If such a data 786 packet received by this node during the delay period uses a source 787 route of length less than or equal to h, this node may infer that the 788 initiator of the Route Discovery has already received a Route Reply 789 giving an equally good or better route. In this case, this node 790 SHOULD cancel its delay timer and SHOULD NOT send its Route Reply for 791 this Route Discovery. 793 3.3.4. Route Request Hop Limits 795 Each Route Request message contains a "hop limit" that may be used 796 to limit the number of intermediate nodes allowed to forward that 797 copy of the Route Request. This hop limit is implemented using the 798 Time-to-Live (TTL) field in the IP header of the packet carrying 799 the Route Request. As the Request is forwarded, this limit is 800 decremented, and the Request packet is discarded if the limit reaches 801 zero before finding the target. This Route Request hop limit can be 802 used to implement a variety of algorithms for controlling the spread 803 of a Route Request during a Route Discovery attempt. 805 For example, a node MAY use this hop limit to implement a 806 "non-propagating" Route Request as an initial phase of a Route 807 Discovery. A node using this technique sends its first Route Request 808 attempt for some target node using a hop limit of 1, such that any 809 node receiving the initial transmission of the Route Request will 810 not forward the Request to other nodes by re-broadcasting it. This 811 form of Route Request is called a "non-propagating" Route Request; 812 it provides an inexpensive method for determining if the target is 813 currently a neighbor of the initiator or if a neighbor node has a 814 route to the target cached (effectively using the neighbors' Route 815 Caches as an extension of the initiator's own Route Cache). If no 816 Route Reply is received after a short timeout, then the node sends a 817 "propagating" Route Request (i.e., with no hop limit) for the target 818 node. 820 As another example, a node MAY use this hop limit to implement an 821 "expanding ring" search for the target [16]. A node using this 822 technique sends an initial non-propagating Route Request as described 823 above; if no Route Reply is received for it, the node originates 824 another Route Request with a hop limit of 2. For each Route Request 825 originated, if no Route Reply is received for it, the node doubles 826 the hop limit used on the previous attempt, to progressively explore 827 for the target node without allowing the Route Request to propagate 828 over the entire network. However, this expanding ring search 829 approach could have the effect of increasing the average latency of 830 Route Discovery, since multiple Discovery attempts and timeouts may 831 be needed before discovering a route to the target node. 833 3.4. Additional Route Maintenance Features 835 3.4.1. Packet Salvaging 837 When an intermediate node forwarding a packet detects through Route 838 Maintenance that the next hop along the route for that packet is 839 broken, if the node has another route to the packet's destination in 840 its Route Cache, the node SHOULD "salvage" the packet rather than 841 discarding it. To salvage a packet, the node replaces the original 842 source route on the packet with the route from its Route Cache. The 843 node then forwards the packet to the next node indicated along this 844 source route. For example, in the situation shown in the example of 845 Section 3.2, if node C has another route cached to node E, it can 846 salvage the packet by replacing the original route in the packet with 847 this new route from its own Route Cache, rather than discarding the 848 packet. 850 When salvaging a packet, a count is maintained in the packet of the 851 number of times that it has been salvaged, to prevent a single packet 852 from being salvaged endlessly. Otherwise, it could be possible for 853 the packet to enter a routing loop, as different nodes repeatedly 854 salvage the packet and replace the source route on the packet with 855 routes to each other. 857 As described in Section 3.2, an intermediate node, such as in this 858 case, that detects through Route Maintenance that the next hop along 859 the route for a packet that it is forwarding is broken, the node also 860 SHOULD return a Route Error to the original sender of the packet, 861 identifying the link over which the packet could not be forwarded. 862 If the node sends this Route Error, it SHOULD originate the Route 863 Error before salvaging the packet. 865 3.4.2. Queued Packets Destined over a Broken Link 867 When an intermediate node forwarding a packet detects through Route 868 Maintenance that the next-hop link along the route for that packet 869 is broken, in addition to handling that packet as defined for Route 870 Maintenance, the node SHOULD also handle in a similar way any pending 871 packets that it has queued that are destined over this new broken 872 link. Specifically, the node SHOULD search its Network Interface 873 Queue and Maintenance Buffer (Section 4.5) for packets for which 874 the next-hop link is this new broken link. For each such packet 875 currently queued at this node, the node SHOULD process that packet as 876 follows: 878 - Remove the packet from the node's Network Interface Queue and 879 Maintenance Buffer. 881 - Originate a Route Error for this packet to the original sender of 882 the packet, using the procedure described in Section 8.3.4, as if 883 the node had already reached the maximum number of retransmission 884 attempts for that packet for Route Maintenance. However, in 885 sending such Route Errors for queued packets in response to a 886 single new broken link detected, the node SHOULD send no more 887 than one Route Error to each original sender of any of these 888 packets. 890 - If the node has another route to the packet's IP 891 Destination Address in its Route Cache, the node SHOULD 892 salvage the packet as described in Section 8.3.6. Otherwise, the 893 node SHOULD discard the packet. 895 3.4.3. Automatic Route Shortening 897 Source routes in use MAY be automatically shortened if one or more 898 intermediate nodes in the route become no longer necessary. This 899 mechanism of automatically shortening routes in use is somewhat 900 similar to the use of passive acknowledgements [18]. In particular, 901 if a node is able to overhear a packet carrying a source route (e.g., 902 by operating its network interface in promiscuous receive mode), then 903 this node examines the unexpended portion of that source route. If 904 this node is not the intended next-hop destination for the packet 905 but is named in the later unexpended portion of the packet's source 906 route, then it can infer that the intermediate nodes before itself in 907 the source route are no longer needed in the route. For example, the 908 figure below illustrates an example in which node D has overheard a 909 data packet being transmitted from B to C, for later forwarding to D 910 and to E: 912 +-----+ +-----+ +-----+ +-----+ +-----+ 913 | A |---->| B |---->| C | | D | | E | 914 +-----+ +-----+ +-----+ +-----+ +-----+ 915 \ ^ 916 \ / 917 --------------------- 919 In this case, this node (node D) SHOULD return a "gratuitous" Route 920 Reply to the original sender of the packet (node A). The Route 921 Reply gives the shorter route as the concatenation of the portion of 922 the original source route up through the node that transmitted the 923 overheard packet (node B), plus the suffix of the original source 924 route beginning with the node returning the gratuitous Route Reply 925 (node D). In this example, the route returned in the gratuitous Route 926 Reply message sent from D to A gives the new route as the sequence of 927 hops from A to B to D to E. 929 When deciding whether to return a gratuitous Route Reply in this way, 930 a node MAY factor in additional information beyond the fact that it 931 was able to overhear the packet. For example, the node MAY decide to 932 return the gratuitous Route Reply only when the overheard packet is 933 received with a signal strenth or signal-to-noise ratio above some 934 specific threshold. In addition, each node maintains a Gratuitous 935 Route Reply Table, as described in Section 4.4, to limit the rate at 936 which it originates gratuitous Route Replies for the same returned 937 route. 939 3.4.4. Increased Spreading of Route Error Messages 941 When a source node receives a Route Error for a data packet that 942 it originated, this source node propagates this Route Error to its 943 neighbors by piggybacking it on its next Route Request. In this way, 944 stale information in the caches of nodes around this source node will 945 not generate Route Replies that contain the same invalid link for 946 which this source node received the Route Error. 948 For example, in the situation shown in the example of Section 3.2, 949 node A learns from the Route Error message from C, that the link 950 from C to D is currently broken. It thus removes this link from 951 its own Route Cache and initiates a new Route Discovery (if it has 952 no other route to E in its Route Cache). On the Route Request 953 packet initiating this Route Discovery, node A piggybacks a copy 954 of this Route Error, ensuring that the Route Error spreads well to 955 other nodes, and guaranteeing that any Route Reply that it receives 956 (including those from other node's Route Caches) in response to this 957 Route Request does not contain a route that assumes the existence of 958 this broken link. 960 3.5. Optional DSR Flow State Extension 962 This section describes an optional, compatible extension to the DSR 963 protocol, known as "flow state", that allows the routing of most 964 packets without an explicit source route header in the packet. The 965 DSR flow state extension further reduces the overhead of the protocol 966 yet still preserves the fundamental properties of DSR's operation. 967 Once a sending node has discovered a source route such as through 968 DSR's Route Discovery mechanism, the flow state mechanism allows the 969 sending node to establish hop-by-hop forwarding state within the 970 network, based on this source route, to enable each node along the 971 route to forward the packet to the next hop based on the node's own 972 local knowledge of the flow along which this packet is being routed. 973 Flow state is dynamically initialized by the first packet using a 974 source route and is then able to route subsequent packets along 975 the same flow without use of a source route header in the packet. 976 The state established at each hop along a flow is "soft state" and 977 thus automatically expires when no longer needed and can be quickly 978 recreated as necessary. Extending DSR's basic operation based on an 979 explicit source route in the header of each packet routed, the flow 980 state extension operates as a form of "implicit source routing" by 981 preserving DSR's basic operation but removing the explicit source 982 route from packets. 984 3.5.1. Flow Establishment 986 A source node sending packets to some destination node MAY use the 987 DSR flow state extension described here to establish a route to 988 that destination as a flow. A "flow" is a route from the source to 989 the destination represented by hop-by-hop forwarding state within 990 the nodes along the route. Each flow is uniquely identified by a 991 combination of the source node address, the destination node address, 992 and a flow identifier (flow ID) chosen by the source node. 994 Each flow ID is a 16-bit unsigned integer. Comparison between 995 different flow IDs MUST be performed modulo 2**16. For example, 996 using an implementation in the C programming language, a 997 flow ID value (a) is greater than another flow ID value (b) if 998 ((short)((a) - (b)) > 0), if a C language "short" data type is 999 implemented as a 16-bit signed integer. 1001 A DSR Flow State header in a packet identifies the flow ID to 1002 be followed in forwarding that packet. From a given source to 1003 some destination, any number of different flows MAY exist and 1004 be in use, for example following different sequences of hops to 1005 reach the destination. One of these flows may be considered to be 1006 the "default" flow from that source to that destination. A node 1007 receiving a packet with neither a DSR Options header specifying the 1008 route to be taken (with a Source Route option in the DSR Options 1009 header) nor a DSR Flow State header specifying the flow ID to be 1010 followed, is forwarded along the default flow for the source and 1011 destination addresses specified in the packet's IP header. 1013 In establishing a new flow, the source node generates a nonzero 1014 16-bit flow ID greater than any unexpired flow IDs for this 1015 (source, destination) pair. If the source wishes for this flow to 1016 become the default flow, the low bit of the flow ID MUST be set (the 1017 flow ID is an odd number); otherwise, the low bit MUST NOT be set 1018 (the flow ID is an even number). 1020 The source node establishing the new flow then transmits a packet 1021 containing a DSR Options header with a Source Route option; to 1022 establish the flow, the source node also MUST include in the packet 1023 a DSR Flow State header, with the Flow ID field set to the chosen 1024 flow ID for the new flow, and MUST include a Timeout option in the 1025 DSR Options header, giving the lifetime after which state information 1026 about this flow is to expire. This packet will generally be a normal 1027 data packet being sent from this sender to the receiver (for example, 1028 the first packet sent after discovering the new route) but is also 1029 treated as a "flow establishment" packet. 1031 The source node records this flow in its Flow Table for future use, 1032 setting the TTL in this Flow Table entry to be the value used in the 1033 TTL field in the packet's IP header and setting the Lifetime in this 1034 entry to be the lifetime specified in the Timeout option in the DSR 1035 Options header. 1037 Any further packets sent with this flow ID before the timeout that 1038 also contain a DSR Options header with a Source Route option MUST use 1039 this same source route in the Source Route option. 1041 3.5.2. Receiving and Forwarding Establishment Packets 1043 Packets intended to establish a flow, as described in Section 3.5.1, 1044 contain a DSR Options header with a Source Route option, and are 1045 forwarded along the indicated route. A node implementing the DSR 1046 flow state extension, when receiving and forwarding such a DSR 1047 packet, also keeps some state in its own Flow Table to enable it 1048 to forward future packets that are sent along this flow with only 1049 the flow ID specified. Specifically, if the packet also contains 1050 a DSR Flow State header, this packet SHOULD cause an entry to be 1051 established for this flow in the Flow Table of each node along the 1052 packet's route. 1054 The Hop Count field of the DSR Flow State header is also stored in 1055 the Flow Table, as is Lifetime option specified in the DSR Options 1056 header. 1058 If the Flow ID is odd and there is no flow in the Flow Table with 1059 Flow ID greater than the received Flow ID, set the default Flow ID 1060 for this (IP Source Address, IP Destination Address) pair to the 1061 received Flow ID, and the TTL of the packet is recorded. 1063 The Flow ID option is removed before final delivery of the packet. 1065 3.5.3. Sending Packets Along Established Flows 1067 When a flow is established as described in Section 3.5.1, a packet 1068 is sent which establishes state in each node along the route. 1069 This state is soft; that is, the protocol contains mechanisms for 1070 recovering from the loss of this state. However, the use of these 1071 mechanisms may result in reduced performance for packets sent 1072 along flows with forgotten state. As a result, it is desirable 1073 to differentiate behavior based on whether or not the sender is 1074 reasonably certain that the flow state exists on each node along 1075 the route. We define a flow's state to be "established end-to-end" 1076 if the Flow Tables of all nodes on the route contains forwarding 1077 information for that flow. While it is impossible to detect whether 1078 or not a flow's state has been established end-to-end without sending 1079 packets, implementations may make reasonable assumptions about the 1080 retention of flow state and the probability that an establishment 1081 packet has been seen by all nodes on the route. 1083 A source wishing to send a packet along an established flow 1084 determines if the flow state has been established end-to-end. If 1085 it has not, a DSR Options header with Source Route option with this 1086 flow's route is added to the packet. The source SHOULD set the 1087 Flow ID field of the DSR Flow State header either to the flow ID 1088 previously associated with this flow's route or to zero. If it sets 1089 the Flow ID field to any other value, it MUST follow the processing 1090 steps in Section 3.5.1 for establishing a new flow ID. If it sets the 1091 Flow ID field to a nonzero value, it MUST include a Timeout option 1092 with a value not greater than the timeout remaining in the node's 1093 Flow Table, and if its TTL is not equal to that specified in the Flow 1094 Table, the flow MUST NOT be used as a default flow in the future. 1096 Once flow state has been established end-to-end for non-default 1097 flows, a source adds a DSR Flow State header to each packet it wishes 1098 to send along that flow, setting the Flow ID field to the flow ID of 1099 that flow. A Source Route option SHOULD NOT be added to the packet, 1100 though if one is, then the steps for processing flows that have not 1101 been established end to end MUST be followed. 1103 Once flow state has been established end-to-end for default flows, 1104 sources sending packets with IP TTL equal to the TTL value in the 1105 local Flow Table entry for this flow then transmit the packet to the 1106 next hop. In this case, a DSR Flow State header SHOULD NOT be added 1107 to the packet and a DSR Options header likewise SHOULD NOT be added 1108 to the packet; though if one is, the steps for sending packets along 1109 non-default flows MUST be followed. If the IP TTL is not equal to 1110 the TTL value in the local Flow Table, then the steps for processing 1111 a non-default flow MUST be followed. 1113 3.5.4. Receiving and Forwarding Packets Sent Along Established Flows 1115 The handling of packets containing a DSR Options header with 1116 both a nonzero Flow ID and a Source Route option is described in 1117 Section 3.5.2. The Flow ID is ignored when it is equal to zero. 1118 This section only describes handling of packets without a Source 1119 Route option. 1121 If a node receives a packet with a Flow ID in the DSR Options 1122 header that indicates an unexpired flow in the node's Flow Table, it 1123 increments the Hop Count in the DSR Options header and forwards the 1124 packet to the next hop indicated in the Flow Table. 1126 If a node receives a packet with a Flow ID that indicates a flow not 1127 currently in the node's Flow Table, it returns a Route Error of type 1128 UNKNOWN_FLOW with Error Destination and IP Destination addresses 1129 copied from the IP Source of the packet triggering the error. This 1130 error packet SHOULD be MAC-destined to the node from which it was 1131 received; if it cannot confirm reachability of the previous node 1132 using Route Maintenance, it MUST send the error as described in 1133 Section 8.1.1. The node sending the error SHOULD attempt to salvage 1134 the packet triggering the Route Error. If it does salvage the 1135 packet, it MUST zero the Flow ID. 1137 If a node receives a packet with no DSR Options header and no DSR 1138 Flow State header, it checks the Default Flow Table. If there is 1139 an entry, it forwards to the next hop indicated in the Flow Table 1140 for the default flow. Otherwise, it returns a Route Error of type 1141 DEFAULT_FLOW_UNKNOWN with Error Destination and IP Destination 1142 addresses copied from the IP Source of the packet triggering the 1143 error. This error packet SHOULD be MAC-destined to the node from 1144 which it was received; if it cannot confirm reachability of the 1145 previous node using Route Maintenance, it MUST send the error as 1146 described in Section 8.1.1. The node sending the error SHOULD 1147 attempt to salvage the packet triggering the Route Error. If it does 1148 salvage the packet, it MUST zero the Flow ID. 1150 3.5.5. Processing Route Errors 1152 When a node receives a Route Error of type Unknown Flow, it marks 1153 the flow to indicate that it has not been established end-to-end. 1154 When a node receives a Route Error of type Default Flow Unknown, it 1155 marks the default flow to indicate that it has not been established 1156 end-to-end. 1158 3.5.6. Interaction with Automatic Route Shortening 1160 Because a full source route is not carried in every packet, an 1161 alternative method for performing automatic route shortening is 1162 necessary for packets using the flow state extension. Instead, nodes 1163 promiscuously listen to packets, and if a node receives a packet 1164 with (IP Source, IP Destination, Flow ID) found in the Flow Table 1165 but the MAC-layer (next hop) destination address of the packet is 1166 not this node, the node determines whether the packet was sent by 1167 an upstream or downstream node by examining the Hop Count field in 1168 the DSR Flow State header. If the Hop Count field is less than the 1169 expected Hop Count at this node, the node assumes that the packet 1170 was sent by an upstream node, and adds an entry for the packet to 1171 its Automatic Route Shortening Table, possibly evicting an earlier 1172 entry added to this table. When the packet is then sent to that node 1173 for forwarding, the node finds that it has previously received the 1174 packet by checking its Automatic Route Shortening Table, and returns 1175 a gratuitous Route Reply to the source of the packet. 1177 3.5.7. Loop Detection 1179 If a node receives a packet for forwarding with adjusted TTL lower 1180 than expected and default flow forwarding is being used, it sends 1181 a Route Error of type Default Flow Unknown back to the IP source. 1182 It can attempt delivery of the packet by normal salvaging (subject 1183 to constraints described in Section 8.6.7) or by inserting a 1184 Flow ID option with Special TTL extension based on what that node's 1185 understanding of the default Flow ID and TTL. 1187 3.5.8. Acknowledgement Destination 1189 In packets sent using Flow State, the previous hop is not necessarily 1190 known. In order to allow nodes that have lost flow state to 1191 determine the previous hop, the address of the previous hop can 1192 optionally be stored in the Acknowledgement Request. This extension 1193 SHOULD NOT be used when a Source Route option is present, MAY be used 1194 when flow state routing is used without a Source Route option, and 1195 SHOULD be used before Route Maintenance determines that the next-hop 1196 destination is unreachable. 1198 3.5.9. Crash Recovery 1200 Each node has a maximum Timeout value that it can possibly generate. 1201 This can be based on the largest number that can be set in a timeout 1202 option (2**16 - 1 seconds) or set in system software. When a node 1203 crashes, it does not establish new flows for a period equal to this 1204 maximum Timeout value, in order to avoid colliding with its old 1205 Flow IDs. 1207 3.5.10. Rate Limiting 1209 Flow IDs can be assigned with a counter. More specifically, the 1210 "Current Flow ID" is kept. When a new default Flow ID needs to be 1211 assigned, if the Current Flow ID is odd, the Current Flow ID is 1212 assigned as the Flow ID and the Current Flow ID is incremented by 1213 one; if the Current Flow ID is even, one plus the Current Flow ID is 1214 assigned as the Flow ID and the Current Flow ID is incremented by 1215 two. 1217 If Flow IDs are assigned in this way, one algorithm for avoiding 1218 duplicate, unexpired Flow IDs is to rate limit new Flow IDs to an 1219 average rate of n assignments per second, where n is 2**15 divided by 1220 the maximum Timeout value. This can be averaged over any period not 1221 exceeding the maximum Timeout value. 1223 3.5.11. Interaction with Packet Salvaging 1225 Salvaging is modified to zero the Flow ID field. Also, any time the 1226 this document refers to the Salvage field in the Source Route option 1227 in a DSR Options header, packets without a Source Route option are 1228 considered to have the value zero in the Salvage field. 1230 4. Conceptual Data Structures 1232 This document describes the operation of the DSR protocol in terms 1233 of a number of conceptual data structures. This section describes 1234 each of these data structures and provides an overview of its use 1235 in the protocol. In an implementation of the protocol, these data 1236 structures MAY be implemented in any manner consistent with the 1237 external behavior described in this document. 1239 4.1. Route Cache 1241 All ad hoc network routing information needed by a node implementing 1242 DSR is stored in that node's Route Cache. Each node in the network 1243 maintains its own Route Cache. A node adds information to its 1244 Route Cache as it learns of new links between nodes in the ad hoc 1245 network; for example, a node may learn of new links when it receives 1246 a packet carrying a Route Request, Route Reply, or DSR source route. 1247 Likewise, a node removes information from its Route Cache as it 1248 learns that existing links in the ad hoc network have broken; for 1249 example, a node may learn of a broken link when it receives a packet 1250 carrying a Route Error or through the link-layer retransmission 1251 mechanism reporting a failure in forwarding a packet to its next-hop 1252 destination. 1254 Anytime a node adds new information to its Route Cache, the node 1255 SHOULD check each packet in its own Send Buffer (Section 4.2) to 1256 determine whether a route to that packet's IP Destination Address 1257 now exists in the node's Route Cache (including the information just 1258 added to the Cache). If so, the packet SHOULD then be sent using 1259 that route and removed from the Send Buffer. 1261 It is possible to interface a DSR network with other networks, 1262 external to this DSR network. Such external networks may, for 1263 example, be the Internet, or may be other ad hoc networks routed 1264 with a routing protocol other than DSR. Such external networks may 1265 also be other DSR networks that are treated as external networks 1266 in order to improve scalability. The complete handling of such 1267 external networks is beyond the scope of this document. However, 1268 this document specifies a minimal set of requirements and features 1269 necessary to allow nodes only implementing this specification to 1270 interoperate correctly with nodes implementing interfaces to such 1271 external networks. This minimal set of requirements and features 1272 involve the First Hop External (F) and Last Hop External (L) bits 1273 in a DSR Source Route option (Section 6.7) and a Route Reply option 1274 (Section 6.3) in a packet's DSR Options header (Section 6). These 1275 requirements also include the addition of an External flag bit 1276 tagging each link in the Route Cache, copied from the First Hop 1277 External (F) and Last Hop External (L) bits in the DSR Source Route 1278 option or Route Reply option from which this link was learned. 1280 The Route Cache SHOULD support storing more than one route to each 1281 destination. In searching the Route Cache for a route to some 1282 destination node, the Route Cache is indexed by destination node 1283 address. The following properties describe this searching function 1284 on a Route Cache: 1286 - Each implementation of DSR at any node MAY choose any appropriate 1287 strategy and algorithm for searching its Route Cache and 1288 selecting a "best" route to the destination from among those 1289 found. For example, a node MAY choose to select the shortest 1290 route to the destination (the shortest sequence of hops), or it 1291 MAY use an alternate metric to select the route from the Cache. 1293 - However, if there are multiple cached routes to a destination, 1294 the selection of routes when searching the Route Cache MUST 1295 prefer routes that do not have the External flag set on any link. 1296 This preference will select routes that lead directly to the 1297 target node over routes that attempt to reach the target via any 1298 external networks connected to the DSR ad hoc network. 1300 - In addition, any route selected when searching the Route Cache 1301 MUST NOT have the External bit set for any links other than 1302 possibly the first link, the last link, or both; the External bit 1303 MUST NOT be set for any intermediate hops in the route selected. 1305 An implementation of a Route Cache MAY provide a fixed capacity 1306 for the cache, or the cache size MAY be variable. The following 1307 properties describe the management of available space within a node's 1308 Route Cache: 1310 - Each implementation of DSR at each node MAY choose any 1311 appropriate policy for managing the entries in its Route Cache, 1312 such as when limited cache capacity requires a choice of which 1313 entries to retain in the Cache. For example, a node MAY chose a 1314 "least recently used" (LRU) cache replacement policy, in which 1315 the entry last used longest ago is discarded from the cache if a 1316 decision needs to be made to allow space in the cache for some 1317 new entry being added. 1319 - However, the Route Cache replacement policy SHOULD allow routes 1320 to be categorized based upon "preference", where routes with a 1321 higher preferences are less likely to be removed from the cache. 1322 For example, a node could prefer routes for which it initiated 1323 a Route Discovery over routes that it learned as the result of 1324 promiscuous snooping on other packets. In particular, a node 1325 SHOULD prefer routes that it is presently using over those that 1326 it is not. 1328 Any suitable data structure organization, consistent with this 1329 specification, MAY be used to implement the Route Cache in any node. 1330 For example, the following two types of organization are possible: 1332 - In DSR, the route returned in each Route Reply that is received 1333 by the initiator of a Route Discovery (or that is learned from 1334 the header of overhead packets, as described in Section 8.1.4) 1335 represents a complete path (a sequence of links) leading to the 1336 destination node. By caching each of these paths separately, 1337 a "path cache" organization for the Route Cache can be formed. 1338 A path cache is very simple to implement and easily guarantees 1339 that all routes are loop-free, since each individual route from 1340 a Route Reply or Route Request or used in a packet is loop-free. 1341 To search for a route in a path cache data structure, the sending 1342 node can simply search its Route Cache for any path (or prefix of 1343 a path) that leads to the intended destination node. 1345 This type of organization for the Route Cache in DSR has been 1346 extensively studied through simulation [5, 10, 14, 21] and 1347 through implementation of DSR in a mobile outdoor testbed under 1348 significant workload [22, 23, 24]. 1350 - Alternatively, a "link cache" organization could be used for the 1351 Route Cache, in which each individual link (hop) in the routes 1352 returned in Route Reply packets (or otherwise learned from the 1353 header of overhead packets) is added to a unified graph data 1354 structure of this node's current view of the network topology. 1355 To search for a route in link cache, the sending node must use 1356 a more complex graph search algorithm, such as the well-known 1357 Dijkstra's shortest-path algorithm, to find the current best path 1358 through the graph to the destination node. Such an algorithm is 1359 more difficult to implement and may require significantly more 1360 CPU time to execute. 1362 However, a link cache organization is more powerful than a path 1363 cache organization, in its ability to effectively utilize all of 1364 the potential information that a node might learn about the state 1365 of the network. In particular, links learned from different 1366 Route Discoveries or from the header of any overheard packets can 1367 be merged together to form new routes in the network, but this 1368 is not possible in a path cache due to the separation of each 1369 individual path in the cache. 1371 This type of organization for the Route Cache in DSR, including 1372 the effect of a range of implementation choices, has been studied 1373 through detailed simulation [10]. 1375 The choice of data structure organization to use for the Route Cache 1376 in any DSR implementation is a local matter for each node and affects 1377 only performance; any reasonable choice of organization for the Route 1378 Cache does not affect either correctness or interoperability. 1380 Each entry in the Route Cache SHOULD have a timeout associated 1381 with it, to allow that entry to be deleted if not used within some 1382 time. The particular choice of algorithm and data structure used 1383 to implement the Route Cache SHOULD be considered in choosing the 1384 timeout for entries in the Route Cache. The configuration variable 1385 RouteCacheTimeout defined in Section 9 specifies the timeout to be 1386 applied to entries in the Route Cache, although it is also possible 1387 to instead use an adaptive policy in choosing timeout values rather 1388 than using a single timeout setting for all entries; for example, the 1389 Link-MaxLife cache design (below) uses an adaptive timeout algorithm 1390 and does not use the RouteCacheTimeout configuration variable. 1392 As guidance to implementors, Appendix A describes a type of link 1393 cache known as "Link-MaxLife" that has been shown to outperform 1394 other types of link caches and path caches studied in detailed 1395 simulation [10]. Link-MaxLife is an adaptive link cache in which 1396 each link in the cache has a timeout that is determined dynamically 1397 by the caching node according to its observed past behavior of the 1398 two nodes at the ends of the link; in addition, when selecting a 1399 route for a packet being sent to some destination, among cached 1400 routes of equal length (number of hops) to that destination, 1401 Link-MaxLife selects the route with the longest expected lifetime 1402 (highest minimum timeout of any link in the route). Use of 1403 the Link-MaxLife design for the Route Cache is recommended in 1404 implementations of DSR. 1406 4.2. Send Buffer 1408 The Send Buffer of a node implementing DSR is a queue of packets that 1409 cannot be sent by that node because it does not yet have a source 1410 route to each such packet's destination. Each packet in the Send 1411 Buffer is logically associated with the time that it was placed into 1412 the Buffer, and SHOULD be removed from the Send Buffer and silently 1413 discarded after a period of SendBufferTimeout after initially being 1414 placed in the Buffer. If necessary, a FIFO strategy SHOULD be used 1415 to evict packets before they timeout to prevent the buffer from 1416 overflowing. 1418 Subject to the rate limiting defined in Section 8.2, a Route 1419 Discovery SHOULD be initiated as often as possible for the 1420 destination address of any packets residing in the Send Buffer. 1422 4.3. Route Request Table 1424 The Route Request Table of a node implementing DSR records 1425 information about Route Requests that have been recently originated 1426 or forwarded by this node. The table is indexed by IP address. 1428 The Route Request Table on a node records the following information 1429 about nodes to which this node has initiated a Route Request: 1431 - The Time-to-Live (TTL) field used in the IP header of the Route 1432 Request for the last Route Discovery initiated by this node for 1433 that target node. This value allows the node to implement a 1434 variety of algorithms for controlling the spread of its Route 1435 Request on each Route Discovery initiated for a target. As 1436 examples, two possible algorithms for this use of the TTL field 1437 are described in Section 3.3.4. 1439 - The time that this node last originated a Route Request for that 1440 target node. 1442 - The number of consecutive Route Discoveries initiated for this 1443 target since receiving a valid Route Reply giving a route to that 1444 target node. 1446 - The remaining amount of time before which this node MAY next 1447 attempt at a Route Discovery for that target node. When the 1448 node initiates a new Route Discovery for this target node, this 1449 field in the Route Request Table entry for that target node is 1450 initialized to the timeout for that Route Discovery, after which 1451 the node MAY initiate a new Discovery for that target. Until 1452 a valid Route Reply is received for this target node address, 1453 a node MUST implement a back-off algorithm in determining this 1454 timeout value for each successive Route Discovery initiated 1455 for this target using the same Time-to-Live (TTL) value in the 1456 IP header of the Route Request packet. The timeout between 1457 such consecutive Route Discovery initiations SHOULD increase by 1458 doubling the timeout value on each new initiation. 1460 In addition, the Route Request Table on a node also records the 1461 following information about initiator nodes from which this node has 1462 received a Route Request: 1464 - A FIFO cache of size RequestTableIds entries containing the 1465 Identification value and target address from the most recent 1466 Route Requests received by this node from that initiator node. 1468 Nodes SHOULD use an LRU policy to manage the entries in their Route 1469 Request Table. 1471 The number of Identification values to retain in each Route 1472 Request Table entry, RequestTableIds, MUST NOT be unlimited, since, 1473 in the worst case, when a node crashes and reboots, the first 1474 RequestTableIds Route Discoveries it initiates after rebooting 1475 could appear to be duplicates to the other nodes in the network. 1476 In addition, a node SHOULD base its initial Identification value, 1477 used for Route Discoveries after rebooting, on a battery backed-up 1478 clock or other persistent memory device, in order to help avoid 1479 any possible such delay in successfully discovering new routes 1480 after rebooting; if no such source of initial Identification 1481 value is available, a node after rebooting SHOULD base its initial 1482 Identification value on a random number. 1484 4.4. Gratuitous Route Reply Table 1486 The Gratuitous Route Reply Table of a node implementing DSR records 1487 information about "gratuitous" Route Replies sent by this node as 1488 part of automatic route shortening. As described in Section 3.4.3, 1489 a node returns a gratuitous Route Reply when it overhears a packet 1490 transmitted by some node, for which the node overhearing the 1491 packet was not the intended next-hop node but was named later in 1492 the unexpended hops of the source route in that packet; the node 1493 overhearing the packet returns a gratuitous Route Reply to the 1494 original sender of the packet, listing the shorter route (not 1495 including the hops of the source route "skipped over" by this 1496 packet). A node uses its Gratuitous Route Reply Table to limit the 1497 rate at which it originates gratuitous Route Replies to the same 1498 original sender for the same node from which it overheard a packet to 1499 trigger the gratuitous Route Reply. 1501 Each entry in the Gratuitous Route Reply Table of a node contains the 1502 following fields: 1504 - The address of the node to which this node originated a 1505 gratuitous Route Reply. 1507 - The address of the node from which this node overheard the packet 1508 triggering that gratuitous Route Reply. 1510 - The remaining time before which this entry in the Gratuitous 1511 Route Reply Table expires and SHOULD be deleted by the node. 1512 When a node creates a new entry in its Gratuitous Route Reply 1513 Table, the timeout value for that entry should be initialized to 1514 the value GratReplyHoldoff. 1516 When a node overhears a packet that would trigger a gratuitous 1517 Route Reply, if a corresponding entry already exists in the node's 1518 Gratuitous Route Reply Table, then the node SHOULD NOT send a 1519 gratuitous Route Reply for that packet. Otherwise (no corresponding 1520 entry already exists), the node SHOULD create a new entry in its 1521 Gratuitous Route Reply Table to record that gratuitous Route Reply, 1522 with a timeout value of GratReplyHoldoff. 1524 4.5. Network Interface Queue and Maintenance Buffer 1526 Depending on factors such as the structure and organization of 1527 the operating system, protocol stack implementation, network 1528 interface device driver, and network interface hardware, a packet 1529 being transmitted could be queued in a variety of ways. For 1530 example, outgoing packets from the network protocol stack might be 1531 queued at the operating system or link layer, before transmission 1532 by the network interface. The network interface might also 1533 provide a retransmission mechanism for packets, such as occurs in 1534 IEEE 802.11 [13]; the DSR protocol, as part of Route Maintenance, 1535 requires limited buffering of packets already transmitted for 1536 which the reachability of the next-hop destination has not yet been 1537 determined. The operation of DSR is defined here in terms of two 1538 conceptual data structures that together incorporate this queuing 1539 behavior. 1541 The Network Interface Queue of a node implementing DSR is an output 1542 queue of packets from the network protocol stack waiting to be 1543 transmitted by the network interface; for example, in the 4.4BSD 1544 Unix network protocol stack implementation, this queue for a network 1545 interface is represented as a "struct ifqueue" [36]. This queue is 1546 used to hold packets while the network interface is in the process of 1547 transmitting another packet. 1549 The Maintenance Buffer of a node implementing DSR is a queue of 1550 packets sent by this node that are awaiting next-hop reachability 1551 confirmation as part of Route Maintenance. For each packet in 1552 the Maintenance Buffer, a node maintains a count of the number 1553 of retransmissions and the time of the last retransmission. The 1554 Maintenance Buffer MAY be of limited size; when adding a new packet 1555 to the Maintenance Buffer, if the buffer size is insufficient to hold 1556 the new packet, the new packet SHOULD be silently discarded. If, 1557 after MaxMaintRexmt attempts to confirm next-hop reachability of 1558 some node, no confirmation is received, all packets in this node's 1559 Maintenance Buffer with this next-hop destination SHOULD be removed 1560 from the Maintenance Buffer; in this case, the node also SHOULD 1561 originate a Route Error for this packet to each original source of 1562 a packet removed in this way (Section 8.3) and SHOULD salvage each 1563 packet removed in this way (Section 8.3.6) if it has another route 1564 to that packet's IP Destination Address in its Route Cache. The 1565 definition of MaxMaintRexmt conceptually includes any retransmissions 1566 that might be attempted for a packet at the link layer or within 1567 the network interface hardware. The timeout value to use for each 1568 transmission attempt for an acknowledgement request depends on the 1569 type of acknowledgement mechanism used by Route Maintenance for that 1570 attempt, as described in Section 8.3. 1572 4.6. Blacklist 1574 When a node using the DSR protocol is connected through an 1575 interface that requires physically bidirectional links for unicast 1576 transmission, it MUST maintain a blacklist. A Blacklist is a table, 1577 indexed by neighbor address, that indicates that the link between 1578 this node and the specified neighbor may not be bidirectional. A 1579 node places another node's address in this list when it believes that 1580 broadcast packets from that other node reach this node, but that 1581 unicast transmission between the two nodes is not possible. For 1582 example, if a node forwarding a Route Reply discovers that the next 1583 hop is unreachable, it places that next hop in the node's blacklist. 1585 Once a node discovers that it can communicate bidirectionally with 1586 one of the nodes listed in the blacklist, it SHOULD remove that 1587 node from the blacklist. For example, if node A has node B in its 1588 blacklist, but A hears B forward a Route Request with a hop list 1589 indicating that the broadcast from A to B was successful, then A 1590 SHOULD remove B from its blacklist. 1592 A node MUST associate a state with each node in the blacklist, 1593 specifying whether the unidirectionality is "questionable" 1594 or "probable". Each time the unreachability is positively 1595 determined, the node SHOULD set the state to "probable". After the 1596 unreachability has not been positively determined for some amount of 1597 time, the state should revert to "questionable". A node MAY expire 1598 nodes from its blacklist after a reasonable amount of time. 1600 5. Additional Conceptual Data Structures for Flow State Extension 1602 This section defines additional conceptual data structures used by 1603 the optional "flow state" extension to DSR. In an implementation of 1604 the protocol, these data structures MAY be implemented in any manner 1605 consistent with the external behavior described in this document. 1607 5.1. Flow Table 1609 A node implementing the flow state extension MUST implement a Flow 1610 Table or other data structure consistent with the external behavior 1611 described in this section. A node not implementing the flow state 1612 extension SHOULD NOT implement a Flow Table. 1614 The Flow Table records information about flows from which packets 1615 recently have been sent or forwarded by this node. The table is 1616 indexed by a triple (IP Source Address, IP Destination Address, 1617 Flow ID), where Flow ID is a 16-bit token assigned by the source as 1618 described in Section 3.5.1. Each entry in the Flow Table contains 1619 the following fields: 1621 - The MAC address of the next-hop node along this flow. 1623 - An indication of the outgoing network interface on this node to 1624 be used in transmitting packets along this flow. 1626 - The MAC address of the previous-hop node along this flow. 1628 - An indication of the network interface on this node from which 1629 packets from that previous-hop node are received. 1631 - A timeout after which this entry in the Flow Table MUST be 1632 deleted. 1634 - The expected value of the Hop Count field in the DSR Flow State 1635 header for packets received for forwarding along this field (for 1636 use with packets containing a DSR Flow State header). 1638 - An indication of whether or not this flow can be used as a 1639 default flow for packets originated by this node (the flow IP 1640 MUST be odd). 1642 - The entry SHOULD record the complete source route for the flow. 1643 (Nodes not recording the complete source route cannot participate 1644 in Automatic Route Shortening.) 1646 - The entry MAY contain a field recording the time this entry was 1647 last used. 1649 The entry MUST be deleted when its timeout expires. 1651 5.2. Automatic Route Shortening Table 1653 A node implementing the flow state extension SHOULD implement an 1654 Automatic Route Shortening Table or other data structure consistent 1655 with the external behavior described in this section. A node 1656 not implementing the flow state extension SHOULD NOT implement an 1657 Automatic Route Shortening Table. 1659 The Automatic Route Shortening Table records information about 1660 received packets for which Automatic Route Shortening may be 1661 possible. The table is indexed by a triple (IP Source Address, IP 1662 Destination Address, Flow ID). Each entry in the Automatic Route 1663 Shortening Table contains a list of (packet identifier, Hop Count) 1664 pairs for that flow. The packet identifier in the list may be any 1665 unique identifier for the received packet; for example, for IPv4 1666 packets, the combination of the following fields from the packet's 1667 IP header MAY be used as a unique identifier for the packet: Source 1668 Address, Destination Address, Identification, Protocol, Fragment, 1669 and Total Length. The Hop Count in the list in the entry is copied 1670 from the Hop Count field in the DSR Flow State header of the received 1671 packet for which this table entry was created. Any packet identifier 1672 SHOULD appear at most once in the list in an entry, and this list 1673 item SHOULD record the minimum Hop Count value received for that 1674 packet (if the wireless signal strength or signal-to-noise ratio at 1675 which a packet is received is available to the DSR implementation 1676 in a node, the node MAY, for example, remember instead in this list 1677 the minimum Hop Count value for which the received packet's signal 1678 strength or signal-to-noise ratio exceeded some threshold). 1680 Space in the Automatic Route Shortening Table of a node MAY be 1681 dynamically managed by any local algorithm at the node. For example, 1682 in order to limit the amount of memory used to store the table, any 1683 existing entry MAY be deleted at any time, and the number of packets 1684 listed in each entry MAY be limited. However, when reclaiming space 1685 in the table, nodes SHOULD favor retaining information about more 1686 flows in the table rather than more packets listed in each entry 1687 in the table, as long as at least the listing of some small number 1688 of packets (e.g., 3) can be retained in each entry. In addition, 1689 subject to any implementation limit on the number of packets listed 1690 in each entry in the table, information about a packet listed in an 1691 entry SHOULD be retained until the expiration of the packet's IP TTL. 1693 5.3. Default Flow ID Table 1695 A node implementing the flow state extension MUST implement a Default 1696 Flow Table or other data structure consistent with the external 1697 behavior described in this section. A node not implementing the flow 1698 state extension SHOULD NOT implement a Default Flow Table. 1700 For each (source, destination) pair for which a node forwards 1701 packets, the node MUST record: 1703 - the largest odd Flow ID value seen 1705 - the time at which all of this (source, destination) pair's flows 1706 that are forwarded by this node expire 1708 - the current default Flow ID 1710 - a flag indicating whether or not the current default Flow ID is 1711 valid 1713 If a node deletes this record for a (source, destination) pair, 1714 it MUST also delete all Flow Table entries for that (source, 1715 destination) pair. Nodes MUST delete table entries if all of this 1716 (source, destination) pair's flows that are forwarded by this node 1717 expire. 1719 6. DSR Options Header Format 1721 The Dynamic Source Routing protocol makes use of a special header 1722 carrying control information that can be included in any existing 1723 IP packet. This DSR Options header in a packet contains a small 1724 fixed-sized, 4-octet portion, followed by a sequence of zero or more 1725 DSR options carrying optional information. The end of the sequence 1726 of DSR options in the DSR Options header is implied by total length 1727 of the DSR Options header. 1729 For IPv4, the DSR Options header MUST immediately follow the IP 1730 header in the packet. (If a Hop-by-Hop Options extension header, as 1731 defined in IPv6 [7], becomes defined for IPv4, the DSR Options header 1732 MUST immediately follow the Hop-by-Hop Options extension header, if 1733 one is present in the packet, and MUST otherwise immediately follow 1734 the IP header.) 1736 To add a DSR Options header to a packet, the DSR Options header is 1737 inserted following the packet's IP header, before any following 1738 header such as a traditional (e.g., TCP or UDP) transport layer 1739 header. Specifically, the Protocol field in the IP header is used 1740 to indicate that a DSR Options header follows the IP header, and the 1741 Next Header field in the DSR Options header is used to indicate the 1742 type of protocol header (such as a transport layer header) following 1743 the DSR Options header. 1745 If any headers follow the DSR Options header in a packet, the total 1746 length of the DSR Options header (and thus the total, combined length 1747 of all DSR options present) MUST be a multiple of 4 octets. This 1748 requirement preserves the alignment of these following headers in the 1749 packet. 1751 6.1. Fixed Portion of DSR Options Header 1753 The fixed portion of the DSR Options header is used to carry 1754 information that must be present in any DSR Options header. This 1755 fixed portion of the DSR Options header has the following format: 1757 0 1 2 3 1758 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 1759 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1760 | Next Header |F| Reserved | Payload Length | 1761 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1762 . . 1763 . Options . 1764 . . 1765 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1767 Next Header 1769 8-bit selector. Identifies the type of header immediately 1770 following the DSR Options header. Uses the same values as the 1771 IPv4 Protocol field [32]. 1773 Flow State Header (F) 1775 Flag bit. MUST be set to 0. This bit is set in a DSR Flow 1776 State header (Section 7.1) and clear in a DSR Options header. 1778 Reserved 1780 MUST be sent as 0 and ignored on reception. 1782 Payload Length 1784 The length of the DSR Options header, excluding the 4-octet 1785 fixed portion. The value of the Payload Length field defines 1786 the total length of all options carried in the DSR Options 1787 header. 1789 Options 1791 Variable-length field; the length of the Options field is 1792 specified by the Payload Length field in this DSR Options 1793 header. Contains one or more pieces of optional information 1794 (DSR options), encoded in type-length-value (TLV) format (with 1795 the exception of the Pad1 option, described in Section 6.8). 1797 The placement of DSR options following the fixed portion of the DSR 1798 Options header MAY be padded for alignment. However, due to the 1799 typically limited available wireless bandwidth in ad hoc networks, 1800 this padding is not required, and receiving nodes MUST NOT expect 1801 options within a DSR Options header to be aligned. 1803 Each DSR option is assigned a unique Option Type code. The most 1804 significant 3 bits (that is, Option Type & 0xE0) allow a node not 1805 implementing processing for this Option Type value to behave in the 1806 manner closest to correct for that type: 1808 - The most significant bit in the Option Type value (that is, 1809 Option Type & 0x80) represents whether or not a node receiving 1810 this Option Type SHOULD respond to such a DSR option with a Route 1811 Error of type OPTION_NOT_SUPPORTED, except that such a Route 1812 Error SHOULD never be sent in response to a packet containing a 1813 Route Request option. 1815 - The two follow bits in the Option Type value (that is, 1816 Option Type & 0x60) are a two-bit field indicating how such a 1817 node that does not support this Option Type MUST process the 1818 packet: 1820 00 = Ignore Option 1821 01 = Remove Option 1822 10 = Mark Option 1823 11 = Drop Packet 1825 When these two bits are zero (that is, Option Type & 0x60 == 0), 1826 a node not implementing processing for that Option Type 1827 MUST use the Opt Data Len field to skip over the option and 1828 continue processing. When these two bits are 01 (that is, 1829 Option Type & 0x60 == 0x20), a node not implementing processing 1830 for that Option Type MUST use the Opt Data Len field to remove 1831 the option from the packet and continue processing as if the 1832 option had not been included in the received packet. When these 1833 two bits are 10 (that is, Option Type & 0x60 == 0x40), a node not 1834 implementing processing for that Option Type MUST set the most 1835 significant bit following the Opt Data Len field, MUST ignore the 1836 contents of the option using the Opt Data Len field, and MUST 1837 continue processing the packet. Finally, when these two bits are 1838 11 (that is, Option Type & 0x60 == 0x60), a node not implementing 1839 processing for that Option Type MUST drop the packet. 1841 The following types of DSR options are defined in this document for 1842 use within a DSR Options header: 1844 - Route Request option (Section 6.2) 1846 - Route Reply option (Section 6.3) 1848 - Route Error option (Section 6.4) 1850 - Acknowledgement Request option (Section 6.5) 1852 - Acknowledgement option (Section 6.6) 1854 - DSR Source Route option (Section 6.7) 1856 - Pad1 option (Section 6.8) 1858 - PadN option (Section 6.9) 1860 6.2. Route Request Option 1862 The Route Request option in a DSR Options header is encoded as 1863 follows: 1865 0 1 2 3 1866 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 1867 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1868 | Option Type | Opt Data Len | Identification | 1869 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1870 | Target Address | 1871 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1872 | Address[1] | 1873 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1874 | Address[2] | 1875 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1876 | ... | 1877 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1878 | Address[n] | 1879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1881 IP fields: 1883 Source Address 1885 MUST be set to the address of the node originating this packet. 1886 Intermediate nodes that retransmit the packet to propagate the 1887 Route Request MUST NOT change this field. 1889 Destination Address 1891 MUST be set to the IP limited broadcast address 1892 (255.255.255.255). 1894 Hop Limit (TTL) 1896 MAY be varied from 1 to 255, for example to implement 1897 non-propagating Route Requests and Route Request expanding-ring 1898 searches (Section 3.3.4). 1900 Route Request fields: 1902 Option Type 1904 2 1906 Opt Data Len 1908 8-bit unsigned integer. Length of the option, in octets, 1909 excluding the Option Type and Opt Data Len fields. 1911 Identification 1913 A unique value generated by the initiator (original sender) of 1914 the Route Request. Nodes initiating a Route Request generate 1915 a new Identification value for each Route Request, for example 1916 based on a sequence number counter of all Route Requests 1917 initiated by the node. 1919 This value allows a receiving node to determine whether it 1920 has recently seen a copy of this Route Request: if this 1921 Identification value is found by this receiving node in its 1922 Route Request Table (in the cache of Identification values 1923 in the entry there for this initiating node), this receiving 1924 node MUST discard the Route Request. When propagating a Route 1925 Request, this field MUST be copied from the received copy of 1926 the Route Request being propagated. 1928 Target Address 1930 The address of the node that is the target of the Route 1931 Request. 1933 Address[1..n] 1935 Address[i] is the address of the i-th node recorded in the 1936 Route Request option. The address given in the Source Address 1937 field in the IP header is the address of the initiator of 1938 the Route Discovery and MUST NOT be listed in the Address[i] 1939 fields; the address given in Address[1] is thus the address 1940 of the first node on the path after the initiator. The 1941 number of addresses present in this field is indicated by the 1942 Opt Data Len field in the option (n = (Opt Data Len - 6) / 4). 1943 Each node propagating the Route Request adds its own address to 1944 this list, increasing the Opt Data Len value by 4 octets. 1946 The Route Request option MUST NOT appear more than once within a DSR 1947 Options header. 1949 6.3. Route Reply Option 1951 The Route Reply option in a DSR Options header is encoded as follows: 1953 0 1 2 3 1954 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 1955 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1956 | Option Type | Opt Data Len |L| Reserved | 1957 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1958 | Address[1] | 1959 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1960 | Address[2] | 1961 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1962 | ... | 1963 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1964 | Address[n] | 1965 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1967 IP fields: 1969 Source Address 1971 Set to the address of the node sending the Route Reply. 1972 In the case of a node sending a reply from its Route 1973 Cache (Section 3.3.2) or sending a gratuitous Route Reply 1974 (Section 3.4.3), this address can differ from the address that 1975 was the target of the Route Discovery. 1977 Destination Address 1979 MUST be set to the address of the source node of the route 1980 being returned. Copied from the Source Address field of the 1981 Route Request generating the Route Reply, or in the case of a 1982 gratuitous Route Reply, copied from the Source Address field of 1983 the data packet triggering the gratuitous Reply. 1985 Route Reply fields: 1987 Option Type 1989 1. Nodes not understanding this option will ignore this 1990 option. 1992 Opt Data Len 1994 8-bit unsigned integer. Length of the option, in octets, 1995 excluding the Option Type and Opt Data Len fields. 1997 Last Hop External (L) 1999 Set to indicate that the last hop given by the Route Reply 2000 (the link from Address[n-1] to Address[n]) is actually an 2001 arbitrary path in a network external to the DSR network; the 2002 exact route outside the DSR network is not represented in the 2003 Route Reply. Nodes caching this hop in their Route Cache MUST 2004 flag the cached hop with the External flag. Such hops MUST NOT 2005 be returned in a cached Route Reply generated from this Route 2006 Cache entry, and selection of routes from the Route Cache to 2007 route a packet being sent MUST prefer routes that contain no 2008 hops flagged as External. 2010 Reserved 2012 MUST be sent as 0 and ignored on reception. 2014 Address[1..n] 2016 The source route being returned by the Route Reply. The route 2017 indicates a sequence of hops, originating at the source node 2018 specified in the Destination Address field of the IP header 2019 of the packet carrying the Route Reply, through each of the 2020 Address[i] nodes in the order listed in the Route Reply, 2021 ending with the destination node indicated by Address[n]. 2022 The number of addresses present in the Address[1..n] 2023 field is indicated by the Opt Data Len field in the option 2024 (n = (Opt Data Len - 1) / 4). 2026 A Route Reply option MAY appear one or more times within a DSR 2027 Options header. 2029 6.4. Route Error Option 2031 The Route Error option in a DSR Options header is encoded as follows: 2033 0 1 2 3 2034 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 2035 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2036 | Option Type | Opt Data Len | Error Type |Reservd|Salvage| 2037 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2038 | Error Source Address | 2039 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2040 | Error Destination Address | 2041 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2042 . . 2043 . Type-Specific Information . 2044 . . 2045 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2047 Option Type 2049 2. Nodes not understanding this option will ignore this 2050 option. 2052 Opt Data Len 2054 8-bit unsigned integer. Length of the option, in octets, 2055 excluding the Option Type and Opt Data Len fields. 2057 For the current definition of the Route Error option, 2058 this field MUST be set to 10, plus the size of any 2059 Type-Specific Information present in the Route Error. Further 2060 extensions to the Route Error option format may also be 2061 included after the Type-Specific Information portion of the 2062 Route Error option specified above. The presence of such 2063 extensions will be indicated by the Opt Data Len field. 2064 When the Opt Data Len is greater than that required for 2065 the fixed portion of the Route Error plus the necessary 2066 Type-Specific Information as indicated by the Option Type 2067 value in the option, the remaining octets are interpreted as 2068 extensions. Currently, no such further extensions have been 2069 defined. 2071 Error Type 2073 The type of error encountered. Currently, the following type 2074 values are defined: 2076 1 = NODE_UNREACHABLE 2077 2 = FLOW_STATE_NOT_SUPPORTED 2078 3 = OPTION_NOT_SUPPORTED 2080 Other values of the Error Type field are reserved for future 2081 use. 2083 Reservd 2085 Reserved. MUST be sent as 0 and ignored on reception. 2087 Salvage 2089 A 4-bit unsigned integer. Copied from the Salvage field in 2090 the DSR Source Route option of the packet triggering the Route 2091 Error. 2093 The "total salvage count" of the Route Error option is derived 2094 from the value in the Salvage field of this Route Error option 2095 and all preceding Route Error options in the packet as follows: 2096 the total salvage count is the sum of, for each such Route 2097 Error option, one plus the value in the Salvage field of that 2098 Route Error option. 2100 Error Source Address 2102 The address of the node originating the Route Error (e.g., the 2103 node that attempted to forward a packet and discovered the link 2104 failure). 2106 Error Destination Address 2108 The address of the node to which the Route Error must be 2109 delivered For example, when the Error Type field is set to 2110 NODE_UNREACHABLE, this field will be set to the address of the 2111 node that generated the routing information claiming that the 2112 hop from the Error Source Address to Unreachable Node Address 2113 (specified in the Type-Specific Information) was a valid hop. 2115 Type-Specific Information 2117 Information specific to the Error Type of this Route Error 2118 message. 2120 A Route Error option MAY appear one or more times within a DSR 2121 Options header. 2123 6.4.1. Node Unreachable Type-Specific Information 2125 When the Route Error is of type NODE_UNREACHABLE, the 2126 Type-Specific Information field is defined as follows: 2128 0 1 2 3 2129 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 2130 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2131 | Unreachable Node Address | 2132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2134 Unreachable Node Address 2136 The address of the node that was found to be unreachable 2137 (the next-hop neighbor to which the node with address 2138 Error Source Address was attempting to transmit the packet). 2140 6.4.2. Flow State Not Supported Type-Specific Information 2142 When the Route Error is of type FLOW_STATE_NOT_SUPPORTED, the 2143 Type-Specific Information field is empty. 2145 6.4.3. Option Not Supported Type-Specific Information 2147 When the Route Error is of type OPTION_NOT_SUPPORTED, the 2148 Type-Specific Information field is defined as follows: 2150 0 1 2 3 4 5 6 7 2151 +-+-+-+-+-+-+-+-+ 2152 |Unsupported Opt| 2153 +-+-+-+-+-+-+-+-+ 2155 Unsupported Opt 2157 The type of option triggering the Route Error. 2159 6.5. Acknowledgement Request Option 2161 The Acknowledgement Request option in a DSR Options header is encoded 2162 as follows: 2164 0 1 2 3 2165 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 2166 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2167 | Option Type | Opt Data Len | Identification | 2168 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2170 Option Type 2172 160. Nodes not understanding this option will remove the 2173 option and return a Route Error. 2175 Opt Data Len 2177 8-bit unsigned integer. Length of the option, in octets, 2178 excluding the Option Type and Opt Data Len fields. 2180 Identification 2182 The Identification field is set to a unique value and is copied 2183 into the Identification field of the Acknowledgement option 2184 when returned by the node receiving the packet over this hop. 2186 An Acknowledgement Request option MUST NOT appear more than once 2187 within a DSR Options header. 2189 6.6. Acknowledgement Option 2191 The Acknowledgement option in a DSR Options header is encoded as 2192 follows: 2194 0 1 2 3 2195 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 2196 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2197 | Option Type | Opt Data Len | Identification | 2198 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2199 | ACK Source Address | 2200 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2201 | ACK Destination Address | 2202 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2204 Option Type 2206 32. Nodes not understanding this option will remove the 2207 option. 2209 Opt Data Len 2211 8-bit unsigned integer. Length of the option, in octets, 2212 excluding the Option Type and Opt Data Len fields. 2214 Identification 2216 Copied from the Identification field of the Acknowledgement 2217 Request option of the packet being acknowledged. 2219 ACK Source Address 2221 The address of the node originating the acknowledgement. 2223 ACK Destination Address 2225 The address of the node to which the acknowledgement is to be 2226 delivered. 2228 An Acknowledgement option MAY appear one or more times within a DSR 2229 Options header. 2231 6.7. DSR Source Route Option 2233 The DSR Source Route option in a DSR Options header is encoded as 2234 follows: 2236 0 1 2 3 2237 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 2238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2239 | Option Type | Opt Data Len |F|L|Reservd|Salvage| Segs Left | 2240 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2241 | Address[1] | 2242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2243 | Address[2] | 2244 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2245 | ... | 2246 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2247 | Address[n] | 2248 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2250 Option Type 2252 96. Nodes not understanding this option will drop the packet. 2254 Opt Data Len 2256 8-bit unsigned integer. Length of the option, in octets, 2257 excluding the Option Type and Opt Data Len fields. For the 2258 format of the DSR Source Route option defined here, this field 2259 MUST be set to the value (n * 4) + 2, where n is the number of 2260 addresses present in the Address[i] fields. 2262 First Hop External (F) 2264 Set to indicate that the first hop indicated by the DSR 2265 Source Route option is actually an arbitrary path in a network 2266 external to the DSR network; the exact route outside the DSR 2267 network is not represented in the DSR Source Route option. 2268 Nodes caching this hop in their Route Cache MUST flag the 2269 cached hop with the External flag. Such hops MUST NOT be 2270 returned in a Route Reply generated from this Route Cache 2271 entry, and selection of routes from the Route Cache to route 2272 a packet being sent MUST prefer routes that contain no hops 2273 flagged as External. 2275 Last Hop External (L) 2277 Set to indicate that the last hop indicated by the DSR Source 2278 Route option is actually an arbitrary path in a network 2279 external to the DSR network; the exact route outside the DSR 2280 network is not represented in the DSR Source Route option. 2282 Nodes caching this hop in their Route Cache MUST flag the 2283 cached hop with the External flag. Such hops MUST NOT be 2284 returned in a Route Reply generated from this Route Cache 2285 entry, and selection of routes from the Route Cache to route 2286 a packet being sent MUST prefer routes that contain no hops 2287 flagged as External. 2289 Reserved 2291 MUST be sent as 0 and ignored on reception. 2293 Salvage 2295 A 4-bit unsigned integer. Count of number of times that 2296 this packet has been salvaged as a part of DSR routing 2297 (Section 3.4.1). 2299 Segments Left (Segs Left) 2301 Number of route segments remaining, i.e., number of explicitly 2302 listed intermediate nodes still to be visited before reaching 2303 the final destination. 2305 Address[1..n] 2307 The sequence of addresses of the source route. In routing 2308 and forwarding the packet, the source route is processed as 2309 described in Sections 8.1.3 and 8.1.5. The number of addresses 2310 present in the Address[1..n] field is indicated by the 2311 Opt Data Len field in the option (n = (Opt Data Len - 2) / 4). 2313 When forwarding a packet along a DSR source route using a DSR Source 2314 Route option in the packet's DSR Options header, the Destination 2315 Address field in the packet's IP header is always set to the address 2316 of the packet's ultimate destination. A node receiving a packet 2317 containing a DSR Options header with a DSR Source Route option MUST 2318 examine the indicated source route to determine if it is the intended 2319 next-hop node for the packet and determine how to forward the packet, 2320 as defined in Sections 8.1.4 and 8.1.5. 2322 6.8. Pad1 Option 2324 The Pad1 option in a DSR Options header is encoded as follows: 2326 +-+-+-+-+-+-+-+-+ 2327 | Option Type | 2328 +-+-+-+-+-+-+-+-+ 2330 Option Type 2332 224. Nodes not understanding this option will drop the packet 2333 and return a Route Error. 2335 A Pad1 option MAY be included in the Options field of a DSR Options 2336 header in order to align subsequent DSR options, but such alignment 2337 is not required and MUST NOT be expected by a node receiving a packet 2338 containing a DSR Options header. 2340 If any headers follow the DSR Options header in a packet, the total 2341 length of a DSR Options header, indicated by the Payload Length field 2342 in the DSR Options header MUST be a multiple of 4 octets. In this 2343 case, when building a DSR Options header in a packet, sufficient Pad1 2344 or PadN options MUST be included in the Options field of the DSR 2345 Options header to make the total length a multiple of 4 octets. 2347 If more than one consecutive octet of padding is being inserted in 2348 the Options field of a DSR Options header, the PadN option, described 2349 next, SHOULD be used, rather than multiple Pad1 options. 2351 Note that the format of the Pad1 option is a special case; it does 2352 not have an Opt Data Len or Option Data field. 2354 6.9. PadN Option 2356 The PadN option in a DSR Options header is encoded as follows: 2358 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 2359 | Option Type | Opt Data Len | Option Data 2360 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 2362 Option Type 2364 0. Nodes not understanding this option will ignore this 2365 option. 2367 Opt Data Len 2369 8-bit unsigned integer. Length of the option, in octets, 2370 excluding the Option Type and Opt Data Len fields. 2372 Option Data 2374 A number of zero-valued octets equal to the Opt Data Len. 2376 A PadN option MAY be included in the Options field of a DSR Options 2377 header in order to align subsequent DSR options, but such alignment 2378 is not required and MUST NOT be expected by a node receiving a packet 2379 containing a DSR Options header. 2381 If any headers follow the DSR Options header in a packet, the total 2382 length of a DSR Options header, indicated by the Payload Length field 2383 in the DSR Options header MUST be a multiple of 4 octets. In this 2384 case, when building a DSR Options header in a packet, sufficient Pad1 2385 or PadN options MUST be included in the Options field of the DSR 2386 Options header to make the total length a multiple of 4 octets. 2388 7. Additional Header Formats and Options for Flow State Extension 2390 The optional DSR flow state extension requires a new header type, the 2391 DSR Flow State header. 2393 In addition, the DSR flow state extension adds the following options 2394 for the DSR Options header defined in Section 6: 2396 - Timeout option 2398 - Destination and Flow ID option 2400 Two new Error Type values are also defined for use in the Route Error 2401 option in a DSR Options header: 2403 - Unknown Flow 2405 - Default Flow Unknown 2407 Finally, an extension to the Acknowledgement Request option in a DSR 2408 Options header is also defined: 2410 - Previous Hop Address 2412 This section defines each of these new header or option formats. 2414 7.1. DSR Flow State Header 2416 The DSR Flow State header is a small 4-byte header optionally used 2417 to carry the flow ID and hop count for a packet being sent along a 2418 DSR flow. It is distinguished from the fixed DSR Options header 2419 (Section 6.1) in that the Flow State Header (F) bit is set in the DSR 2420 Flow State header and is clear in the fixed DSR Options header. 2422 0 1 2 3 2423 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 2424 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2425 | Next Header |F| Hop Count | Flow Identifier | 2426 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2428 Next Header 2430 8-bit selector. Identifies the type of header immediately 2431 following the DSR Flow State header. Uses the same values as 2432 the IPv4 Protocol field [32]. 2434 Flow State Header (F) 2436 Flag bit. MUST be set to 1. This bit is set in a DSR Flow 2437 State header and clear in a DSR Options header (Section 6.1). 2439 Hop Count 2441 7-bit unsigned integer. The number of hops through which this 2442 packet has been forwarded. 2444 Flow Identification 2446 The flow ID for this flow, as described in Section 3.5.1. 2448 7.2. Options and Extensions in DSR Options Header 2450 7.2.1. Timeout Option 2452 The Timeout option is defined for use in a DSR Options header to 2453 indicate the amount of time before the expiration of the flow ID 2454 along which the packet is being sent. 2456 0 1 2 3 2457 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 2458 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2459 | Option Type | Option Length | Timeout | 2460 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2462 Option Type 2464 128. Nodes not understanding this option will ignore the 2465 option and return a Route Error. 2467 Opt Data Len 2469 8-bit unsigned integer. Length of the option, in octets, 2470 excluding the Option Type and Opt Data Len fields. 2472 When no extensions are present, the Opt Data Len of a Timeout 2473 option is 2. Further extensions to DSR may include additional 2474 data in a Timeout option. The presence of such extensions is 2475 indicated by an Opt Data Len greater than 2. Currently, no 2476 such extensions have been defined. 2478 Timeout 2480 The number of seconds for which this flow remains valid. 2482 The Timeout option MUST NOT appear more than once within a DSR 2483 Options header. 2485 7.2.2. Destination and Flow ID Option 2487 The Destination and Flow ID option is defined for use in a DSR 2488 Options header to send a packet to an intermediate host along one 2489 flow, for eventual forwarding to the final destination along a 2490 different flow. This option enables the aggregation of the state of 2491 multiple flows. 2493 0 1 2 3 2494 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 2495 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2496 | Option Type | Option Length | New Flow Identifier | 2497 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2498 | New IP Destination Address | 2499 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2501 Option Type 2503 129. Nodes not understanding this option will ignore the 2504 option and return a Route Error. 2506 Opt Data Len 2508 8-bit unsigned integer. Length of the option, in octets, 2509 excluding the Option Type and Opt Data Len fields. 2511 When no extensions are present, the Opt Data Len of a 2512 Destination and Flow ID option is 6. Further extensions to 2513 DSR may include additional data in a Destination and Flow ID 2514 option. The presence of such extensions is indicated by an 2515 Opt Data Len greater than 6. Currently, no such extensions 2516 have been defined. 2518 New Flow Identifier 2520 Indicates the next identifier to store in the Flow ID field of 2521 the DSR Options header. 2523 New IP Destination Address 2525 Indicates the next address to store in the Destination Address 2526 field of the IP header. 2528 The Destination and Flow ID option MAY appear one or more times 2529 within a DSR Options header. 2531 7.2.3. New Error Type Value for Unknown Flow 2533 A new Error Type value of 129 (Unknown Flow) is defined for use in 2534 a Route Error option in a DSR Options header. The Type-Specific 2535 Information for errors of this type is encoded as follows: 2537 0 1 2 3 2538 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 2539 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2540 | Original IP Destination Address | 2541 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2542 | Flow ID | 2543 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2545 Original IP Destination Address 2547 The IP Destination Address of the packet that caused the error. 2549 Flow ID 2551 The Flow ID contained in the DSR Flow ID option that caused the 2552 error. 2554 7.2.4. New Error Type Value for Default Flow Unknown 2556 A new Error Type value of 130 (Default Flow Unknown) is defined 2557 for use in a Route Error option in a DSR Options header. The 2558 Type-Specific Information for errors of this type is encoded as 2559 follows: 2561 0 1 2 3 2562 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 2563 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2564 | Original IP Destination Address | 2565 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2567 Original IP Destination Address 2569 The IP Destination Address of the packet that caused the error. 2571 7.2.5. Acknowledgement Request Option Previous Hop Address Extension 2573 When the Option Length field of an Acknowledgement Request option 2574 in a DSR Options header is greater than or equal to 6, a Previous 2575 Hop Address Extension is present. The option is then formatted as 2576 follows: 2578 0 1 2 3 2579 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 2580 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2581 | Option Type | Option Length | Packet Identifier | 2582 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2583 | ACK Request Source Address | 2584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2586 Option Type 2588 5 2590 Option Length 2592 8-bit unsigned integer. Length of the option, in octets, 2593 excluding the Option Type and Option Length fields. 2595 When no extensions are presents, the Option Length of a 2596 Acknowledgement Request option is 2. Further extensions to 2597 DSR may include additional data in a Acknowledgement Request 2598 option. The presence of such extensions is indicated by an 2599 Opt Data Len greater than 2. 2601 Currently, one such extension has been defined. If the 2602 Option Length is at least 6, then a ACK Request Source Address 2603 is present. 2605 Packet Identifier 2607 The Packet Identifier field is set to a unique number and is 2608 copied into the Identification field of the DSR Acknowledgement 2609 option when returned by the node receiving the packet over this 2610 hop. 2612 ACK Request Source Address 2614 The address of the node requesting the DSR Acknowledgement. 2616 8. Detailed Operation 2618 8.1. General Packet Processing 2620 8.1.1. Originating a Packet 2622 When originating any packet, a node using DSR routing MUST perform 2623 the following sequence of steps: 2625 - Search the node's Route Cache for a route to the address given in 2626 the IP Destination Address field in the packet's header. 2628 - If no such route is found in the Route Cache, then perform 2629 Route Discovery for the Destination Address, as described in 2630 Section 8.2. Initiating a Route Discovery for this target node 2631 address results in the node adding a Route Request option in 2632 a DSR Options header in this existing packet, or saving this 2633 existing packet to its Send Buffer and initiating the Route 2634 Discovery by sending a separate packet containing such a Route 2635 Request option. If the node chooses to initiate the Route 2636 Discovery by adding the Route Request option to this existing 2637 packet, it will replace the IP Destination Address field with the 2638 IP "limited broadcast" address (255.255.255.255) [3], copying the 2639 original IP Destination Address to the Target Address field of 2640 the new Route Request option added to the packet, as described in 2641 Section 8.2.1. 2643 - If the packet now does not contain a Route Request option, 2644 then this node must have a route to the Destination Address 2645 of the packet; if the node has more than one route to this 2646 Destination Address, the node selects one to use for this packet. 2647 If the length of this route is greater than 1 hop, or if the 2648 node determines to request a DSR network-layer acknowledgement 2649 from the first-hop node in that route, then insert a DSR Options 2650 header into the packet, as described in Section 8.1.2, and insert 2651 a DSR Source Route option, as described in Section 8.1.3. The 2652 source route in the packet is initialized from the selected route 2653 to the Destination Address of the packet. 2655 - Transmit the packet to the first-hop node address given in 2656 selected source route, using Route Maintenance to determine the 2657 reachability of the next hop, as described in Section 8.3. 2659 8.1.2. Adding a DSR Options Header to a Packet 2661 A node originating a packet adds a DSR Options header to the packet, 2662 if necessary, to carry information needed by the routing protocol. 2663 A packet MUST NOT contain more than one DSR Options header. A DSR 2664 Options header is added to a packet by performing the following 2665 sequence of steps (these steps assume that the packet contains no 2666 other headers that MUST be located in the packet before the DSR 2667 Options header): 2669 - Insert a DSR Options header after the IP header but before any 2670 other header that may be present. 2672 - Set the Next Header field of the DSR Options header to the 2673 Protocol number field of the packet's IP header. 2675 - Set the Protocol field of the packet's IP header to the Protocol 2676 number assigned for a DSR Options header (TBA???). 2678 8.1.3. Adding a DSR Source Route Option to a Packet 2680 A node originating a packet adds a DSR Source Route option to the 2681 packet, if necessary, in order to carry the source route from this 2682 originating node to the final destination address of the packet. 2683 Specifically, the node adding the DSR Source Route option constructs 2684 the DSR Source Route option and modifies the IP packet according to 2685 the following sequence of steps: 2687 - The node creates a DSR Source Route option, as described 2688 in Section 6.7, and appends it to the DSR Options header in 2689 the packet. (A DSR Options header is added, as described in 2690 Section 8.1.2, if not already present.) 2692 - The number of Address[i] fields to include in the DSR Source 2693 Route option (n) is the number of intermediate nodes in the 2694 source route for the packet (i.e., excluding address of the 2695 originating node and the final destination address of the 2696 packet). The Segments Left field in the DSR Source Route option 2697 is initialized equal to n. 2699 - The addresses within the source route for the packet are copied 2700 into sequential Address[i] fields in the DSR Source Route option, 2701 for i = 1, 2, ..., n. 2703 - The First Hop External (F) bit in the DSR Source Route option is 2704 copied from the External bit flagging the first hop in the source 2705 route for the packet, as indicated in the Route Cache. 2707 - The Last Hop External (L) bit in the DSR Source Route option is 2708 copied from the External bit flagging the last hop in the source 2709 route for the packet, as indicated in the Route Cache. 2711 - The Salvage field in the DSR Source Route option is 2712 initialized to 0. 2714 8.1.4. Processing a Received Packet 2716 When a node receives any packet (whether for forwarding, overheard, 2717 or as the final destination of the packet), if that packet contains 2718 a DSR Options header, then that node MUST process any options 2719 contained in that DSR Options header, in the order contained there. 2720 Specifically: 2722 - If the DSR Options header contains a Route Request option, the 2723 node SHOULD extract the source route from the Route Request and 2724 add this routing information to its Route Cache, subject to the 2725 conditions identified in Section 3.3.1. The routing information 2726 from the Route Request is the sequence of hop addresses 2728 initiator, Address[1], Address[2], ..., Address[n] 2730 where initiator is the value of the Source Address field in 2731 the IP header of the packet carrying the Route Request (the 2732 address of the initiator of the Route Discovery), and each 2733 Address[i] is a node through which this Route Request has passed, 2734 in turn, during this Route Discovery. The value n here is the 2735 number of addresses recorded in the Route Request option, or 2736 (Opt Data Len - 6) / 4. 2738 After possibly updating the node's Route Cache in response to 2739 the routing information in the Route Request option, the node 2740 MUST then process the Route Request option as described in 2741 Section 8.2.2. 2743 - If the DSR Options header contains a Route Reply option, the node 2744 SHOULD extract the source route from the Route Reply and add this 2745 routing information to its Route Cache, subject to the conditions 2746 identified in Section 3.3.1. The source route from the Route 2747 Reply is the sequence of hop addresses 2749 initiator, Address[1], Address[2], ..., Address[n] 2751 where initiator is the value of the Destination Address field in 2752 the IP header of the packet carrying the Route Reply (the address 2753 of the initiator of the Route Discovery), and each Address[i] 2754 is a node through which the source route passes, in turn, on 2755 the route to the target of the Route Discovery. Address[n] is 2756 the address of the target. If the Last Hop External (L) bit is 2757 set in the Route Reply, the node MUST flag the last hop from 2758 the Route Reply (the link from Address[n-1] to Address[n]) in 2759 its Route Cache as External. The value n here is the number of 2760 addresses in the source route being returned in the Route Reply 2761 option, or (Opt Data Len - 1) / 4. 2763 After possibly updating the node's Route Cache in response to 2764 the routing information in the Route Reply option, then if the 2765 packet's IP Destination Address matches one of this node's IP 2766 addresses, the node MUST then process the Route Reply option as 2767 described in Section 8.2.5. 2769 - If the DSR Options header contains a Route Error option, 2770 the node MUST process the Route Error option as described in 2771 Section 8.3.5. 2773 - If the DSR Options header contains an Acknowledgement Request 2774 option, the node MUST process the Acknowledgement Request option 2775 as described in Section 8.3.3. 2777 - If the DSR Options header contains an Acknowledgement option, 2778 then subject to the conditions identified in Section 3.3.1, the 2779 node SHOULD add to its Route Cache the single link from the node 2780 identified by the ACK Source Address field to the node identified 2781 by the ACK Destination Address field. 2783 After possibly updating the node's Route Cache in response to 2784 the routing information in the Acknowledgement option, the node 2785 MUST then process the Acknowledgement option as described in 2786 Section 8.3.3. 2788 - If the DSR Options header contains a DSR Source Route option, the 2789 node SHOULD extract the source route from the DSR Source Route 2790 and add this routing information to its Route Cache, subject to 2791 the conditions identified in Section 3.3.1. If the value of the 2792 Salvage field in the DSR Source Route option is zero, then the 2793 routing information from the DSR Source Route is the sequence of 2794 hop addresses 2796 source, Address[1], Address[2], ..., Address[n], destination 2798 and otherwise (Salvage is nonzero), the routing information from 2799 the DSR Source Route is the sequence of hop addresses 2801 Address[1], Address[2], ..., Address[n], destination 2803 where source is the value of the Source Address field in the IP 2804 header of the packet carrying the DSR Source Route option (the 2805 original sender of the packet), each Address[i] is the value in 2806 the Address[i] field in the DSR Source Route, and destination is 2807 the value of the Destination Address field in the packet's IP 2808 header (the last-hop address of the source route). The value n 2809 here is the number of addresses in source route in the DSR Source 2810 Route option, or (Opt Data Len - 2) / 4. 2812 After possibly updating the node's Route Cache in response to 2813 the routing information in the DSR Source Route option, the node 2814 MUST then process the DSR Source Route option as described in 2815 Section 8.1.5. 2817 - Any Pad1 or PadN options in the DSR Options header are ignored. 2819 Finally, if the Destination Address in the packet's IP header matches 2820 one of this receiving node's own IP address(es), remove the DSR 2821 Options header and all the included DSR options in the header, and 2822 pass the rest of the packet to the network layer. 2824 8.1.5. Processing a Received DSR Source Route Option 2826 When a node receives a packet containing a DSR Source Route option 2827 (whether for forwarding, overheard, or as the final destination of 2828 the packet), that node SHOULD examine the packet to determine if 2829 the receipt of that packet indicates an opportunity for automatic 2830 route shortening, as described in Section 3.4.3. Specifically, if 2831 this node is not the intended next-hop destination for the packet 2832 but is named in the later unexpended portion of the source route in 2833 the packet's DSR Source Route option, then this packet indicates an 2834 opportunity for automatic route shortening: the intermediate nodes 2835 after the node from which this node overheard the packet and before 2836 this node itself, are no longer necessary in the source route. In 2837 this case, this node SHOULD perform the following sequence of steps 2838 as part of automatic route shortening: 2840 - The node searches its Gratuitous Route Reply Table for an entry 2841 describing a gratuitous Route Reply earlier sent by this node, 2842 for which the original sender of the packet triggering the 2843 gratuitous Route Reply and the transmitting node from which this 2844 node overheard that packet in order to trigger the gratuitous 2845 Route Reply, both match the respective node addresses for this 2846 new received packet. If such an entry is found in the node's 2847 Gratuitous Route Reply Table, the node SHOULD NOT perform 2848 automatic route shortening in response to this receipt of this 2849 packet. 2851 - Otherwise, the node creates an entry for this overheard packet in 2852 its Gratuitous Route Reply Table. The timeout value for this new 2853 entry SHOULD be initialized to the value GratReplyHoldoff. After 2854 this timeout has expired, the node SHOULD delete this entry from 2855 its Gratuitous Route Reply Table. 2857 - After creating the new Gratuitous Route Reply Table entry 2858 above, the node originates a gratuitous Route Reply to the 2859 IP Source Address of this overheard packet, as described in 2860 Section 3.4.3. 2862 If the MAC protocol in use in the network is not capable of 2863 transmitting unicast packets over unidirectional links, as 2864 discussed in Section 3.3.1, then in originating this Route Reply, 2865 the node MUST use a source route for routing the Route Reply 2866 packet that is obtained by reversing the sequence of hops over 2867 which the packet triggering the gratuitous Route Reply was routed 2868 in reaching and being overheard by this node; this reversing of 2869 the route uses the gratuitous Route Reply to test this sequence 2870 of hops for bidirectionality, preventing the gratuitous Route 2871 Reply from being received by the initiator of the Route Discovery 2872 unless each of the hops over which the gratuitous Route Reply is 2873 returned is bidirectional. 2875 - Discard the overheard packet, since the packet has been received 2876 before its normal traversal of the packet's source route would 2877 have caused it to reach this receiving node. Another copy of 2878 the packet will normally arrive at this node as indicated in 2879 the packet's source route; discarding this initial copy of the 2880 packet, which triggered the gratuitous Route Reply, will prevent 2881 the duplication of this packet that would otherwise occur. 2883 If the packet is not discarded as part of automatic route shortening 2884 above, then the node MUST process the option according to the 2885 following sequence of steps: 2887 - If the value of the Segments Left field in the DSR Source Route 2888 option equals 0, then remove the DSR Source Route option from the 2889 DSR Options header. 2891 - Else, let n equal (Opt Data Len - 2) / 4. This is the number of 2892 addresses in the DSR Source Route option. 2894 - If the value of the Segments Left field is greater than n, then 2895 send an ICMP Parameter Problem, Code 0, message [29] to the IP 2896 Source Address, pointing to the Segments Left field, and discard 2897 the packet. Do not process the DSR Source Route option further. 2899 - Else, decrement the value of the Segments Left field by 1. Let i 2900 equal n minus Segments Left. This is the index of the next 2901 address to be visited in the Address vector. 2903 - If Address[i] or the IP Destination Address is a multicast 2904 address, then discard the packet. Do not process the DSR Source 2905 Route option further. 2907 - If the MTU of the link over which this node would transmit 2908 the packet to forward it to the node Address[i] is less than 2909 the size of the packet, the node MUST either discard the 2910 packet and send an ICMP Packet Too Big message to the packet's 2911 Source Address [29] or fragment it as specified in Section 8.5. 2913 - Forward the packet to the IP address specified in the Address[i] 2914 field of the IP header, following normal IP forwarding 2915 procedures, including checking and decrementing the Time-to-Live 2916 (TTL) field in the packet's IP header [30, 3]. In this 2917 forwarding of the packet, the next-hop node (identified by 2918 Address[i]) MUST be treated as a direct neighbor node: the 2919 transmission to that next node MUST be done in a single IP 2920 forwarding hop, without Route Discovery and without searching the 2921 Route Cache. 2923 - In forwarding the packet, perform Route Maintenance for the 2924 next hop of the packet, by verifying that the next-hop node is 2925 reachable, as described in Section 8.3. 2927 Multicast addresses MUST NOT appear in a DSR Source Route option or 2928 in the IP Destination Address field of a packet carrying a DSR Source 2929 Route option in a DSR Options header. 2931 8.1.6. Handling an Unknown DSR Option 2933 Nodes implementing DSR MUST handle all options specified in this 2934 document, except those options pertaining to the optional flow 2935 state extension (Section 7). However, further extensions to 2936 DSR may include other option types that may not be understood by 2937 implementations conforming to this version of the DSR specification. 2938 In DSR, Option Type codes encode required behavior for nodes not 2939 implementing that type of option. These behaviors are included in 2940 the most significant three bits of the Option Type. 2942 If the most significant bit of the Option Type is set (that is, 2943 Option Type & 0x80 is nonzero), and this packet does not contain 2944 a Route Request option, a node SHOULD return a Route Error to the 2945 IP Source Address, following the steps described in Section 8.3.4, 2946 except that the Error Type MUST be set to OPTION_NOT_SUPPORTED and 2947 the Unsupported Opt field MUST be set to the Option Type triggering 2948 the Route Error. 2950 Whether or not a Route Error is sent in response to this DSR option, 2951 as described above, the node also MUST examine the next two most 2952 significant bits (that is, Option Type & 0x60): 2954 - When these two bits are zero (that is, Option Type & 0x60 == 0), 2955 a node not implementing processing for that Option Type MUST 2956 use the Opt Data Len field to skip over the option and continue 2957 processing. 2959 - When these two bits are 01 (that is, Option Type & 0x60 == 0x20), 2960 a node not implementing processing for that Option Type MUST use 2961 the Opt Data Len field to remove the option from the packet and 2962 continue processing as if the option had not been included in the 2963 received packet. 2965 - When these two bits are 10 (that is, Option Type & 0x60 == 0x40), 2966 a node not implementing processing for that Option Type MUST set 2967 the most significant bit following the Opt Data Len field; in 2968 addition, the node MUST then ignore the contents of the option 2969 using the Opt Data Len field, and MUST continue processing the 2970 packet. 2972 - Finally, when these two bits are 11 (that is, 2973 Option Type & 0x60 == 0x60), a node not implementing processing 2974 for that Option Type MUST drop the packet. 2976 8.2. Route Discovery Processing 2978 Route Discovery is the mechanism by which a node S wishing to send a 2979 packet to a destination node D obtains a source route to D. Route 2980 Discovery is used only when S attempts to send a packet to D and 2981 does not already know a route to D. The node initiating a Route 2982 Discovery is known as the "initiator" of the Route Discovery, and the 2983 destination node for which the Route Discovery is initiated is known 2984 as the "target" of the Route Discovery. 2986 Route Discovery operates entirely on demand, with a node initiating 2987 Route Discovery based on its own origination of new packets for 2988 some destination address to which it does not currently know a 2989 route. Route Discovery does not depend on any periodic or background 2990 exchange of routing information or neighbor node detection at any 2991 layer in the network protocol stack at any node. 2993 The Route Discovery procedure utilizes two types of messages, a Route 2994 Request (Section 6.2) and a Route Reply (Section 6.3), to actively 2995 search the ad hoc network for a route to the desired destination. 2996 These DSR messages MAY be carried in any type of IP packet, through 2997 use of the DSR Options header as described in Section 6. 2999 Except as discussed in Section 8.3.5, a Route Discovery for a 3000 destination address SHOULD NOT be initiated unless the initiating 3001 node has a packet in its Send Buffer requiring delivery to that 3002 destination. A Route Discovery for a given target node MUST NOT be 3003 initiated unless permitted by the rate-limiting information contained 3004 in the Route Request Table. After each Route Discovery attempt, the 3005 interval between successive Route Discoveries for this target SHOULD 3006 be doubled, up to a maximum of MaxRequestPeriod, until a valid Route 3007 Reply is received for this target. 3009 8.2.1. Originating a Route Request 3011 A node initiating a Route Discovery for some target creates and 3012 initializes a Route Request option in a DSR Options header in some 3013 IP packet. This MAY be a separate IP packet, used only to carry 3014 this Route Request option, or the node MAY include the Route Request 3015 option in some existing packet that it needs to send to the target 3016 node (e.g., the IP packet originated by this node, that caused the 3017 node to attempt Route Discovery for the destination address of the 3018 packet). The Route Request option MUST be included in a DSR Options 3019 header in the packet. To initialize the Route Request option, the 3020 node performs the following sequence of steps: 3022 - The Option Type in the option MUST be set to the value 2. 3024 - The Opt Data Len field in the option MUST be set to the value 6. 3025 The total size of the Route Request option when initiated 3026 is 8 octets; the Opt Data Len field excludes the size of the 3027 Option Type and Opt Data Len fields themselves. 3029 - The Identification field in the option MUST be set to a new 3030 value, different from that used for other Route Requests recently 3031 initiated by this node for this same target address. For 3032 example, each node MAY maintain a single counter value for 3033 generating a new Identification value for each Route Request it 3034 initiates. 3036 - The Target Address field in the option MUST be set to the IP 3037 address that is the target of this Route Discovery. 3039 The Source Address in the IP header of this packet MUST be the node's 3040 own IP address. The Destination Address in the IP header of this 3041 packet MUST be the IP "limited broadcast" address (255.255.255.255). 3043 A node MUST maintain in its Route Request Table, information about 3044 Route Requests that it initiates. When initiating a new Route 3045 Request, the node MUST use the information recorded in the Route 3046 Request Table entry for the target of that Route Request, and it MUST 3047 update that information in the table entry for use in the next Route 3048 Request initiated for this target. In particular: 3050 - The Route Request Table entry for a target node records the 3051 Time-to-Live (TTL) field used in the IP header of the Route 3052 Request for the last Route Discovery initiated by this node for 3053 that target node. This value allows the node to implement a 3054 variety of algorithms for controlling the spread of its Route 3055 Request on each Route Discovery initiated for a target. As 3056 examples, two possible algorithms for this use of the TTL field 3057 are described in Section 3.3.4. 3059 - The Route Request Table entry for a target node records the 3060 number of consecutive Route Requests initiated for this target 3061 since receiving a valid Route Reply giving a route to that target 3062 node, and the remaining amount of time before which this node MAY 3063 next attempt at a Route Discovery for that target node. 3065 A node MUST use these values to implement a back-off algorithm to 3066 limit the rate at which this node initiates new Route Discoveries 3067 for the same target address. In particular, until a valid Route 3068 Reply is received for this target node address, the timeout 3069 between consecutive Route Discovery initiations for this target 3070 node with the same hop limit SHOULD increase by doubling the 3071 timeout value on each new initiation. 3073 The behavior of a node processing a packet containing DSR Options 3074 header with both a DSR Source Route option and a Route Request option 3075 is unspecified. Packets SHOULD NOT contain both a DSR Source Route 3076 option and a Route Request option. 3078 Packets containing a Route Request option SHOULD NOT include 3079 an Acknowledgement Request option, SHOULD NOT expect link-layer 3080 acknowledgement or passive acknowledgement, and SHOULD NOT be 3081 retransmitted. The retransmission of packets containing a Route 3082 Request option is controlled solely by the logic described in this 3083 section. 3085 8.2.2. Processing a Received Route Request Option 3087 When a node receives a packet containing a Route Request option, that 3088 node MUST process the option according to the following sequence of 3089 steps: 3091 - If the Target Address field in the Route Request matches this 3092 node's own IP address, then the node SHOULD return a Route Reply 3093 to the initiator of this Route Request (the Source Address in the 3094 IP header of the packet), as described in Section 8.2.4. The 3095 source route for this Reply is the sequence of hop addresses 3097 initiator, Address[1], Address[2], ..., Address[n], target 3099 where initiator is the address of the initiator of this 3100 Route Request, each Address[i] is an address from the Route 3101 Request, and target is the target of the Route Request (the 3102 Target Address field in the Route Request). The value n here 3103 is the number of addresses recorded in the Route Request, or 3104 (Opt Data Len - 6) / 4. 3106 The node then MUST replace the Destination Address field in 3107 the Route Request packet's IP header with the value in the 3108 Target Address field in the Route Request option, and continue 3109 processing the rest of the Route Request packet normally. The 3110 node MUST NOT process the Route Request option further and MUST 3111 NOT retransmit the Route Request to propagate it to other nodes 3112 as part of the Route Discovery. 3114 - Else, the node MUST examine the route recorded in the Route 3115 Request option (the IP Source Address field and the sequence of 3116 Address[i] fields) to determine if this node's own IP address 3117 already appears in this list of addresses. If so, the node MUST 3118 discard the entire packet carrying the Route Request option. 3120 - Else, if the Route Request was received through a network 3121 interface that requires physically bidirectional links for 3122 unicast transmission, the node MUST check if the Request was last 3123 forwarded by a node on its blacklist. If such an entry is found, 3124 and the state of the unidirectional link is "probable", then the 3125 Request MUST be silently discarded. 3127 - Else, if the Route Request was received through a network 3128 interface that requires physically bidirectional links for 3129 unicast transmission, the node MUST check if the Request was last 3130 forwarded by a node on its blacklist. If such an entry is found, 3131 and the state of the unidirectional link is "questionable", 3132 then the node MUST create and unicast a Route Request packet to 3133 that previous node, setting the IP Time-To-Live (TTL) to 1 to 3134 prevent the Request from being propagated. If the node receives 3135 a Route Reply in response to the new Request, it MUST remove the 3136 blacklist entry for that node, and SHOULD continue processing. 3137 If the node does not receive a Route Reply within some reasonable 3138 amount of time, MUST silently discard the Route Request packet. 3140 - Else, the node MUST search its Route Request Table for an entry 3141 for the initiator of this Route Request (the IP Source Address 3142 field). If such an entry is found in the table, the node MUST 3143 search the cache of Identification values of recently received 3144 Route Requests in that table entry, to determine if an entry 3145 is present in the cache matching the Identification value 3146 and target node address in this Route Request. If such an 3147 (Identification, target address) entry is found in this cache in 3148 this entry in the Route Request Table, then the node MUST discard 3149 the entire packet carrying the Route Request option. 3151 - Else, this node SHOULD further process the Route Request 3152 according to the following sequence of steps: 3154 o Add an entry for this Route Request in its cache of 3155 (Identification, target address) values of recently received 3156 Route Requests. 3158 o Conceptually create a copy of this entire packet and perform 3159 the following steps on the copy of the packet. 3161 o Append this node's own IP address to the list of Address[i] 3162 values in the Route Request, and increase the value of the 3163 Opt Data Len field in the Route Request by 4 (the size of an 3164 IP address). 3166 o This node SHOULD search its own Route Cache for a route 3167 (from itself, as if it were the source of a packet) to the 3168 target of this Route Request. If such a route is found in 3169 its Route Cache, then this node SHOULD follow the procedure 3170 outlined in Section 8.2.3 to return a "cached Route Reply" 3171 to the initiator of this Route Request, if permitted by the 3172 restrictions specified there. 3174 o If the node does not return a cached Route Reply, then this 3175 node SHOULD link-layer re-broadcast this copy of the packet, 3176 with a short jitter delay before the broadcast is sent. The 3177 jitter period SHOULD be chosen as a random period, uniformly 3178 distributed between 0 and BroadcastJitter. 3180 8.2.3. Generating a Route Reply using the Route Cache 3182 As described in Section 3.3.2, it is possible for a node processing a 3183 received Route Request to avoid propagating the Route Request further 3184 toward the target of the Request, if this node has in its Route Cache 3185 a route from itself to this target. Such a Route Reply generated by 3186 a node from its own cached route to the target of a Route Request is 3187 called a "cached Route Reply", and this mechanism can greatly reduce 3188 the overall overhead of Route Discovery on the network by reducing 3189 the flood of Route Requests. The general processing of a received 3190 Route Request is described in Section 8.2.2; this section specifies 3191 the additional requirements that MUST be met before a cached Route 3192 Reply may be generated and returned and specifies the procedure for 3193 returning such a cached Route Reply. 3195 While processing a received Route Request, for a node to possibly 3196 return a cached Route Reply, it MUST have in its Route Cache a route 3197 from itself to the target of this Route Request. However, before 3198 generating a cached Route Reply for this Route Request, the node MUST 3199 verify that there are no duplicate addresses listed in the route 3200 accumulated in the Route Request together with the route from this 3201 node's Route Cache. Specifically, there MUST be no duplicates among 3202 the following addresses: 3204 - The IP Source Address of the packet containing the Route Request, 3206 - The Address[i] fields in the Route Request, and 3208 - The nodes listed in the route obtained from this node's Route 3209 Cache, excluding the address of this node itself (this node 3210 itself is the common point between the route accumulated in the 3211 Route Request and the route obtained from the Route Cache). 3213 If any duplicates exist among these addresses, then the node MUST NOT 3214 send a cached Route Reply. The node SHOULD continue to process the 3215 Route Request as described in Section 8.2.2. 3217 If the Route Request and the route from the Route Cache meet the 3218 restriction above, then the node SHOULD construct and return a cached 3219 Route Reply as follows: 3221 - The source route for this reply is the sequence of hop addresses 3223 initiator, Address[1], Address[2], ..., Address[n], c-route 3225 where initiator is the address of the initiator of this Route 3226 Request, each Address[i] is an address from the Route Request, 3227 and c-route is the sequence of hop addresses in the source route 3228 to this target node, obtained from the node's Route Cache. In 3229 appending this cached route to the source route for the reply, 3230 the address of this node itself MUST be excluded, since it is 3231 already listed as Address[n]. 3233 - Send a Route Reply to the initiator of the Route Request, using 3234 the procedure defined in Section 8.2.4. The initiator of the 3235 Route Request is indicated in the Source Address field in the 3236 packet's IP header. 3238 If the node returns a cached Route Reply as described above, 3239 then the node MUST NOT propagate the Route Request further (i.e., 3240 the node MUST NOT rebroadcast the Route Request). In this case, 3241 instead, if the packet contains no other DSR options and contains 3242 no payload after the DSR Options header (e.g., the Route Request is 3243 not piggybacked on a TCP or UDP packet), then the node SHOULD simply 3244 discard the packet. Otherwise (if the packet contains other DSR 3245 options or contains any payload after the DSR Options header), the 3246 node SHOULD forward the packet along the cached route to the target 3247 of the Route Request. Specifically, if the node does so, it MUST use 3248 the following steps: 3250 - Copy the Target Address from the Route Request option in the DSR 3251 Options header to the Destination Address field in the packet's 3252 IP header. 3254 - Remove the Route Request option from the DSR Options header in 3255 the packet, and add a DSR Source Route option to the packet's DSR 3256 Options header. 3258 - In the DSR Source Route option, set the Address[i] fields 3259 to represent the source route found in this node's Route 3260 Cache to the original target of the Route Discovery (the 3261 new IP Destination Address of the packet). Specifically, 3262 the node copies the hop addresses of the source route into 3263 sequential Address[i] fields in the DSR Source Route option, 3264 for i = 1, 2, ..., n. Address[1] here is the address of this 3265 node itself (the first address in the source route found from 3266 this node to the original target of the Route Discovery). The 3267 value n here is the number of hop addresses in this source route, 3268 excluding the destination of the packet (which is instead already 3269 represented in the Destination Address field in the packet's IP 3270 header). 3272 - Initialize the Segments Left field in the DSR Source Route option 3273 to n as defined above. 3275 - The First Hop External (F) bit in the DSR Source Route option is 3276 copied from the External bit flagging the first hop in the source 3277 route for the packet, as indicated in the Route Cache. 3279 - The Last Hop External (L) bit in the DSR Source Route option is 3280 copied from the External bit flagging the last hop in the source 3281 route for the packet, as indicated in the Route Cache. 3283 - The Salvage field in the DSR Source Route option MUST be 3284 initialized to some nonzero value; the particular nonzero value 3285 used SHOULD be MAX_SALVAGE_COUNT. By initializing this field to 3286 a nonzero value, nodes forwarding or overhearing this packet will 3287 not consider a link to exist between the IP Source Address of the 3288 packet and the Address[1] address in the DSR Source Route option 3289 (e.g., they will not attempt to add this to their Route Cache as 3290 a link). By choosing MAX_SALVAGE_COUNT as the nonzero value to 3291 which the node initializes this field, nodes furthermore will not 3292 attempt to salvage this packet. 3294 - Transmit the packet to the next-hop node on the new source route 3295 in the packet, using the forwarding procedure described in 3296 Section 8.1.5. 3298 8.2.4. Originating a Route Reply 3300 A node originates a Route Reply in order to reply to a received and 3301 processed Route Request, according to the procedures described in 3302 Sections 8.2.2 and 8.2.3. The Route Reply is returned in a Route 3303 Reply option (Section 6.3). The Route Reply option MAY be returned 3304 to the initiator of the Route Request in a separate IP packet, used 3305 only to carry this Route Reply option, or it MAY be included in any 3306 other IP packet being sent to this address. 3308 The Route Reply option MUST be included in a DSR Options header in 3309 the packet returned to the initiator. To initialize the Route Reply 3310 option, the node performs the following sequence of steps: 3312 - The Option Type in the option MUST be set to the value 3. 3314 - The Opt Data Len field in the option MUST be set to the value 3315 (n * 4) + 3, where n is the number of addresses in the source 3316 route being returned (excluding the Route Discovery initiator 3317 node's address). 3319 - The Last Hop External (L) bit in the option MUST be 3320 initialized to 0. 3322 - The Reserved field in the option MUST be initialized to 0. 3324 - The Route Request Identifier MUST be initialized to the 3325 Identifier field of the Route Request that this reply is sent in 3326 response to. 3328 - The sequence of hop addresses in the source route are copied into 3329 the Address[i] fields of the option. Address[1] MUST be set to 3330 the first-hop address of the route after the initiator of the 3331 Route Discovery, Address[n] MUST be set to the last-hop address 3332 of the source route (the address of the target node), and each 3333 other Address[i] MUST be set to the next address in sequence in 3334 the source route being returned. 3336 The Destination Address field in the IP header of the packet carrying 3337 the Route Reply option MUST be set to the address of the initiator 3338 of the Route Discovery (i.e., for a Route Reply being returned in 3339 response to some Route Request, the IP Source Address of the Route 3340 Request). 3342 After creating and initializing the Route Reply option and the IP 3343 packet containing it, send the Route Reply. In sending the Route 3344 Reply from this node (but not from nodes forwarding the Route Reply), 3345 this node SHOULD delay the Reply by a small jitter period chosen 3346 randomly between 0 and BroadcastJitter. 3348 When returning any Route Reply in the case in which the MAC protocol 3349 in use in the network is not capable of transmitting unicast packets 3350 over unidirectional links, the source route used for routing the 3351 Route Reply packet MUST be obtained by reversing the sequence of 3352 hops in the Route Request packet (the source route that is then 3353 returned in the Route Reply). This restriction on returning a Route 3354 Reply enables the Route Reply to test this sequence of hops for 3355 bidirectionality, preventing the Route Reply from being received by 3356 the initiator of the Route Discovery unless each of the hops over 3357 which the Route Reply is returned (and thus each of the hops in the 3358 source route being returned in the Reply) is bidirectional. 3360 If sending a Route Reply to the initiator of the Route Request 3361 requires performing a Route Discovery, the Route Reply option MUST 3362 be piggybacked on the packet that contains the Route Request. This 3363 piggybacking prevents a loop wherein the target of the new Route 3364 Request (which was itself the initiator of the original Route 3365 Request) must do another Route Request in order to return its 3366 Route Reply. 3368 If sending the Route Reply to the initiator of the Route Request 3369 does not require performing a Route Discovery, a node SHOULD send a 3370 unicast Route Reply in response to every Route Request it receives 3371 for which it is the target node. 3373 8.2.5. Processing a Received Route Reply Option 3375 Section 8.1.4 describes the general processing for a received packet, 3376 including the addition of routing information from options in the 3377 packet's DSR Options header to the receiving node's Route Cache. 3379 If the received packet contains a Route Reply, no additional special 3380 processing of the Route Reply option is required beyond what is 3381 described there. As described in Section 4.1 anytime a node adds 3382 new information to its Route Cache (including the information added 3383 from this Route Reply option), the node SHOULD check each packet in 3384 its own Send Buffer (Section 4.2) to determine whether a route to 3385 that packet's IP Destination Address now exists in the node's Route 3386 Cache (including the information just added to the Cache). If so, 3387 the packet SHOULD then be sent using that route and removed from the 3388 Send Buffer. This general procedure handles all processing required 3389 for a received Route Reply option. 3391 When a MAC protocol requires bidirectional links for unicast 3392 transmission, a unidirectional link may be discovered by the 3393 propagation of the Route Request. When the Route Reply is sent over 3394 the reverse path, a forwarding node may discover that the next-hop is 3395 unreachable. In this case, it MUST add the next-hop address to its 3396 blacklist. 3398 8.3. Route Maintenance Processing 3400 Route Maintenance is the mechanism by which a source node S is able 3401 to detect, while using a source route to some destination node D, 3402 if the network topology has changed such that it can no longer use 3403 its route to D because a link along the route no longer works. When 3404 Route Maintenance indicates that a source route is broken, S can 3405 attempt to use any other route it happens to know to D, or can invoke 3406 Route Discovery again to find a new route for subsequent packets 3407 to D. Route Maintenance for this route is used only when S is 3408 actually sending packets to D. 3410 Specifically, when forwarding a packet, a node MUST attempt 3411 to confirm the reachability of the next-hop node, unless such 3412 confirmation had been received in the last MaintHoldoffTime. 3413 Individual implementations MAY choose to bypass such confirmation 3414 for some limited number of packets, as long as those packets all 3415 fall within MaintHoldoffTime within the last confirmation. If no 3416 confirmation is received after the retransmission of MaxMaintRexmt 3417 acknowledgement requests, after the initial transmission of the 3418 packet, and conceptually including all retransmissions provided 3419 by the MAC layer, the node determines that the link for this 3420 next-hop node of the source route is "broken". This confirmation 3421 from the next-hop node for Route Maintenance can be implemented 3422 using a link-layer acknowledgement (Section 8.3.1), using a 3423 "passive acknowledgement" (Section 8.3.2), or using a network-layer 3424 acknowledgement (Section 8.3.3); the particular strategy for 3425 retransmission timing depends on the type of acknowledgement 3426 mechanism used. When passive acknowledgements are being used, each 3427 retransmitted acknowledgement request SHOULD be explicit software 3428 acknowledgement requests. If no acknowledgement is received after 3429 MaxMaintRexmt retransmissions (if necessary), the node SHOULD 3430 originate a Route Error to the original sender of the packet, as 3431 described in Section 8.3.4. 3433 In deciding whether or not to send a Route Error in response to 3434 attempting to forward a packet from some sender over a broken link, 3435 a node MUST limit the number of consecutive packets from a single 3436 sender that the node attempts to forward over this same broken 3437 link for which the node chooses not to return a Route Error; this 3438 requirement MAY be satisfied by returning a Route Error for each 3439 packet that the node attempts to forward over a broken link. 3441 8.3.1. Using Link-Layer Acknowledgements 3443 If the MAC protocol in use provides feedback as to the successful 3444 delivery of a data packet (such as is provided by the link-layer 3445 acknowledgement frame defined by IEEE 802.11 [13]), then the use 3446 of the DSR Acknowledgement Request and Acknowledgement options 3447 is not necessary. If such link-layer feedback is available, it 3448 SHOULD be used instead of any other acknowledgement mechanism 3449 for Route Maintenance, and the node SHOULD NOT use either passive 3450 acknowledgements or network-layer acknowledgements for Route 3451 Maintenance. 3453 When using link-layer acknowledgements for Route Maintenance, the 3454 retransmission timing and the timing at which retransmission attempts 3455 are scheduled are generally controlled by the particular link layer 3456 implementation in use in the network. For example, in IEEE 802.11, 3457 the link-layer acknowledgement is returned after the data packet as 3458 a part of the basic access method of of the IEEE 802.11 Distributed 3459 Coordination Function (DCF) MAC protocol; the time at which the 3460 acknowledgement is expected to arrive and the time at which the next 3461 retransmission attempt (if necessary) will occur are controlled by 3462 the MAC protocol implementation. 3464 When a node receives a link-layer acknowledgement for any packet in 3465 its Maintenance Buffer, that node SHOULD remove that packet, as well 3466 as any other packets in its Maintenance Buffer with the same next-hop 3467 destination, from its Maintenance Buffer. 3469 8.3.2. Using Passive Acknowledgements 3471 When link-layer acknowledgements are not available, but passive 3472 acknowledgements [18] are available, passive acknowledgements SHOULD 3473 be used for Route Maintenance when originating or forwarding a packet 3474 along any hop other than the last hop (the hop leading to the IP 3475 Destination Address node of the packet). In particular, passive 3476 acknowledgements SHOULD be used for Route Maintenance in such cases 3477 if the node can place its network interface into "promiscuous" 3478 receive mode, and network links used for data packets generally 3479 operate bidirectionally. 3481 A node MUST NOT attempt to use passive acknowledgements for Route 3482 Maintenance for a packet originated or forwarded over its last hop 3483 (the hop leading to the IP Destination Address node of the packet), 3484 since the receiving node will not be forwarding the packet and thus 3485 no passive acknowledgement will be available to be heard by this 3486 node. Beyond this restriction, a node MAY utilize a variety of 3487 strategies in using passive acknowledgements for Route Maintenance of 3488 a packet that it originates or forwards. For example, the following 3489 two strategies are possible: 3491 - Each time a node receives a packet to be forwarded to a node 3492 other than the final destination (the IP Destination Address 3493 of the packet), that node sends the original transmission of 3494 that packet without requesting a network-layer acknowledgement 3495 for it. If no passive acknowledgement is received within 3496 PassiveAckTimeout after this transmission, the node retransmits 3497 the packet, again without requesting a network-layer 3498 acknowledgement for it; the same PassiveAckTimeout timeout value 3499 is used for each such attempt. If no acknowledgement has been 3500 received after a total of TryPassiveAcks retransmissions of 3501 the packet, network-layer acknowledgements (as described in 3502 Section 8.3.3) are used for all remaining attempts for that 3503 packet. 3505 - Each node maintains a table of possible next-hop destination 3506 nodes, noting whether or not passive acknowledgements can 3507 typically be expected from transmission to that node, and the 3508 expected latency and jitter of a passive acknowledgement from 3509 that node. Each time a node receives a packet to be forwarded 3510 to a node other than the IP Destination Address, the node checks 3511 its table of next-hop destination nodes to determine whether to 3512 use a passive acknowledgement or a network-layer acknowledgement 3513 for that transmission to that node. The timeout for this packet 3514 can also be derived from this table. A node using this method 3515 SHOULD prefer using passive acknowledgements to network-layer 3516 acknowledgements. 3518 In using passive acknowledgements for a packet that it originates or 3519 forwards, a node considers the later receipt of a new packet (e.g., 3520 with promiscuous receive mode enabled on its network interface) to be 3521 an acknowledgement of this first packet if both of the following two 3522 tests succeed: 3524 - The Source Address, Destination Address, Protocol, 3525 Identification, and Fragment Offset fields in the IP header 3526 of the two packets MUST match [30], and 3528 - If either packet contains a DSR Source Route header, both packets 3529 MUST contain one, and the value in the Segments Left field in the 3530 DSR Source Route header of the new packet MUST be less than that 3531 in the first packet. 3533 When a node hears such a passive acknowledgement for any packet in 3534 its Maintenance Buffer, that node SHOULD remove that packet, as well 3535 as any other packets in its Maintenance Buffer with the same next-hop 3536 destination, from its Maintenance Buffer. 3538 8.3.3. Using Network-Layer Acknowledgements 3540 When a node originates or forwards a packet and has no other 3541 mechanism of acknowledgement available to determine reachability 3542 of the next-hop node in the source route for Route Maintenance, 3543 that node SHOULD request a network-layer acknowledgement from that 3544 next-hop node. To do so, the node inserts an Acknowledgement Request 3545 option in the DSR Options header in the packet. The Identification 3546 field in that Acknowledgement Request option MUST be set to a value 3547 unique over all packets transmitted by this node to the same next-hop 3548 node that are either unacknowledged or recently acknowledged. 3550 When a node receives a packet containing an Acknowledgement Request 3551 option, then that node performs the following tests on the packet: 3553 - If the indicated next-hop node address for this packet does not 3554 match any of this node's own IP addresses, then this node MUST 3555 NOT process the Acknowledgement Request option. The indicated 3556 next-hop node address is the next Address[i] field in the DSR 3557 Source Route option in the DSR Options header in the packet, or 3558 is the IP Destination Address in the packet if the packet does 3559 not contain a DSR Source Route option or the Segments Left there 3560 is zero. 3562 - If the packet contains an Acknowledgement option, then this node 3563 MUST NOT process the Acknowledgement Request option. 3565 If neither of the tests above fails, then this node MUST process the 3566 Acknowledgement Request option by sending an Acknowledgement option 3567 to the previous-hop node; to do so, the node performs the following 3568 sequence of steps: 3570 - Create a packet and set the IP Protocol field to the protocol 3571 number assigned for a DSR Options header (TBA???). 3573 - Set the IP Source Address field in this packet to the IP address 3574 of this node, copied from the source route in the DSR Source 3575 Route option in that packet (or from the IP Destination Address 3576 field of the packet, if the packet does not contain a DSR Source 3577 Route option). 3579 - Set the IP Destination Address field in this packet to the IP 3580 address of the previous-hop node, copied from the source route 3581 in the DSR Source Route option in that packet (or from the IP 3582 Source Address field of the packet, if the packet does not 3583 contain a DSR Source Route option). 3585 - Add a DSR Options header to the packet, and set the DSR Options 3586 header's Next Header field to the "No Next Header" value. 3588 - Add an Acknowledgement option to the DSR Options header in the 3589 packet; set the Acknowledgement option's Option Type field to 6 3590 and the Opt Data Len field to 10. 3592 - Copy the Identification field from the received Acknowledgement 3593 Request option into the Identification field in the 3594 Acknowledgement option. 3596 - Set the ACK Source Address field in the Acknowledgement option to 3597 be the IP Source Address of this new packet (set above to be the 3598 IP address of this node). 3600 - Set the ACK Destination Address field in the Acknowledgement 3601 option to be the IP Destination Address of this new packet (set 3602 above to be the IP address of the previous-hop node). 3604 - Send the packet as described in Section 8.1.1. 3606 Packets containing an Acknowledgement option SHOULD NOT be placed in 3607 the Maintenance Buffer. 3609 When a node receives a packet with both an Acknowledgement option 3610 and an Acknowledgement Request option, if that node is not the 3611 destination of the Acknowledgement option (the IP Destination Address 3612 of the packet), then the Acknowledgement Request option MUST 3613 be ignored. Otherwise (that node is the destination of the 3614 Acknowledgement option), that node MUST process the Acknowledgement 3615 Request option by returning an Acknowledgement option according to 3616 the following sequence of steps: 3618 - Create a packet and set the IP Protocol field to the protocol 3619 number assigned for a DSR Options header (TBA???). 3621 - Set the IP Source Address field in this packet to the IP address 3622 of this node, copied from the source route in the DSR Source 3623 Route option in that packet (or from the IP Destination Address 3624 field of the packet, if the packet does not contain a DSR Source 3625 Route option). 3627 - Set the IP Destination Address field in this packet to the IP 3628 address of the node originating the Acknowledgement option. 3630 - Add a DSR Options header to the packet, and set the DSR Options 3631 header's Next Header field to the "No Next Header" value. 3633 - Add an Acknowledgement option to the DSR Options header in this 3634 packet; set the Acknowledgement option's Option Type field to 6 3635 and the Opt Data Len field to 10. 3637 - Copy the Identification field from the received Acknowledgement 3638 Request option into the Identification field in the 3639 Acknowledgement option. 3641 - Set the ACK Source Address field in the option to be the IP 3642 Source Address of this new packet (set above to be the IP address 3643 of this node). 3645 - Set the ACK Destination Address field in the option to be the IP 3646 Destination Address of this new packet (set above to be the IP 3647 address of the node originating the Acknowledgement option.) 3649 - Send the packet directly to the destination. The IP 3650 Destination Address MUST be treated as a direct neighbor node: 3651 the transmission to that node MUST be done in a single IP 3652 forwarding hop, without Route Discovery and without searching 3653 the Route Cache. In addition, this packet MUST NOT contain a 3654 DSR Acknowledgement Request, MUST NOT be retransmitted for Route 3655 Maintenance, and MUST NOT expect a link-layer acknowledgement or 3656 passive acknowledgement. 3658 When using network-layer acknowledgements for Route Maintenance, 3659 a node SHOULD use an adaptive algorithm in determining the 3660 retransmission timeout for each transmission attempt of an 3661 acknowledgement request. For example, a node SHOULD maintain a 3662 separate round-trip time (RTT) estimate for each to which it has 3663 recently attempted to transmit packets, and it SHOULD use this RTT 3664 estimate in setting the timeout for each retransmission attempt 3665 for Route Maintenance. The TCP RTT estimation algorithm has been 3666 shown to work well for this purpose in implementation and testbed 3667 experiments with DSR [22, 24]. 3669 8.3.4. Originating a Route Error 3671 When a node is unable to verify reachability of a next-hop node after 3672 reaching a maximum number of retransmission attempts, a node SHOULD 3673 send a Route Error to the IP Source Address of the packet. When 3674 sending a Route Error for a packet containing either a Route Error 3675 option or an Acknowledgement option, a node SHOULD add these existing 3676 options to its Route Error, subject to the limit described below. 3678 A node transmitting a Route Error MUST perform the following steps: 3680 - Create an IP packet and set the Source Address field in this 3681 packet's IP header to the address of this node. 3683 - If the Salvage field in the DSR Source Route option in the 3684 packet triggering the Route Error is zero, then copy the 3685 Source Address field of the packet triggering the Route Error 3686 into the Destination Address field in the new packet's IP 3687 header; otherwise, copy the Address[1] field from the DSR Source 3688 Route option of the packet triggering the Route Error into the 3689 Destination Address field in the new packet's IP header 3691 - Insert a DSR Options header into the new packet. 3693 - Add a Route Error Option to the new packet, setting the Error 3694 Type to NODE_UNREACHABLE, the Salvage value to the Salvage 3695 value from the DSR Source Route option of the packet triggering 3696 the Route Error, and the Unreachable Node Address field to 3697 the address of the next-hop node from the original source 3698 route. Set the Error Source Address field to this node's IP 3699 address, and the Error Destination field to the new packet's IP 3700 Destination Address. 3702 - If the packet triggering the Route Error contains any Route Error 3703 or Acknowledgement options, the node MAY append to its Route 3704 Error each of these options, with the following constraints: 3706 o The node MUST NOT include any Route Error option from the 3707 packet triggering the new Route Error, for which the total 3708 salvage count (Section 6.4) of that included Route Error 3709 would be greater than MAX_SALVAGE_COUNT in the new packet. 3711 o If any Route Error option from the packet triggering the new 3712 Route Error is not included in the packet, the node MUST NOT 3713 include any following Route Error or Acknowledgement options 3714 from the packet triggering the new Route Error. 3716 o Any appended options from the packet triggering the Route 3717 Error MUST follow the new Route Error in the packet. 3719 o In appending these options to the new Route Error, the order 3720 of these options from the packet triggering the Route Error 3721 MUST be preserved. 3723 - Send the packet as described in Section 8.1.1. 3725 8.3.5. Processing a Received Route Error Option 3727 When a node receives a packet containing a Route Error option, that 3728 node MUST process the Route Error option according to the following 3729 sequence of steps: 3731 - The node MUST remove from its Route Cache the link from the 3732 node identified by the Error Source Address field to the node 3733 identified by the Unreachable Node Address field (if this link is 3734 present in its Route Cache). If the node implements its Route 3735 Cache as a link cache, as described in Section 4.1, only this 3736 single link is removed; if the node implements its Route Cache as 3737 a path cache, however, all routes (paths) that use this link are 3738 removed. 3740 - If the option following the Route Error is an Acknowledgement 3741 or Route Error option sent by this node (that is, with 3742 Acknowledgement or Error Source Address equal to this node's 3743 address), copy the DSR options following the current Route 3744 Error into a new packet with IP Source Address equal to this 3745 node's own IP address and IP Destination Address equal to the 3746 Acknowledgement or Error Destination Address. Transmit this 3747 packet as described in Section 8.1.1, with the salvage count 3748 in the DSR Source Route option set to the Salvage value of the 3749 Route Error. 3751 In addition, after processing the Route Error as described above, 3752 the node MAY initiate a new Route Discovery for any destination node 3753 for which it then has no route in its Route Cache as a result of 3754 processing this Route Error, if the node has indication that a route 3755 to that destination is needed. For example, if the node has an open 3756 TCP connection to some destination node, then if the processing of 3757 this Route Error removed the only route to that destination from this 3758 node's Route Cache, then this node MAY initiate a new Route Discovery 3759 for that destination node. Any node, however, MUST limit the rate at 3760 which it initiates new Route Discoveries for any single destination 3761 address, and any new Route Discovery initiated in this way as part of 3762 processing this Route Error MUST conform to this limit. 3764 8.3.6. Salvaging a Packet 3766 When an intermediate node forwarding a packet detects through Route 3767 Maintenance that the next-hop link along the route for that packet is 3768 broken (Section 8.3), if the node has another route to the packet's 3769 IP Destination Address in its Route Cache, the node SHOULD "salvage" 3770 the packet rather than discarding it. To do so using the route found 3771 in its Route Cache, this node processes the packet as follows: 3773 - If the MAC protocol in use in the network is not capable of 3774 transmitting unicast packets over unidirectional links, as 3775 discussed in Section 3.3.1, then if this packet contains a Route 3776 Reply option, remove and discard the Route Reply option in the 3777 packet; if the DSR Options header in the packet then contains no 3778 DSR options, remove the DSR Options header from the packet. If 3779 the resulting packet then contains only an IP header, the node 3780 SHOULD NOT salvage the packet and instead SHOULD discard the 3781 entire packet. 3783 When returning any Route Reply in the case in which the MAC 3784 protocol in use in the network is not capable of transmitting 3785 unicast packets over unidirectional links, the source route 3786 used for routing the Route Reply packet MUST be obtained by 3787 reversing the sequence of hops in the Route Request packet (the 3788 source route that is then returned in the Route Reply). This 3789 restriction on returning a Route Reply and on salvaging a packet 3790 that contains a Route Reply option enables the Route Reply to 3791 test this sequence of hops for bidirectionality, preventing the 3792 Route Reply from being received by the initiator of the Route 3793 Discovery unless each of the hops over which the Route Reply is 3794 returned (and thus each of the hops in the source route being 3795 returned in the Reply) is bidirectional. 3797 - Modify the existing DSR Source Route option in the packet so 3798 that the Address[i] fields represent the source route found in 3799 this node's Route Cache to this packet's IP Destination Address. 3800 Specifically, the node copies the hop addresses of the source 3801 route into sequential Address[i] fields in the DSR Source Route 3802 option, for i = 1, 2, ..., n. Address[1] here is the address 3803 of the salvaging node itself (the first address in the source 3804 route found from this node to the IP Destination Address of the 3805 packet). The value n here is the number of hop addresses in this 3806 source route, excluding the destination of the packet (which is 3807 instead already represented in the Destination Address field in 3808 the packet's IP header). 3810 - Initialize the Segments Left field in the DSR Source Route option 3811 to n as defined above. 3813 - The First Hop External (F) bit in the DSR Source Route option is 3814 copied from the External bit flagging the first hop in the source 3815 route for the packet, as indicated in the Route Cache. 3817 - The Last Hop External (L) bit in the DSR Source Route option is 3818 copied from the External bit flagging the last hop in the source 3819 route for the packet, as indicated in the Route Cache. 3821 - The Salvage field in the DSR Source Route option is set to 1 plus 3822 the value of the Salvage field in the DSR Source Route option of 3823 the packet that caused the error. 3825 - Transmit the packet to the next-hop node on the new source route 3826 in the packet, using the forwarding procedure described in 3827 Section 8.1.5. 3829 As described in Section 8.3.4, the node in this case also SHOULD 3830 return a Route Error to the original sender of the packet. If the 3831 node chooses to salvage the packet, it SHOULD do so after originating 3832 the Route Error. 3834 8.4. Multiple Interface Support 3836 A node in DSR MAY have multiple network interfaces that support 3837 ad hoc network routing. This section describes special packet 3838 processing at such nodes. 3840 A node with multiple network interfaces MUST have some policy for 3841 determining which Request packets are forwarded out which network 3842 interfaces. For example, a node MAY choose to forward all Requests 3843 out all network interfaces. 3845 When a node with multiple network interfaces propagates a Route 3846 Request on an network interface other than the one it received the 3847 Request on, it MUST modify the address list between receipt and 3848 re-propagation as follows: 3850 - Append the address of the incoming interface 3852 - If the incoming interface and outgoing interface differ in 3853 whether or not they require bidirectionality for unicast 3854 transmission, append the address 127.0.0.1 3856 - If the incoming interface and outgoing interface differ in 3857 whether or not unidirectional links are common, append the 3858 address 127.0.0.2 3860 - Append the address of the outgoing interface 3862 When a node forwards a packet containing a source route, it MUST 3863 assume that the next hop is reachable on the incoming interface, 3864 unless the next hop is the address of one of this node's interfaces, 3865 in which case this node MUST process the packet in the same way as if 3866 the node had just received it from that interface. 3868 If a node which previously had multiple network interfaces receives a 3869 packet sent with a source route specifying an interface change to an 3870 interface that is no longer available, it MAY send a Route Error to 3871 the source of the packet without attempting to forward the packet on 3872 the incoming interface, unless the network uses an autoconfiguration 3873 mechanism that may have allowed another node to acquire the now 3874 unused address of the unavailable interface. 3876 Source routes MUST never contain the special addresses 127.0.0.1 and 3877 127.0.0.2. 3879 8.5. Fragmentation and Reassembly 3881 When a node using DSR wishes to fragment a packet that contains a DSR 3882 header not containing a Route Request option, it MUST perform the 3883 following sequence of steps: 3885 - Remove the DSR Options header from the packet. 3887 - Fragment the packet. 3889 - IP-in-IP encapsulate each fragment. 3891 - Add the DSR Options header to each fragment. If a Source Route 3892 header is present in the DSR Options header, increment the 3893 Salvage field. 3895 When a node using the DSR protocol receives an IP-in-IP encapsulated 3896 packet destined to itself, it SHOULD decapsulate the packet and 3897 reassemble any fragments contained inside, in accordance with 3898 RFC 791 [30]. 3900 8.6. Flow State Processing 3902 A node implementing the optional DSR flow state extension MUST follow 3903 these additional processing steps. 3905 8.6.1. Originating a Packet 3907 When originating any packet to be routed using flow state, a node 3908 using DSR flow state MUST: 3910 - If the route to be used for this packet has never had a DSR 3911 flow state established along it (or the existing flow state has 3912 expired): 3914 o Generate a 16-bit Flow ID larger than any unexpired Flow IDs 3915 used for this destination. Odd Flow IDs MUST be chosen for 3916 "default" flows; even Flow IDs MUST be chosen for non-default 3917 flows. 3919 o Add a DSR Options header, as described in Section 8.1.2. 3921 o Add a DSR Flow State header, as described in Section 8.6.2. 3923 o Initialize the Hop Count field in the DSR Flow State header 3924 to 0. 3926 o Set the Flow ID field in the DSR Flow State header to the 3927 Flow ID generated in the first step. 3929 o Add a Timeout option to the DSR Options header. 3931 o Add a Source Route option after the Timeout option. with the 3932 route to be used, as described in Section 8.1.3. 3934 o The source SHOULD record this flow in its Flow Table. 3936 o If this flow is recorded in the Flow Table, the TTL MUST be 3937 set to be the TTL of the flow establishment packet. 3939 o If this flow is recorded in the Flow Table, the timeout MUST 3940 be set to a value no less than the value specified in the 3941 Timeout option. 3943 - If the route to be used for this packet has had DSR flow state 3944 established along it, but has not been established end-to-end: 3946 o Add a DSR Options header, as described in Section 8.1.2. 3948 o Add a DSR Flow State header, as described in Section 8.6.2. 3950 o Initialize the Hop Count field in the DSR Flow State header 3951 to 0. 3953 o The Flow ID field of the DSR Flow State header SHOULD be the 3954 Flow ID previously used for this route. If it is not, the 3955 steps for sending packets along never before established 3956 routes MUST be followed in place of these. 3958 o Add a Timeout option to the DSR Options header, setting the 3959 Timeout to a value not greater than the timeout remaining for 3960 this flow in the Flow Table. 3962 o Add a Source Route option after the Timeout option with the 3963 route to be used, as described in Section 8.1.3 3965 o If the IP TTL is not equal to the TTL specified in the Flow 3966 Table, the source MUST set a flag to indicate that this flow 3967 cannot be used as default. 3969 - If the route the node wishes to use for this packet has been 3970 established end-to-end and is not the default flow: 3972 o Add a DSR Flow State header, as described in Section 8.6.2. 3974 o Initialize the Hop Count field in the DSR Flow State header 3975 to 0. 3977 o The Flow ID field of the DSR Flow State header SHOULD be the 3978 Flow ID previously used for this route. If it is not, the 3979 steps for sending packets along never before established 3980 routes MUST be followed in place of these. 3982 o If the next hop requires a Hop-by-Hop acknowledgement, 3983 add a DSR Options header, as described in Section 8.1.2, 3984 and an Acknowledgement Request option, as described in 3985 Section 8.3.3. 3987 o A DSR Options header SHOULD NOT be added to a packet, unless 3988 it is added to carry an Acknowledgement Request option, in 3989 which case: 3991 + A Source Route option in the DSR Options header SHOULD 3992 NOT be added. 3994 + If a Source Route option in the DSR Options header is 3995 added, the steps for sending packets along routes not 3996 yet established end-to-end MUST be followed in place of 3997 these. 3999 + A Timeout option SHOULD NOT be added. 4001 + If a Timeout option is added, it MUST specify a timeout 4002 not greater than the timeout remaining for this flow in 4003 the Flow Table. 4005 - If the route the node wishes to use for this packet has been 4006 established end-to-end and is the current default flow: 4008 o If the IP TTL is not equal to the TTL specified in the Flow 4009 Table, the source MUST follow the steps for sending a packet 4010 along a non-default flow that has been established end-to-end 4011 in place of these steps. 4013 o If the next hop requires a Hop-by-Hop acknowledgement, 4014 the sending node MUST add a DSR Options header and 4015 an Acknowledgement Request option, as described in 4016 Section 8.3.3. The sending node MUST NOT add any additional 4017 options to this header. 4019 o A DSR Options header SHOULD NOT be added, except as specified 4020 in the previous step. If one is added in a way inconsistent 4021 with the previous step, the source MUST follow the steps 4022 for sending a packet along a non-default flow that has been 4023 established end-to-end in place of these steps. 4025 8.6.2. Inserting a DSR Flow State Header 4027 A node originating a packet adds a DSR Flow State header to the 4028 packet, if necessary, to carry information needed by the routing 4029 protocol. Only one DSR Flow State header may be in any packet. 4030 A DSR Flow State header is added to a packet by performing the 4031 following sequence of steps: 4033 - Insert a DSR Flow State header after the IP header and any 4034 Hop-by-Hop Options header that may already be in the packet, but 4035 before any other header that may be present. 4037 - Set the Next Header field of the DSR Flow State header to the 4038 Next Header field of the previous header (either an IP header or 4039 a Hop-by-Hop Options header). 4041 - Set the Next Header field of the previous header to the Protocol 4042 number assigned to DSR Options headers. 4044 8.6.3. Receiving a Packet 4046 This section describes processing only for packets that are sent to 4047 the processing node as the next-hop node; that is, when the MAC-layer 4048 destination address is the MAC address of this node. Otherwise, the 4049 process described in Sections 8.6.5 should be followed. 4051 The flow along which a packet is being sent is considered to be in 4052 the Flow Table if the triple (IP Source Address, IP Destination 4053 Address, Flow ID) has an unexpired entry in the Flow Table. 4055 When a node using DSR flow state receives a packet, it MUST follow 4056 the following steps for processing: 4058 - If a DSR Flow State header is present, increment the Hop Count 4059 field. 4061 - In addition, if a DSR Flow State header is present, then if the 4062 triple (IP Source Address, IP Destination Address, Flow ID) is 4063 in this node's Automatic Route Shortening Table and the packet 4064 is listed in the entry, then the node MAY send a gratuitous 4065 Route Reply as described in Section 4.4, subject to the rate 4066 limiting specified in Section 4.4. This gratuitous Route Reply 4067 gives the route by which the packet originally reached this 4068 node. Specifically, the node sending the gratuitous Route Reply 4069 constructs the route to return in the Route Reply as follows: 4071 o Let k = (packet Hop Count) - (table Hop Count), where 4072 packet Hop Count is the value of the Hop Count field in this 4073 received packet, and table Hop Count is the Hop Count value 4074 stored for this packet in the corresponding entry in this 4075 node's Automatic Route Shortening Table. 4077 o Copy the complete source route for this flow from the 4078 corresponding entry in the node's Flow Table. 4080 o Remove from this route the k hops immediately preceding this 4081 node in the route, since these are the hops "skipped over" 4082 by the packet as recorded in the Automatic Route Shortening 4083 Table entry. 4085 - Process each of the DSR options within the DSR Options header in 4086 order: 4088 o On receiving a Pad1 or PadN option, skip over the option 4090 o On receiving a Route Request for which this node is the 4091 destination, remove the option and return a Route Reply as 4092 specified in Section 8.2.2. 4094 o On receiving a broadcast Route Request that this node has not 4095 previously seen for which this node is not the destination, 4096 append this node's incoming interface address to the Route 4097 Request, continue propagating the Route Request as specified 4098 in Section 8.2.2, send the payload, if any, to the network 4099 layer, and stop processing. 4101 o On receiving a Route Request that this node has not 4102 previously seen for which this node is not the destination, 4103 discard the packet and stop processing. 4105 o On receiving any Route Request, add appropriate links to the 4106 cache, as specified in Section 8.2.2. 4108 o On receiving a Route Reply that this node is the Requester 4109 for, remove the Route Reply from the packet and process it as 4110 specified in Section 8.2.5. 4112 o On receiving any Route Reply, add appropriate links to the 4113 cache, as specified in Section 8.2.5. 4115 o On receiving any Route Error of type NODE_UNREACHABLE, 4116 remove appropriate links to the cache, as specified in 4117 Section 8.3.5. 4119 o On receiving a Route Error of type NODE_UNREACHABLE that 4120 this node is the Error Destination Address of, remove the 4121 Route Error from the packet and process it as specified 4122 in Section 8.3.5. It also MUST stop originating packets 4123 along any flows using the link from Error Source Address to 4124 Unreachable Node, and it MAY remove from its Flow Table any 4125 flows using the link from Error Source Address to Unreachable 4126 Node. 4128 o On receiving a Route Error of type UNKNOWN_FLOW that this 4129 node is not the Error Destination Address of, the node checks 4130 if the Route Error corresponds to a flow in its Flow Table. 4131 If it does not, the node silently discards the Route Error; 4132 otherwise, it forwards the packet to the expected previous 4133 hop of the corresponding flow. If Route Maintenance cannot 4134 confirm the reachability of the previous hop, the node checks 4135 if the network interface requires bidirectional links for 4136 operation. If it does, the node silently discards the Error; 4137 otherwise, it sends the Error as if it were originating it, 4138 as described in Section 8.1.1. 4140 o On receiving a Route Error of type UNKNOWN_FLOW that this 4141 node is the Error Destination Address of, remove the Route 4142 Error from the packet and mark the flow specified by the 4143 triple (Error Destination Address, Original IP Destination 4144 Address, Flow ID) as not having been established end-to-end. 4146 o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN 4147 that this node is not the Error Destination Address of, the 4148 node checks if the Route Error corresponds to a flow in 4149 its Default Flow Table. If it does not, the node silently 4150 discards the Route Error; otherwise, it forwards the packet 4151 to the expected previous hop of the corresponding flow. 4152 If Route Maintenance cannot confirm the reachability of 4153 the previous hop, the node checks if the network interface 4154 requires bidirectional links for operation. If it does, 4155 the node silently discards the Error; otherwise, it sends 4156 the Error as if it were originating it, as described in 4157 Section 8.1.1. 4159 o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN that 4160 this node is the Error Destination Address of, remove the 4161 Route Error from the packet and mark the default flow between 4162 the Error Destination Address and the Original IP Destination 4163 Address as not having been established end-to-end. 4165 o On receiving a Acknowledgement Request option, the receiving 4166 node removes the Acknowledgement Request option and replies 4167 to the previous hop with a Acknowledgement option. If the 4168 previous hop cannot be determined, the Acknowledgement 4169 Request option is discarded, and processing continues. 4171 o On receiving a Acknowledgement option, the receiving node 4172 removes the Acknowledgement option and processes it. 4174 o On receiving any Acknowledgement option, add the appropriate 4175 link to the cache, as specified in Section 8.1.4 4177 o On receiving any Source Route option, add appropriate links 4178 to the cache, as specified in Section 8.1.4. 4180 o On receiving a Source Route option and either no DSR Flow 4181 State header is present, the flow this packet is being sent 4182 along is in the Flow Table, or no Timeout option preceded the 4183 Source Route option in this DSR Options header, process it 4184 as specified in Section 8.1.4. Stop processing this packet 4185 unless the last address in the Source Route option is an 4186 address of this node. 4188 o On receiving a Source Route option in a packet with a DSR 4189 Flow State header, and the Flow ID specified in the DSR Flow 4190 State header is not in the Flow Table, add the flow to the 4191 Flow Table, setting the Timeout value to a value not greater 4192 than the Timeout field of the Timeout option in this header. 4193 If no Timeout option preceded the Source Route option in this 4194 header, the flow MUST NOT be added to the Flow Table. 4196 If the Flow ID is odd and larger than any unexpired, odd 4197 Flow IDs, it is set to be default in the Default Flow ID 4198 Table. 4200 Then process the Route option as specified in Section 8.1.4. 4201 Stop processing this packet unless the last address in the 4202 Source Route option is an address of this node. 4204 o On receiving a Timeout option, check if this packet contains 4205 a DSR Flow State header. If this packet does not contain a 4206 DSR Flow State header, discard the DSR option. Otherwise, 4207 record the Timeout value in the option for future reference. 4208 The value recorded SHOULD be discarded when the node has 4209 finished processing this DSR Options header. If the flow 4210 that this packet is being sent along is in the Flow Table, it 4211 MAY set the flow to time out no more than Timeout seconds in 4212 the future. 4214 o On receiving a Destination and Flow ID option, if the 4215 IP Destination Address is not an address of this node, 4216 forward the packet according to the Flow ID, as described in 4217 Section 8.6.4, and stop processing this packet. 4219 o On receiving a Destination and Flow ID option, if the IP 4220 Destination Address is an address of this node, set the 4221 IP Destination Address to the New IP Destination Address 4222 specified in the option, and set the Flow ID to the New 4223 Flow Identifier. Then remove the DSR option from the packet 4224 and continue processing. 4226 - If the IP Destination Address is an address of this node, remove 4227 the DSR Options header, if any, and pass the packet up the 4228 network stack and stop processing. 4230 - If there is still a DSR Options header containing no options, 4231 remove the DSR Options header. 4233 - If there is still a DSR Flow State header, forward the packet 4234 according to the Flow ID, as described in Section 8.6.4. 4236 - If there is neither a DSR Options header nor a DSR Flow State 4237 header, but there is an entry in the Default Flow Table for the 4238 (IP Source Address, IP Destination Address) pair: 4240 o If the IP TTL is not equal to the TTL expected in the Flow 4241 Table, insert a DSR Flow State header, setting Hop Count 4242 equal to the Hop Count of this node, and the Flow ID equal 4243 to the default Flow ID found in the table, and forward 4244 this packet according to the Flow ID, as described in 4245 Section 8.6.4. 4247 o Otherwise, follow the steps for forwarding the packet using 4248 Flow IDs described in Section 8.6.4, but taking the Flow ID 4249 to be the default Flow ID found in the table. 4251 - If there is no DSR Options header, no DSR Flow State header, and 4252 no default flow can be found, the node returns a Route Error of 4253 type Default Flow Unknown to the IP Source Address, specifying 4254 the IP Destination Address as the Original IP Destination in the 4255 type-specific field. 4257 8.6.4. Forwarding a Packet Using Flow IDs 4259 To forward a packet using Flow IDs, a node MUST follow the following 4260 sequence of steps: 4262 - If the triple (IP Source Address, IP Destination Address, 4263 Flow ID) is not in the Flow Table, return a Route Error of type 4264 Unknown Flow. 4266 - If a hop-by-hop acknowledgement is required for the next hop, the 4267 node MUST include an Acknowledegment Request option as specified 4268 in Section 8.3.3. If no DSR Options header is in the packet for 4269 the Acknowledgement Request option to be attached to, it MUST be 4270 included, as described in Section 8.1.2, except that it MUST be 4271 added after the DSR Flow State header, if one is present. 4273 - Attempt to transmit this packet to the next hop as specified in 4274 the Flow Table, performing Route Maintenance to detect broken 4275 routes. 4277 8.6.5. Promiscuously Receiving a Packet 4279 This section describes processing only for packets that have MAC 4280 destinations other than the processing node. Otherwise, the process 4281 described in Section 8.6.3 should be followed. 4283 When a node using DSR flow state promiscuously overhears a packet, it 4284 SHOULD follow the following steps for processing: 4286 - If the packet contains a DSR Flow State header, and if the triple 4287 (IP Source Address, IP Destination Address, Flow ID) is in the 4288 Flow Table and the Hop Count is less than the Hop Count in the 4289 flow's entry, the node MAY retain the packet in the Automatic 4290 Route Shortening Table. If it can be determined that this 4291 Flow ID has been recently used, it SHOULD retain the packet in 4292 the Automatic Route Shortening Table. 4294 - If the packet contains neither a DSR Flow State header nor a 4295 Source Route option, and a Default Flow ID can be found in 4296 the Default Flow Table for (IP Source Address, IP Destination 4297 Address), and the IP TTL is greater than the TTL in the table 4298 for the default flow, the node MAY retain the packet in the 4299 Automatic Route Shortening Table. If it can be determined that 4300 this Flow ID has been used recently, the node SHOULD retain the 4301 packet in the Automatic Route Shortening Table. 4303 8.6.6. Operation where the Layer below DSR Decreases 4304 the IP TTL Non-Uniformly 4306 Some nodes may use an IP tunnel as a DSR hop. If different packets 4307 sent along this IP tunnel can take different routes, the reduction 4308 in IP TTL across this link may be different for different packets. 4309 This prevents the Automatic Route Shortening and Loop Detection 4310 functionality from working properly when used in conjunction with 4311 default routes. 4313 Nodes forwarding packets without a Source Route option onto a link 4314 with unpredictable TTL changes MUST ensure that a DSR Flow State 4315 header is present, indicating the correct Hop Count and Flow ID. 4317 8.6.7. Salvage Interactions with DSR 4319 Nodes salvaging packets MUST remove the DSR Flow State header, if 4320 present. 4322 Any time this document refers to the Salvage field in the Source 4323 Route option, packets without a Source Route option are considered to 4324 have the value zero in the Salvage field. 4326 9. Protocol Constants and Configuration Variables 4328 Any DSR implementation MUST support the following configuration 4329 variables and MUST support a mechanism enabling the value of these 4330 variables to be modified by system management. The specific variable 4331 names are used for demonstration purposes only, and an implementation 4332 is not required to use these names for the configuration variables, 4333 so long as the external behavior of the implementation is consistent 4334 with that described in this document. 4336 For each configuration variable below, the default value is specified 4337 to simplify configuration. In particular, the default values given 4338 below are chosen for a DSR network running over 2 Mbps IEEE 802.11 4339 network interfaces using the Distributed Coordination Function (DCF) 4340 MAC with RTS and CTS [13, 5]. 4342 BroadcastJitter 10 milliseconds 4344 RouteCacheTimeout 300 seconds 4346 SendBufferTimeout 30 seconds 4348 RequestTableSize 64 nodes 4349 RequestTableIds 16 identifiers 4350 MaxRequestRexmt 16 retransmissions 4351 MaxRequestPeriod 10 seconds 4352 RequestPeriod 500 milliseconds 4353 NonpropRequestTimeout 30 milliseconds 4355 RexmtBufferSize 50 packets 4357 MaintHoldoffTime 250 milliseconds 4359 MaxMaintRexmt 2 retransmissions 4361 TryPassiveAcks 1 attempt 4362 PassiveAckTimeout 100 milliseconds 4364 GratReplyHoldoff 1 second 4366 In addition, the following protocol constant MUST be supported by any 4367 implementation of the DSR protocol: 4369 MAX_SALVAGE_COUNT 15 salvages 4371 10. IANA Considerations 4373 This document specifies the DSR Options header, which requires an IP 4374 Protocol number. 4376 This document also specifies the DSR Flow State header, which 4377 requires an IP Protocol number. 4379 In addition, this document proposes use of the value "No Next Header" 4380 (originally defined for use in IPv6) within an IPv4 packet, to 4381 indicate that no further header follows a DSR Options header. 4383 Finally, this document introduces a number of DSR options for use in 4384 the DSR Options header, and additional new DSR options may be defined 4385 in the future. Each of these options requires a unique Option Type 4386 value, with the most significant 3 bits (that is, Option Type & 0xE0) 4387 encoded as defined in Section 6.1. It is necessary only that each 4388 Option Type value be unique, not that they be unique in the remaining 4389 5 bits of the value after these 3 most significant bits. 4391 11. Security Considerations 4393 This document does not specifically address security concerns. This 4394 document does assume that all nodes participating in the DSR protocol 4395 do so in good faith and without malicious intent to corrupt the 4396 routing ability of the network. 4398 Depending on the threat model, a number of different mechanisms can 4399 be used to secure DSR. For example, in an environment where node 4400 compromise is unrealistic and where where all the nodes participating 4401 in the DSR protocol share a common goal that motivates their 4402 participation in the protocol, the communications between the nodes 4403 can be encrypted at the physical channel or link layer to prevent 4404 attack by outsiders. Cryptographic approaches, such as that provided 4405 by Ariadne [12] or SRP [26], can resist stronger attacks. 4407 Appendix A. Link-MaxLife Cache Description 4409 As guidance to implementors of DSR, the description below outlines 4410 the operation of a possible implementation of a Route Cache for DSR 4411 that has been shown to outperform other other caches studied in 4412 detailed simulations. Use of this design for the Route Cache is 4413 recommended in implementations of DSR. 4415 This cache, called "Link-MaxLife" [10], is a link cache, in that each 4416 individual link (hop) in the routes returned in Route Reply packets 4417 (or otherwise learned from the header of overhead packets) is added 4418 to a unified graph data structure of this node's current view of the 4419 network topology, as described in Section 4.1. To search for a route 4420 in this cache to some destination node, the sending node uses a graph 4421 search algorithm, such as the well-known Dijkstra's shortest-path 4422 algorithm, to find the current best path through the graph to the 4423 destination node. 4425 The Link-MaxLife form of link cache is adaptive in that each link in 4426 the cache has a timeout that is determined dynamically by the caching 4427 node according to its observed past behavior of the two nodes at the 4428 ends of the link; in addition, when selecting a route for a packet 4429 being sent to some destination, among cached routes of equal length 4430 (number of hops) to that destination, Link-MaxLife selects the route 4431 with the longest expected lifetime (highest minimum timeout of any 4432 link in the route). 4434 Specifically, in Link-MaxLife, a link's timeout in the Route Cache 4435 is chosen according to a "Stability Table" maintained by the caching 4436 node. Each entry in a node's Stability Table records the address of 4437 another node and a factor representing the perceived "stability" of 4438 this node. The stability of each other node in a node's Stability 4439 Table is initialized to InitStability. When a link from the Route 4440 Cache is used in routing a packet originated or salvaged by that 4441 node, the stability metric for each of the two endpoint nodes of that 4442 link is incremented by the amount of time since that link was last 4443 used, multiplied by StabilityIncrFactor (StabilityIncrFactor >= 1); 4444 when a link is observed to break and the link is thus removed 4445 from the Route Cache, the stability metric for each of the two 4446 endpoint nodes of that link is multiplied by StabilityDecrFactor 4447 (StabilityDecrFactor < 1). 4449 When a node adds a new link to its Route Cache, the node assigns a 4450 lifetime for that link in the Cache equal to the stability of the 4451 less "stable" of the two endpoint nodes for the link, except that a 4452 link is not allowed to be given a lifetime less than MinLifetime. 4453 When a link is used in a route chosen for a packet originated or 4454 salvaged by this node, the link's lifetime is set to be at least 4455 UseExtends into the future; if the lifetime of that link in the 4456 Route Cache is already further into the future, the lifetime remains 4457 unchanged. 4459 When a node using Link-MaxLife selects a route from its Route Cache 4460 for a packet being originated or salvaged by this node, it selects 4461 the shortest-length route that has the longest expected lifetime 4462 (highest minimum timeout of any link in the route), as opposed to 4463 simply selecting an arbitrary route of shortest length. 4465 The following configuration variables are used in the description 4466 of Link-MaxLife above. The specific variable names are used for 4467 demonstration purposes only, and an implementation is not required 4468 to use these names for these configuration variables. For each 4469 configuration variable below, the default value is specified to 4470 simplify configuration. In particular, the default values given 4471 below are chosen for a DSR network where nodes move at relative 4472 velocities between 12 and 25 seconds per transmission radius. 4474 InitStability 25 seconds 4475 StabilityIncrFactor 4 4476 StabilityDecrFactor 2 4478 MinLifetime 1 second 4479 UseExtends 120 seconds 4481 Appendix B. Location of DSR in the ISO Network Reference Model 4483 When designing DSR, we had to determine at what layer within 4484 the protocol hierarchy to implement ad hoc network routing. We 4485 considered two different options: routing at the link layer (ISO 4486 layer 2) and routing at the network layer (ISO layer 3). Originally, 4487 we opted to route at the link layer for several reasons: 4489 - Pragmatically, running the DSR protocol at the link layer 4490 maximizes the number of mobile nodes that can participate in 4491 ad hoc networks. For example, the protocol can route equally 4492 well between IPv4 [30], IPv6 [7], and IPX [35] nodes. 4494 - Historically [15, 16], DSR grew from our contemplation of 4495 a multi-hop propagating version of the Internet's Address 4496 Resolution Protocol (ARP) [28], as well as from the routing 4497 mechanism used in IEEE 802 source routing bridges [27]. These 4498 are layer 2 protocols. 4500 - Technically, we designed DSR to be simple enough that it could 4501 be implemented directly in the firmware inside wireless network 4502 interface cards [15, 16], well below the layer 3 software within 4503 a mobile node. We see great potential in this for DSR running 4504 inside a cloud of mobile nodes around a fixed base station, 4505 where DSR would act to transparently extend the coverage range 4506 to these nodes. Mobile nodes that would otherwise be unable 4507 to communicate with the base station due to factors such as 4508 distance, fading, or local interference sources could then reach 4509 the base station through their peers. 4511 Ultimately, however, we decided to specify and to implement [22] 4512 DSR as a layer 3 protocol, since this is the only layer at which we 4513 could realistically support nodes with multiple network interfaces of 4514 different types forming an ad hoc network. 4516 Appendix C. Implementation and Evaluation Status 4518 The initial design of the DSR protocol, including DSR's basic Route 4519 Discovery and Route Maintenance mechanisms, was first published in 4520 December 1994 [15], with significant additional design details and 4521 initial simulation results published in early 1996 [16]. 4523 The DSR protocol has been extensively studied since then through 4524 additional detailed simulations. In particular, we have implemented 4525 DSR in the ns-2 network simulator [25, 5] and performed extensive 4526 simulations of DSR using ns-2 (e.g., [5, 21]). We have also 4527 conducted evaluations of the different caching strategies in this 4528 document [10]. 4530 We have also implemented the DSR protocol under the FreeBSD 2.2.7 4531 operating system running on Intel x86 platforms. FreeBSD [9] is 4532 based on a variety of free software, including 4.4 BSD Lite from the 4533 University of California, Berkeley. For the environments in which 4534 we used it, this implementation is functionally equivalent to the 4535 version of the DSR protocol specified in this document. 4537 During the 7 months from August 1998 to February 1999, we designed 4538 and implemented a full-scale physical testbed to enable the 4539 evaluation of ad hoc network performance in the field, in an actively 4540 mobile ad hoc network under realistic communication workloads. The 4541 last week of February and the first week of March of 1999 included 4542 demonstrations of this testbed to a number of our sponsors and 4543 partners, including Lucent Technologies, Bell Atlantic, and DARPA. 4544 A complete description of the testbed is available as a Technical 4545 Report [22]. 4547 We have since ported this implementation of DSR to FreeBSD 3.3, and 4548 we have also added a preliminary version of Quality of Service (QoS) 4549 support for DSR. A demonstration of this modified version of DSR was 4550 presented in July 2000. These QoS features are not included in this 4551 document, and will be added later in a separate document on top of 4552 the base protocol specified here. 4554 DSR has also been implemented under Linux by Alex Song at the 4555 University of Queensland, Australia [34]. This implementation 4556 supports the Intel x86 PC platform and the Compaq iPAQ. 4558 The Network and Telecommunications Research Group at Trinity College 4559 Dublin have implemented a version of DSR on Windows CE. 4561 Microsoft Research has implemented a version of DSR on Windows XP, 4562 and has used it in testbeds of over 15 nodes. Several machines use 4563 this implementation as their primary means of accessing the Internet. 4565 Several other independent groups have also used DSR as a platform for 4566 their own research, or and as a basis of comparison between ad hoc 4567 network routing protocols. 4569 A preliminary version of the optional DSR flow state extension was 4570 implemented in FreeBSD 3.3. A demonstration of this modified version 4571 of DSR was presented in July 2000. The DSR flow state extension has 4572 also been extensively evaluated using simulation [11]. 4574 Changes from Previous Version of the Draft 4576 This appendix briefly lists some of the major changes in this 4577 draft relative to the previous version of this same draft, 4578 draft-ietf-manet-dsr-07.txt: 4580 - Integrated the specification of the DSR flow state extension into 4581 the main DSR draft. Previously, these had been specified in a 4582 separate draft. 4584 - Included processing directions for unknown Option Types. 4586 - Changed the name of the DSR header to DSR Options header, to 4587 clarify it as a separate header type from the DSR Flow State 4588 header. 4590 - Slightly changed the format of the DSR Options header and the DSR 4591 Flow State header to allow the same IP protocol number to be used 4592 for both. The new Flow State Header (F) bit in the two headers 4593 indicates which type of header is being used (the bit is clear in 4594 a DSR Options header and set in a DSR Flow State header). 4596 Acknowledgements 4598 The protocol described in this document has been designed and 4599 developed within the Monarch Project, a research project at Rice 4600 University (previously at Carnegie Mellon University) that is 4601 developing adaptive networking protocols and protocol interfaces to 4602 allow truly seamless wireless and mobile node networking [17, 33]. 4604 The authors would like to acknowledge the substantial contributions 4605 of Josh Broch in helping to design, simulate, and implement the DSR 4606 protocol. We thank him for his contributions to earlier versions of 4607 this document. 4609 We would also like to acknowledge the assistance of Robert V. Barron 4610 at Carnegie Mellon University. Bob ported our DSR implementation 4611 from FreeBSD 2.2.7 into FreeBSD 3.3. 4613 Many valuable suggestions came from participants in the IETF process. 4614 We would particularly like to acknowledge Fred Baker, who provided 4615 extensive feedback on a previous version of this document, as well as 4616 the working group chairs, for their suggestions of previous versions 4617 of the document. 4619 References 4621 [1] David F. Bantz and Frederic J. Bauchot. Wireless LAN Design 4622 Alternatives. IEEE Network, 8(2):43--53, March/April 1994. 4624 [2] Vaduvur Bharghavan, Alan Demers, Scott Shenker, and Lixia 4625 Zhang. MACAW: A Media Access Protocol for Wireless LAN's. In 4626 Proceedings of the ACM SIGCOMM '94 Conference, pages 212--225, 4627 August 1994. 4629 [3] Robert T. Braden, editor. Requirements for Internet 4630 Hosts---Communication Layers. RFC 1122, October 1989. 4632 [4] Scott Bradner. Key words for use in RFCs to Indicate 4633 Requirement Levels. RFC 2119, March 1997. 4635 [5] Josh Broch, David A. Maltz, David B. Johnson, Yih-Chun Hu, 4636 and Jorjeta Jetcheva. A Performance Comparison of Multi-Hop 4637 Wireless Ad Hoc Network Routing Protocols. In Proceedings of 4638 the Fourth Annual ACM/IEEE International Conference on Mobile 4639 Computing and Networking, pages 85--97, October 1998. 4641 [6] David D. Clark. The Design Philosophy of the DARPA Internet 4642 Protocols. In Proceedings of the ACM SIGCOMM '88 Conference, 4643 pages 106--114, August 1988. 4645 [7] Stephen E. Deering and Robert M. Hinden. Internet Protocol 4646 Version 6 (IPv6) Specification. RFC 2460, December 1998. 4648 [8] Ralph Droms. Dynamic Host Configuration Protocol. RFC 2131, 4649 March 1997. 4651 [9] The FreeBSD Project. Project web page available at 4652 http://www.freebsd.org/. 4654 [10] Yih-Chun Hu and David B. Johnson. Caching Strategies in 4655 On-Demand Routing Protocols for Wireless Ad Hoc Networks. In 4656 Proceedings of the Sixth Annual ACM International Conference on 4657 Mobile Computing and Networking, August 2000. 4659 [11] Yih-Chun Hu and David B. Johnson. Implicit Source Routing 4660 in On-Demand Ad Hoc Network Routing. In Proceedings of the 4661 Second Symposium on Mobile Ad Hoc Networking and Computing 4662 (MobiHoc 2001), pages 1--10, October 2001. 4664 [12] Yih-Chun Hu, Adrian Perrig, and David B. Johnson. Ariadne: 4665 A Secure On-Demand Routing Protocol for Ad Hoc Networks. In 4666 Proceedings of the Eighth Annual International Conference on 4667 Mobile Computing and Networking (MobiCom 2002), pages 12--23, 4668 September 2002. 4670 [13] IEEE Computer Society LAN MAN Standards Committee. Wireless 4671 LAN Medium Access Control (MAC) and Physical Layer (PHY) 4672 Specifications, IEEE Std 802.11-1997. The Institute of 4673 Electrical and Electronics Engineers, New York, New York, 1997. 4675 [14] Per Johansson, Tony Larsson, Nicklas Hedman, Bartosz Mielczarek, 4676 and Mikael Degermark. Scenario-based Performance Analysis of 4677 Routing Protocols for Mobile Ad-hoc Networks. In Proceedings 4678 of the Fifth Annual ACM/IEEE International Conference on Mobile 4679 Computing and Networking, pages 195--206, August 1999. 4681 [15] David B. Johnson. Routing in Ad Hoc Networks of Mobile Hosts. 4682 In Proceedings of the IEEE Workshop on Mobile Computing Systems 4683 and Applications, pages 158--163, December 1994. 4685 [16] David B. Johnson and David A. Maltz. Dynamic Source Routing in 4686 Ad Hoc Wireless Networks. In Mobile Computing, edited by Tomasz 4687 Imielinski and Hank Korth, chapter 5, pages 153--181. Kluwer 4688 Academic Publishers, 1996. 4690 [17] David B. Johnson and David A. Maltz. Protocols for Adaptive 4691 Wireless and Mobile Networking. IEEE Personal Communications, 4692 3(1):34--42, February 1996. 4694 [18] John Jubin and Janet D. Tornow. The DARPA Packet Radio Network 4695 Protocols. Proceedings of the IEEE, 75(1):21--32, January 1987. 4697 [19] Phil Karn. MACA---A New Channel Access Method for Packet Radio. 4698 In ARRL/CRRL Amateur Radio 9th Computer Networking Conference, 4699 pages 134--140, September 1990. 4701 [20] Gregory S. Lauer. Packet-Radio Routing. In Routing in 4702 Communications Networks, edited by Martha E. Steenstrup, 4703 chapter 11, pages 351--396. Prentice-Hall, Englewood Cliffs, 4704 New Jersey, 1995. 4706 [21] David A. Maltz, Josh Broch, Jorjeta Jetcheva, and David B. 4707 Johnson. The Effects of On-Demand Behavior in Routing Protocols 4708 for Multi-Hop Wireless Ad Hoc Networks. IEEE Journal on 4709 Selected Areas of Communications, 17(8):1439--1453, August 1999. 4711 [22] David A. Maltz, Josh Broch, and David B. Johnson. Experiences 4712 Designing and Building a Multi-Hop Wireless Ad Hoc Network 4713 Testbed. Technical Report CMU-CS-99-116, School of Computer 4714 Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, 4715 March 1999. 4717 [23] David A. Maltz, Josh Broch, and David B. Johnson. Quantitative 4718 Lessons From a Full-Scale Multi-Hop Wireless Ad Hoc Network 4719 Testbed. In Proceedings of the IEEE Wireless Communications and 4720 Networking Conference, September 2000. 4722 [24] David A. Maltz, Josh Broch, and David B. Johnson. Lessons From 4723 a Full-Scale MultiHop Wireless Ad Hoc Network Testbed. IEEE 4724 Personal Communications, 8(1):8--15, February 2001. 4726 [25] The Network Simulator -- ns-2. Project web page available at 4727 http://www.isi.edu/nsnam/ns/. 4729 [26] Panagiotis Papadimitratos and Zygmunt J. Haas. Secure Routing 4730 for Mobile Ad Hoc Networks. In SCS Communication Networks and 4731 Distributed Systems Modeling and Simulation Conference (CNDS 4732 2002), January 2002. 4734 [27] Radia Perlman. Interconnections: Bridges and Routers. 4735 Addison-Wesley, Reading, Massachusetts, 1992. 4737 [28] David C. Plummer. An Ethernet Address Resolution Protocol: 4738 Or Converting Network Protocol Addresses to 48.bit Ethernet 4739 Addresses for Transmission on Ethernet Hardware. RFC 826, 4740 November 1982. 4742 [29] J. B. Postel, editor. Internet Control Message Protocol. 4743 RFC 792, September 1981. 4745 [30] J. B. Postel, editor. Internet Protocol. RFC 791, September 4746 1981. 4748 [31] J. B. Postel, editor. Transmission Control Protocol. RFC 793, 4749 September 1981. 4751 [32] Joyce K. Reynolds and Jon Postel. Assigned Numbers. RFC 1700, 4752 October 1994. See also http://www.iana.org/numbers.html. 4754 [33] Rice University Monarch Project. Monarch Project Home Page. 4755 Available at http://www.monarch.cs.rice.edu/. 4757 [34] Alex Song. picoNet II: A Wireless Ad Hoc Network for Mobile 4758 Handheld Devices. Submitted for the degree of Bachelor of 4759 Engineering (Honours) in the division of Electrical Engineering, 4760 Department of Information Technology and Electrical Engineering, 4761 University of Queensland, Australia, October 2001. Available at 4762 http://student.uq.edu.au/~s369677/main.html. 4764 [35] Paul Turner. NetWare Communications Processes. NetWare 4765 Application Notes, Novell Research, pages 25--91, September 4766 1990. 4768 [36] Gary R. Wright and W. Richard Stevens. TCP/IP Illustrated, 4769 Volume 2: The Implementation. Addison-Wesley, Reading, 4770 Massachusetts, 1995. 4772 Chair's Address 4774 The MANET Working Group can be contacted via its current chairs: 4776 M. Scott Corson Phone: +1 908 947-7033 4777 Flarion Technologies, Inc. Email: corson@flarion.com 4778 Bedminster One 4779 135 Route 202/206 South 4780 Bedminster, NJ 07921 4781 USA 4783 Joseph Macker Phone: +1 202 767-2001 4784 Information Technology Division Email: macker@itd.nrl.navy.mil 4785 Naval Research Laboratory 4786 Washington, DC 20375 4787 USA 4789 Authors' Addresses 4791 Questions about this document can also be directed to the authors: 4793 David B. Johnson Phone: +1 713 348-3063 4794 Rice University Fax: +1 713 348-5930 4795 Computer Science Department, MS 132 Email: dbj@cs.rice.edu 4796 6100 Main Street 4797 Houston, TX 77005-1892 4798 USA 4800 David A. Maltz Phone: +1 412 268-5329 4801 Carnegie Mellon University Fax: +1 412 268-5576 4802 Computer Science Department Email: dmaltz@cs.cmu.edu 4803 5000 Forbes Avenue 4804 Pittsburgh, PA 15213 4805 USA 4807 Yih-Chun Hu Phone: +1 412 268-3075 4808 Rice University Fax: +1 412 268-5576 4809 Computer Science Department, MS 132 Email: yihchun@cs.cmu.edu 4810 6100 Main Street 4811 Houston, TX 77005-1892 4812 USA