1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
|
Network Working Group D. Johnson
Request for Comments: 4728 Rice University
Category: Experimental Y. Hu
UIUC
D. Maltz
Microsoft Research
February 2007
The Dynamic Source Routing Protocol (DSR)
for Mobile Ad Hoc Networks for IPv4
Status of This Memo
This memo defines an Experimental Protocol for the Internet
community. It does not specify an Internet standard of any kind.
Discussion and suggestions for improvement are requested.
Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The IETF Trust (2007).
Abstract
The Dynamic Source Routing protocol (DSR) is a simple and efficient
routing protocol designed specifically for use in multi-hop wireless
ad hoc networks of mobile nodes. DSR allows the network to be
completely self-organizing and self-configuring, without the need for
any existing network infrastructure or administration. The protocol
is composed of the two main mechanisms of "Route Discovery" and
"Route Maintenance", which work together to allow nodes to discover
and maintain routes to arbitrary destinations in the ad hoc network.
All aspects of the protocol operate entirely on demand, allowing the
routing packet overhead of DSR to scale automatically to only what is
needed to react to changes in the routes currently in use. The
protocol allows multiple routes to any destination and allows each
sender to select and control the routes used in routing its packets,
for example, for use in load balancing or for increased robustness.
Other advantages of the DSR protocol include easily guaranteed loop-
free routing, operation in networks containing unidirectional links,
use of only "soft state" in routing, and very rapid recovery when
routes in the network change. The DSR protocol is designed mainly
for mobile ad hoc networks of up to about two hundred nodes and is
designed to work well even with very high rates of mobility. This
document specifies the operation of the DSR protocol for routing
unicast IPv4 packets.
Johnson, et al. Experimental [Page 1]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Table of Contents
1. Introduction ....................................................5
2. Assumptions .....................................................7
3. DSR Protocol Overview ...........................................9
3.1. Basic DSR Route Discovery .................................10
3.2. Basic DSR Route Maintenance ...............................12
3.3. Additional Route Discovery Features .......................14
3.3.1. Caching Overheard Routing Information ..............14
3.3.2. Replying to Route Requests Using Cached Routes .....15
3.3.3. Route Request Hop Limits ...........................16
3.4. Additional Route Maintenance Features .....................17
3.4.1. Packet Salvaging ...................................17
3.4.2. Queued Packets Destined over a Broken Link .........18
3.4.3. Automatic Route Shortening .........................19
3.4.4. Increased Spreading of Route Error Messages ........20
3.5. Optional DSR Flow State Extension .........................20
3.5.1. Flow Establishment .................................21
3.5.2. Receiving and Forwarding Establishment Packets .....22
3.5.3. Sending Packets along Established Flows ............22
3.5.4. Receiving and Forwarding Packets Sent along
Established Flows ..................................23
3.5.5. Processing Route Errors ............................24
3.5.6. Interaction with Automatic Route Shortening ........24
3.5.7. Loop Detection .....................................25
3.5.8. Acknowledgement Destination ........................25
3.5.9. Crash Recovery .....................................25
3.5.10. Rate Limiting .....................................25
3.5.11. Interaction with Packet Salvaging .................26
4. Conceptual Data Structures .....................................26
4.1. Route Cache ...............................................26
4.2. Send Buffer ...............................................30
4.3. Route Request Table .......................................30
4.4. Gratuitous Route Reply Table ..............................31
4.5. Network Interface Queue and Maintenance Buffer ............32
4.6. Blacklist .................................................33
5. Additional Conceptual Data Structures for Flow State
Extension ......................................................34
5.1. Flow Table ................................................34
5.2. Automatic Route Shortening Table ..........................35
5.3. Default Flow ID Table .....................................36
6. DSR Options Header Format ......................................36
6.1. Fixed Portion of DSR Options Header .......................37
6.2. Route Request Option ......................................40
6.3. Route Reply Option ........................................42
Johnson, et al. Experimental [Page 2]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
6.4. Route Error Option ........................................44
6.4.1. Node Unreachable Type-Specific Information .........46
6.4.2. Flow State Not Supported Type-Specific
Information ........................................46
6.4.3. Option Not Supported Type-Specific Information .....46
6.5. Acknowledgement Request Option ............................46
6.6. Acknowledgement Option ....................................47
6.7. DSR Source Route Option ...................................48
6.8. Pad1 Option ...............................................50
6.9. PadN Option ...............................................50
7. Additional Header Formats and Options for Flow State
Extension ......................................................51
7.1. DSR Flow State Header .....................................52
7.2. New Options and Extensions in DSR Options Header ..........52
7.2.1. Timeout Option .....................................52
7.2.2. Destination and Flow ID Option .....................53
7.3. New Error Types for Route Error Option ....................54
7.3.1. Unknown Flow Type-Specific Information .............54
7.3.2. Default Flow Unknown Type-Specific Information .....55
7.4. New Acknowledgement Request Option Extension ..............55
7.4.1. Previous Hop Address Extension .....................55
8. Detailed Operation .............................................56
8.1. General Packet Processing .................................56
8.1.1. Originating a Packet ...............................56
8.1.2. Adding a DSR Options Header to a Packet ............57
8.1.3. Adding a DSR Source Route Option to a Packet .......57
8.1.4. Processing a Received Packet .......................58
8.1.5. Processing a Received DSR Source Route Option ......60
8.1.6. Handling an Unknown DSR Option .....................63
8.2. Route Discovery Processing ................................64
8.2.1. Originating a Route Request ........................65
8.2.2. Processing a Received Route Request Option .........66
8.2.3. Generating a Route Reply Using the Route Cache .....68
8.2.4. Originating a Route Reply ..........................71
8.2.5. Preventing Route Reply Storms ......................72
8.2.6. Processing a Received Route Reply Option ...........74
8.3. Route Maintenance Processing ..............................74
8.3.1. Using Link-Layer Acknowledgements ..................75
8.3.2. Using Passive Acknowledgements .....................76
8.3.3. Using Network-Layer Acknowledgements ...............77
8.3.4. Originating a Route Error ..........................80
8.3.5. Processing a Received Route Error Option ...........81
8.3.6. Salvaging a Packet .................................82
8.4. Multiple Network Interface Support ........................84
8.5. IP Fragmentation and Reassembly ...........................84
8.6. Flow State Processing .....................................85
8.6.1. Originating a Packet ...............................85
8.6.2. Inserting a DSR Flow State Header ..................88
Johnson, et al. Experimental [Page 3]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.6.3. Receiving a Packet .................................88
8.6.4. Forwarding a Packet Using Flow IDs .................93
8.6.5. Promiscuously Receiving a Packet ...................93
8.6.6. Operation Where the Layer below DSR
Decreases the IP TTL ...............................94
8.6.7. Salvage Interactions with DSR ......................94
9. Protocol Constants and Configuration Variables .................95
10. IANA Considerations ...........................................96
11. Security Considerations .......................................96
Appendix A. Link-MaxLife Cache Description ........................97
Appendix B. Location of DSR in the ISO Network Reference Model ....99
Appendix C. Implementation and Evaluation Status .................100
Acknowledgements .................................................101
Normative References .............................................102
Informative References ...........................................102
Johnson, et al. Experimental [Page 4]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
1. Introduction
The Dynamic Source Routing protocol (DSR) [JOHNSON94, JOHNSON96a] is
a simple and efficient routing protocol designed specifically for use
in multi-hop wireless ad hoc networks of mobile nodes. Using DSR,
the network is completely self-organizing and self-configuring,
requiring no existing network infrastructure or administration.
Network nodes cooperate to forward packets for each other to allow
communication over multiple "hops" between nodes not directly within
wireless transmission range of one another. As nodes in the network
move about or join or leave the network, and as wireless transmission
conditions such as sources of interference change, all routing is
automatically determined and maintained by the DSR routing protocol.
Since the number or sequence of intermediate hops needed to reach any
destination may change at any time, the resulting network topology
may be quite rich and rapidly changing.
In designing DSR, we sought to create a routing protocol that had
very low overhead yet was able to react very quickly to changes in
the network. The DSR protocol provides highly reactive service in
order to help ensure successful delivery of data packets in spite of
node movement or other changes in network conditions.
The DSR protocol is composed of two main mechanisms that work
together to allow the discovery and maintenance of source routes in
the ad hoc network:
- Route Discovery is the mechanism by which a node S wishing to send
a packet to a destination node D obtains a source route to D.
Route Discovery is used only when S attempts to send a packet to D
and does not already know a route to D.
- Route Maintenance is the mechanism by which node S is able to
detect, while using a source route to D, if the network topology
has changed such that it can no longer use its route to D because
a link along the route no longer works. When Route Maintenance
indicates a source route is broken, S can attempt to use any other
route it happens to know to D, or it can invoke Route Discovery
again to find a new route for subsequent packets to D. Route
Maintenance for this route is used only when S is actually sending
packets to D.
In DSR, Route Discovery and Route Maintenance each operate entirely
"on demand". In particular, unlike other protocols, DSR requires no
periodic packets of any kind at any layer within the network. For
example, DSR does not use any periodic routing advertisement, link
status sensing, or neighbor detection packets and does not rely on
these functions from any underlying protocols in the network. This
Johnson, et al. Experimental [Page 5]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
entirely on-demand behavior and lack of periodic activity allows the
number of overhead packets caused by DSR to scale all the way down to
zero, when all nodes are approximately stationary with respect to
each other and all routes needed for current communication have
already been discovered. As nodes begin to move more or as
communication patterns change, the routing packet overhead of DSR
automatically scales to only what is needed to track the routes
currently in use. Network topology changes not affecting routes
currently in use are ignored and do not cause reaction from the
protocol.
All state maintained by DSR is "soft state" [CLARK88], in that the
loss of any state will not interfere with the correct operation of
the protocol; all state is discovered as needed and can easily and
quickly be rediscovered if needed after a failure without significant
impact on the protocol. This use of only soft state allows the
routing protocol to be very robust to problems such as dropped or
delayed routing packets or node failures. In particular, a node in
DSR that fails and reboots can easily rejoin the network immediately
after rebooting; if the failed node was involved in forwarding
packets for other nodes as an intermediate hop along one or more
routes, it can also resume this forwarding quickly after rebooting,
with no or minimal interruption to the routing protocol.
In response to a single Route Discovery (as well as through routing
information from other packets overheard), a node may learn and cache
multiple routes to any destination. This support for multiple routes
allows the reaction to routing changes to be much more rapid, since a
node with multiple routes to a destination can try another cached
route if the one it has been using should fail. This caching of
multiple routes also avoids the overhead of needing to perform a new
Route Discovery each time a route in use breaks. The sender of a
packet selects and controls the route used for its own packets,
which, together with support for multiple routes, also allows
features such as load balancing to be defined. In addition, all
routes used are easily guaranteed to be loop-free, since the sender
can avoid duplicate hops in the routes selected.
The operation of both Route Discovery and Route Maintenance in DSR
are designed to allow unidirectional links and asymmetric routes to
be supported. In particular, as noted in Section 2, in wireless
networks, it is possible that a link between two nodes may not work
equally well in both directions, due to differing transmit power
levels or sources of interference.
It is possible to interface a DSR network with other networks,
external to this DSR network. Such external networks may, for
example, be the Internet or may be other ad hoc networks routed with
Johnson, et al. Experimental [Page 6]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
a routing protocol other than DSR. Such external networks may also
be other DSR networks that are treated as external networks in order
to improve scalability. The complete handling of such external
networks is beyond the scope of this document. However, this
document specifies a minimal set of requirements and features
necessary to allow nodes only implementing this specification to
interoperate correctly with nodes implementing interfaces to such
external networks.
This document specifies the operation of the DSR protocol for routing
unicast IPv4 packets in multi-hop wireless ad hoc networks.
Advanced, optional features, such as Quality of Service (QoS) support
and efficient multicast routing, and operation of DSR with IPv6
[RFC2460], will be covered in other documents. The specification of
DSR in this document provides a compatible base on which such
features can be added, either independently or by integration with
the DSR operation specified here. As described in Appendix C, the
design of DSR has been extensively studied through detailed
simulations and testbed implementation and demonstration; this
document encourages additional implementation and experimentation
with the protocol.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
2. Assumptions
As described here, the DSR protocol is designed mainly for mobile ad
hoc networks of up to about two hundred nodes and is designed to work
well even with very high rates of mobility. Other protocol features
and enhancements that may allow DSR to scale to larger networks are
outside the scope of this document.
We assume in this document that all nodes wishing to communicate with
other nodes within the ad hoc network are willing to participate
fully in the protocols of the network. In particular, each node
participating in the ad hoc network SHOULD also be willing to forward
packets for other nodes in the network.
The diameter of an ad hoc network is the minimum number of hops
necessary for a packet to reach from any node located at one extreme
edge of the ad hoc network to another node located at the opposite
extreme. We assume that this diameter will often be small (e.g.,
perhaps 5 or 10 hops), but it may often be greater than 1.
Johnson, et al. Experimental [Page 7]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Packets may be lost or corrupted in transmission on the wireless
network. We assume that a node receiving a corrupted packet can
detect the error, such as through a standard link-layer checksum or
Cyclic Redundancy Check (CRC), and discard the packet.
Nodes within the ad hoc network MAY move at any time without notice
and MAY even move continuously, but we assume that the speed with
which nodes move is moderate with respect to the packet transmission
latency and wireless transmission range of the particular underlying
network hardware in use. In particular, DSR can support very rapid
rates of arbitrary node mobility, but we assume that nodes do not
continuously move so rapidly as to make the flooding of every
individual data packet the only possible routing protocol.
A common feature of many network interfaces, including most current
LAN hardware for broadcast media such as wireless, is the ability to
operate the network interface in "promiscuous" receive mode. This
mode causes the hardware to deliver every received packet to the
network driver software without filtering based on link-layer
destination address. Although we do not require this facility, some
of our optimizations can take advantage of its availability. Use of
promiscuous mode does increase the software overhead on the CPU, but
we believe that wireless network speeds and capacity are more the
inherent limiting factors to performance in current and future
systems; we also believe that portions of the protocol are suitable
for implementation directly within a programmable network interface
unit to avoid this overhead on the CPU [JOHNSON96a]. Use of
promiscuous mode may also increase the power consumption of the
network interface hardware, depending on the design of the receiver
hardware, and in such cases, DSR can easily be used without the
optimizations that depend on promiscuous receive mode or can be
programmed to only periodically switch the interface into promiscuous
mode. Use of promiscuous receive mode is entirely optional.
Wireless communication ability between any pair of nodes may at times
not work equally well in both directions, due, for example, to
transmit power levels or sources of interference around the two nodes
[BANTZ94, LAUER95]. That is, wireless communications between each
pair of nodes will in many cases be able to operate bidirectionally,
but at times the wireless link between two nodes may be only
unidirectional, allowing one node to successfully send packets to the
other while no communication is possible in the reverse direction.
Some Medium Access Control (MAC) protocols, however, such as MACA
[KARN90], MACAW [BHARGHAVAN94], or IEEE 802.11 [IEEE80211], limit
unicast data packet transmission to bidirectional links, due to the
required bidirectional exchange of request to send (RTS) and clear to
send (CTS) packets in these protocols and to the link-layer
acknowledgement feature in IEEE 802.11. When used on top of MAC
Johnson, et al. Experimental [Page 8]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
protocols such as these, DSR can take advantage of additional
optimizations, such as the ability to reverse a source route to
obtain a route back to the origin of the original route.
The IP address used by a node using the DSR protocol MAY be assigned
by any mechanism (e.g., static assignment or use of Dynamic Host
Configuration Protocol (DHCP) for dynamic assignment [RFC2131]),
although the method of such assignment is outside the scope of this
specification.
A routing protocol such as DSR chooses a next-hop for each packet and
provides the IP address of that next-hop. When the packet is
transmitted, however, the lower-layer protocol often has a separate,
MAC-layer address for the next-hop node. DSR uses the Address
Resolution Protocol (ARP) [RFC826] to translate from next-hop IP
addresses to next-hop MAC addresses. In addition, a node MAY add an
entry to its ARP cache based on any received packet, when the IP
address and MAC address of the transmitting node are available in the
packet; for example, the IP address of the transmitting node is
present in a Route Request option (in the Address list being
accumulated) and any packets containing a source route. Adding
entries to the ARP cache in this way avoids the overhead of ARP in
most cases.
3. DSR Protocol Overview
This section provides an overview of the operation of the DSR
protocol. The basic version of DSR uses explicit "source routing",
in which each data packet sent carries in its header the complete,
ordered list of nodes through which the packet will pass. This use
of explicit source routing allows the sender to select and control
the routes used for its own packets, supports the use of multiple
routes to any destination (for example, for load balancing), and
allows a simple guarantee that the routes used are loop-free. By
including this source route in the header of each data packet, other
nodes forwarding or overhearing any of these packets can also easily
cache this routing information for future use. Section 3.1 describes
this basic operation of Route Discovery, Section 3.2 describes basic
Route Maintenance, and Sections 3.3 and 3.4 describe additional
features of these two parts of DSR's operation. Section 3.5 then
describes an optional, compatible extension to DSR, known as "flow
state", that allows the routing of most packets without an explicit
source route header in the packet, while the fundamental properties
of DSR's operation are preserved.
Johnson, et al. Experimental [Page 9]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
3.1. Basic DSR Route Discovery
When some source node originates a new packet addressed to some
destination node, the source node places in the header of the packet
a "source route" giving the sequence of hops that the packet is to
follow on its way to the destination. Normally, the sender will
obtain a suitable source route by searching its "Route Cache" of
routes previously learned; if no route is found in its cache, it will
initiate the Route Discovery protocol to dynamically find a new route
to this destination node. In this case, we call the source node the
"initiator" and the destination node the "target" of the Route
Discovery.
For example, suppose a node A is attempting to discover a route to
node E. The Route Discovery initiated by node A in this example
would proceed as follows:
^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D"
| id=2 | id=2 | id=2 | id=2
+-----+ +-----+ +-----+ +-----+ +-----+
| A |---->| B |---->| C |---->| D |---->| E |
+-----+ +-----+ +-----+ +-----+ +-----+
| | | |
v v v v
To initiate the Route Discovery, node A transmits a "Route Request"
as a single local broadcast packet, which is received by
(approximately) all nodes currently within wireless transmission
range of A, including node B in this example. Each Route Request
identifies the initiator and target of the Route Discovery, and also
contains a unique request identification (2, in this example),
determined by the initiator of the Request. Each Route Request also
contains a record listing the address of each intermediate node
through which this particular copy of the Route Request has been
forwarded. This route record is initialized to an empty list by the
initiator of the Route Discovery. In this example, the route record
initially lists only node A.
When another node receives this Route Request (such as node B in this
example), if it is the target of the Route Discovery, it returns a
"Route Reply" to the initiator of the Route Discovery, giving a copy
of the accumulated route record from the Route Request; when the
initiator receives this Route Reply, it caches this route in its
Route Cache for use in sending subsequent packets to this
destination.
Johnson, et al. Experimental [Page 10]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Otherwise, if this node receiving the Route Request has recently seen
another Route Request message from this initiator bearing this same
request identification and target address, or if this node's own
address is already listed in the route record in the Route Request,
this node discards the Request. (A node considers a Request recently
seen if it still has information about that Request in its Route
Request Table, which is described in Section 4.3.) Otherwise, this
node appends its own address to the route record in the Route Request
and propagates it by transmitting it as a local broadcast packet
(with the same request identification). In this example, node B
broadcast the Route Request, which is received by node C; nodes C and
D each also, in turn, broadcast the Request, resulting in receipt of
a copy of the Request by node E.
In returning the Route Reply to the initiator of the Route Discovery,
such as in this example, node E replying back to node A, node E will
typically examine its own Route Cache for a route back to A and, if
one is found, will use it for the source route for delivery of the
packet containing the Route Reply. Otherwise, E SHOULD perform its
own Route Discovery for target node A, but to avoid possible infinite
recursion of Route Discoveries, it MUST in this case piggyback this
Route Reply on the packet containing its own Route Request for A. It
is also possible to piggyback other small data packets, such as a TCP
SYN packet [RFC793], on a Route Request using this same mechanism.
Node E could instead simply reverse the sequence of hops in the route
record that it is trying to send in the Route Reply and use this as
the source route on the packet carrying the Route Reply itself. For
MAC protocols, such as IEEE 802.11, that require a bidirectional
frame exchange for unicast packets as part of the MAC protocol
[IEEE80211], the discovered source route MUST be reversed in this way
to return the Route Reply, since this route reversal tests the
discovered route to ensure that it is bidirectional before the Route
Discovery initiator begins using the route. This route reversal also
avoids the overhead of a possible second Route Discovery.
When initiating a Route Discovery, the sending node saves a copy of
the original packet (that triggered the discovery) in a local buffer
called the "Send Buffer". The Send Buffer contains a copy of each
packet that cannot be transmitted by this node because it does not
yet have a source route to the packet's destination. Each packet in
the Send Buffer is logically associated with the time that it was
placed into the Send Buffer and is discarded after residing in the
Send Buffer for some timeout period SendBufferTimeout; if necessary
for preventing the Send Buffer from overflowing, a FIFO or other
replacement strategy MAY also be used to evict packets even before
they expire.
Johnson, et al. Experimental [Page 11]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
While a packet remains in the Send Buffer, the node SHOULD
occasionally initiate a new Route Discovery for the packet's
destination address. However, the node MUST limit the rate at which
such new Route Discoveries for the same address are initiated (as
described in Section 4.3), since it is possible that the destination
node is not currently reachable. In particular, due to the limited
wireless transmission range and the movement of the nodes in the
network, the network may at times become partitioned, meaning that
there is currently no sequence of nodes through which a packet could
be forwarded to reach the destination. Depending on the movement
pattern and the density of nodes in the network, such network
partitions may be rare or common.
If a new Route Discovery was initiated for each packet sent by a node
in such a partitioned network, a large number of unproductive Route
Request packets would be propagated throughout the subset of the ad
hoc network reachable from this node. In order to reduce the
overhead from such Route Discoveries, a node SHOULD use an
exponential back-off algorithm to limit the rate at which it
initiates new Route Discoveries for the same target, doubling the
timeout between each successive discovery initiated for the same
target. If the node attempts to send additional data packets to this
same destination node more frequently than this limit, the subsequent
packets SHOULD be buffered in the Send Buffer until a Route Reply is
received giving a route to this destination, but the node MUST NOT
initiate a new Route Discovery until the minimum allowable interval
between new Route Discoveries for this target has been reached. This
limitation on the maximum rate of Route Discoveries for the same
target is similar to the mechanism required by Internet nodes to
limit the rate at which ARP Requests are sent for any single target
IP address [RFC1122].
3.2. Basic DSR Route Maintenance
When originating or forwarding a packet using a source route, each
node transmitting the packet is responsible for confirming that data
can flow over the link from that node to the next hop. For example,
in the situation shown below, node A has originated a packet for node
E using a source route through intermediate nodes B, C, and D:
+-----+ +-----+ +-----+ +-----+ +-----+
| A |---->| B |---->| C |-->? | D | | E |
+-----+ +-----+ +-----+ +-----+ +-----+
In this case, node A is responsible for the link from A to B, node B
is responsible for the link from B to C, node C is responsible for
the link from C to D, and node D is responsible for the link from D
to E.
Johnson, et al. Experimental [Page 12]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
An acknowledgement can provide confirmation that a link is capable of
carrying data, and in wireless networks, acknowledgements are often
provided at no cost, either as an existing standard part of the MAC
protocol in use (such as the link-layer acknowledgement frame defined
by IEEE 802.11 [IEEE80211]), or by a "passive acknowledgement"
[JUBIN87] (in which, for example, B confirms receipt at C by
overhearing C transmit the packet when forwarding it on to D).
If a built-in acknowledgement mechanism is not available, the node
transmitting the packet can explicitly request that a DSR-specific
software acknowledgement be returned by the next node along the
route; this software acknowledgement will normally be transmitted
directly to the sending node, but if the link between these two nodes
is unidirectional (Section 4.6), this software acknowledgement could
travel over a different, multi-hop path.
After an acknowledgement has been received from some neighbor, a node
MAY choose not to require acknowledgements from that neighbor for a
brief period of time, unless the network interface connecting a node
to that neighbor always receives an acknowledgement in response to
unicast traffic.
When a software acknowledgement is used, the acknowledgement request
SHOULD be retransmitted up to a maximum number of times. A
retransmission of the acknowledgement request can be sent as a
separate packet, piggybacked on a retransmission of the original data
packet, or piggybacked on any packet with the same next-hop
destination that does not also contain a software acknowledgement.
After the acknowledgement request has been retransmitted the maximum
number of times, if no acknowledgement has been received, then the
sender treats the link to this next-hop destination as currently
"broken". It SHOULD remove this link from its Route Cache and SHOULD
return a "Route Error" to each node that has sent a packet routed
over that link since an acknowledgement was last received. For
example, in the situation shown above, if C does not receive an
acknowledgement from D after some number of requests, it would return
a Route Error to A, as well as any other node that may have used the
link from C to D since C last received an acknowledgement from D.
Node A then removes this broken link from its cache; any
retransmission of the original packet can be performed by upper layer
protocols such as TCP, if necessary. For sending such a
retransmission or other packets to this same destination E, if A has
in its Route Cache another route to E (for example, from additional
Route Replies from its earlier Route Discovery, or from having
overheard sufficient routing information from other packets), it can
Johnson, et al. Experimental [Page 13]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
send the packet using the new route immediately. Otherwise, it
SHOULD perform a new Route Discovery for this target (subject to the
back-off described in Section 3.1).
3.3. Additional Route Discovery Features
3.3.1. Caching Overheard Routing Information
A node forwarding or otherwise overhearing any packet SHOULD add all
usable routing information from that packet to its own Route Cache.
The usefulness of routing information in a packet depends on the
directionality characteristics of the physical medium (Section 2), as
well as on the MAC protocol being used. Specifically, three distinct
cases are possible:
- Links in the network frequently are capable of operating only
unidirectionally (not bidirectionally), and the MAC protocol in
use in the network is capable of transmitting unicast packets over
unidirectional links.
- Links in the network occasionally are capable of operating only
unidirectionally (not bidirectionally), but this unidirectional
restriction on any link is not persistent; almost all links are
physically bidirectional, and the MAC protocol in use in the
network is capable of transmitting unicast packets over
unidirectional links.
- The MAC protocol in use in the network is not capable of
transmitting unicast packets over unidirectional links; only
bidirectional links can be used by the MAC protocol for
transmitting unicast packets. For example, the IEEE 802.11
Distributed Coordination Function (DCF) MAC protocol [IEEE80211]
is capable of transmitting a unicast packet only over a
bidirectional link, since the MAC protocol requires the return of
a link-level acknowledgement packet from the receiver and also
optionally requires the bidirectional exchange of an RTS and CTS
packet between the transmitter and receiver nodes.
In the first case above, for example, the source route used in a data
packet, the accumulated route record in a Route Request, or the route
being returned in a Route Reply SHOULD all be cached by any node in
the "forward" direction. Any node SHOULD cache this information from
any such packet received, whether the packet was addressed to this
node, sent to a broadcast (or multicast) MAC address, or overheard
while the node's network interface is in promiscuous mode. However,
the "reverse" direction of the links identified in such packet
headers SHOULD NOT be cached.
Johnson, et al. Experimental [Page 14]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
For example, in the situation shown below, node A is using a source
route to communicate with node E:
+-----+ +-----+ +-----+ +-----+ +-----+
| A |---->| B |---->| C |---->| D |---->| E |
+-----+ +-----+ +-----+ +-----+ +-----+
As node C forwards a data packet along the route from A to E, it
SHOULD add to its cache the presence of the "forward" direction links
that it learns from the headers of these packets, from itself to D
and from D to E. Node C SHOULD NOT, in this case, cache the
"reverse" direction of the links identified in these packet headers,
from itself back to B and from B to A, since these links might be
unidirectional.
In the second case above, in which links may occasionally operate
unidirectionally, the links described above SHOULD be cached in both
directions. Furthermore, in this case, if node X overhears (e.g.,
through promiscuous mode) a packet transmitted by node C that is
using a source route from node A to E, node X SHOULD cache all of
these links as well, also including the link from C to X over which
it overheard the packet.
In the final case, in which the MAC protocol requires physical
bidirectionality for unicast operation, links from a source route
SHOULD be cached in both directions, except when the packet also
contains a Route Reply, in which case only the links already
traversed in this source route SHOULD be cached. However, the links
not yet traversed in this route SHOULD NOT be cached.
3.3.2. Replying to Route Requests Using Cached Routes
A node receiving a Route Request for which it is not the target
searches its own Route Cache for a route to the target of the
Request. If it is found, the node generally returns a Route Reply to
the initiator itself rather than forward the Route Request. In the
Route Reply, this node sets the route record to list the sequence of
hops over which this copy of the Route Request was forwarded to it,
concatenated with the source route to this target obtained from its
own Route Cache.
However, before transmitting a Route Reply packet that was generated
using information from its Route Cache in this way, a node MUST
verify that the resulting route being returned in the Route Reply,
after this concatenation, contains no duplicate nodes listed in the
route record. For example, the figure below illustrates a case in
which a Route Request for target E has been received by node F, and
node F already has in its Route Cache a route from itself to E:
Johnson, et al. Experimental [Page 15]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
+-----+ +-----+ +-----+ +-----+
| A |---->| B |- >| D |---->| E |
+-----+ +-----+ \ / +-----+ +-----+
\ /
\ +-----+ /
>| C |-
+-----+
| ^
v |
Route Request +-----+
Route: A - B - C - F | F | Cache: C - D - E
+-----+
The concatenation of the accumulated route record from the Route
Request and the cached route from F's Route Cache would include a
duplicate node in passing from C to F and back to C.
Node F in this case could attempt to edit the route to eliminate the
duplication, resulting in a route from A to B to C to D and on to E,
but in this case, node F would not be on the route that it returned
in its own Route Reply. DSR Route Discovery prohibits node F from
returning such a Route Reply from its cache; this prohibition
increases the probability that the resulting route is valid, since
node F in this case should have received a Route Error if the route
had previously stopped working. Furthermore, this prohibition means
that a future Route Error traversing the route is very likely to pass
through any node that sent the Route Reply for the route (including
node F), which helps to ensure that stale data is removed from caches
(such as at F) in a timely manner; otherwise, the next Route
Discovery initiated by A might also be contaminated by a Route Reply
from F containing the same stale route. If, due to this restriction
on returning a Route Reply based on information from its Route Cache,
node F does not return such a Route Reply, it propagates the Route
Request normally.
3.3.3. Route Request Hop Limits
Each Route Request message contains a "hop limit" that may be used to
limit the number of intermediate nodes allowed to forward that copy
of the Route Request. This hop limit is implemented using the Time-
to-Live (TTL) field in the IP header of the packet carrying the Route
Request. As the Request is forwarded, this limit is decremented, and
the Request packet is discarded if the limit reaches zero before
finding the target. This Route Request hop limit can be used to
implement a variety of algorithms for controlling the spread of a
Route Request during a Route Discovery attempt.
Johnson, et al. Experimental [Page 16]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
For example, a node MAY use this hop limit to implement a "non-
propagating" Route Request as an initial phase of a Route Discovery.
A node using this technique sends its first Route Request attempt for
some target node using a hop limit of 1, such that any node receiving
the initial transmission of the Route Request will not forward the
Request to other nodes by re-broadcasting it. This form of Route
Request is called a "non-propagating" Route Request; it provides an
inexpensive method for determining if the target is currently a
neighbor of the initiator or if a neighbor node has a route to the
target cached (effectively using the neighbors' Route Caches as an
extension of the initiator's own Route Cache). If no Route Reply is
received after a short timeout, then the node sends a "propagating"
Route Request for the target node (i.e., with hop limit as defined by
the value of the DiscoveryHopLimit configuration variable).
As another example, a node MAY use this hop limit to implement an
"expanding ring" search for the target [JOHNSON96a]. A node using
this technique sends an initial non-propagating Route Request as
described above; if no Route Reply is received for it, the node
originates another Route Request with a hop limit of 2. For each
Route Request originated, if no Route Reply is received for it, the
node doubles the hop limit used on the previous attempt, to
progressively explore for the target node without allowing the Route
Request to propagate over the entire network. However, this
expanding ring search approach could increase the average latency of
Route Discovery, since multiple Discovery attempts and timeouts may
be needed before discovering a route to the target node.
3.4. Additional Route Maintenance Features
3.4.1. Packet Salvaging
When an intermediate node forwarding a packet detects through Route
Maintenance that the next hop along the route for that packet is
broken, if the node has another route to the packet's destination in
its Route Cache, the node SHOULD "salvage" the packet rather than
discard it. To salvage a packet, the node replaces the original
source route on the packet with a route from its Route Cache. The
node then forwards the packet to the next node indicated along this
source route. For example, in the situation shown in the example of
Section 3.2, if node C has another route cached to node E, it can
salvage the packet by replacing the original route in the packet with
this new route from its own Route Cache rather than discarding the
packet.
When salvaging a packet, a count is maintained in the packet of the
number of times that it has been salvaged, to prevent a single packet
from being salvaged endlessly. Otherwise, since the TTL is
Johnson, et al. Experimental [Page 17]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
decremented only once by each node, a single node could salvage a
packet an unbounded number of times. Even if we chose to require the
TTL to be decremented on each salvage attempt, packet salvaging is an
expensive operation, so it is desirable to bound the maximum number
of times a packet can be salvaged independently of the maximum number
of hops a packet can traverse.
As described in Section 3.2, an intermediate node, such as in this
case, that detects through Route Maintenance that the next hop along
the route for a packet that it is forwarding is broken, the node also
SHOULD return a Route Error to the original sender of the packet,
identifying the link over which the packet could not be forwarded.
If the node sends this Route Error, it SHOULD originate the Route
Error before salvaging the packet.
3.4.2. Queued Packets Destined over a Broken Link
When an intermediate node forwarding a packet detects through Route
Maintenance that the next-hop link along the route for that packet is
broken, in addition to handling that packet as defined for Route
Maintenance, the node SHOULD also handle in a similar way any pending
packets that it has queued that are destined over this new broken
link. Specifically, the node SHOULD search its Network Interface
Queue and Maintenance Buffer (Section 4.5) for packets for which the
next-hop link is this new broken link. For each such packet
currently queued at this node, the node SHOULD process that packet as
follows:
- Remove the packet from the node's Network Interface Queue and
Maintenance Buffer.
- Originate a Route Error for this packet to the original sender of
the packet, using the procedure described in Section 8.3.4, as if
the node had already reached the maximum number of retransmission
attempts for that packet for Route Maintenance. However, in
sending such Route Errors for queued packets in response to
detection of a single, new broken link, the node SHOULD send no
more than one Route Error to each original sender of any of these
packets.
- If the node has another route to the packet's IP Destination
Address in its Route Cache, the node SHOULD salvage the packet as
described in Section 8.3.6. Otherwise, the node SHOULD discard
the packet.
Johnson, et al. Experimental [Page 18]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
3.4.3. Automatic Route Shortening
Source routes in use MAY be automatically shortened if one or more
intermediate nodes in the route become no longer necessary. This
mechanism of automatically shortening routes in use is somewhat
similar to the use of passive acknowledgements [JUBIN87]. In
particular, if a node is able to overhear a packet carrying a source
route (e.g., by operating its network interface in promiscuous
receive mode), then this node examines the unexpended portion of that
source route. If this node is not the intended next-hop destination
for the packet but is named in the later unexpended portion of the
packet's source route, then it can infer that the intermediate nodes
before itself in the source route are no longer needed in the route.
For example, the figure below illustrates an example in which node D
has overheard a data packet being transmitted from B to C, for later
forwarding to D and to E:
+-----+ +-----+ +-----+ +-----+ +-----+
| A |---->| B |---->| C | | D | | E |
+-----+ +-----+ +-----+ +-----+ +-----+
\ ^
\ /
---------------------
In this case, this node (node D) SHOULD return a "gratuitous" Route
Reply to the original sender of the packet (node A). The Route Reply
gives the shorter route as the concatenation of the portion of the
original source route up through the node that transmitted the
overheard packet (node B), plus the suffix of the original source
route beginning with the node returning the gratuitous Route Reply
(node D). In this example, the route returned in the gratuitous
Route Reply message sent from D to A gives the new route as the
sequence of hops from A to B to D to E.
When deciding whether to return a gratuitous Route Reply in this way,
a node MAY factor in additional information beyond the fact that it
was able to overhear the packet. For example, the node MAY decide to
return the gratuitous Route Reply only when the overheard packet is
received with a signal strength or signal-to-noise ratio above some
specific threshold. In addition, each node maintains a Gratuitous
Route Reply Table, as described in Section 4.4, to limit the rate at
which it originates gratuitous Route Replies for the same returned
route.
Johnson, et al. Experimental [Page 19]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
3.4.4. Increased Spreading of Route Error Messages
When a source node receives a Route Error for a data packet that it
originated, this source node propagates this Route Error to its
neighbors by piggybacking it on its next Route Request. In this way,
stale information in the caches of nodes around this source node will
not generate Route Replies that contain the same invalid link for
which this source node received the Route Error.
For example, in the situation shown in the example of Section 3.2,
node A learns from the Route Error message from C that the link from
C to D is currently broken. It thus removes this link from its own
Route Cache and initiates a new Route Discovery (if it has no other
route to E in its Route Cache). On the Route Request packet
initiating this Route Discovery, node A piggybacks a copy of this
Route Error, ensuring that the Route Error spreads well to other
nodes, and guaranteeing that any Route Reply that it receives
(including those from other node's Route Caches) in response to this
Route Request does not contain a route that assumes the existence of
this broken link.
3.5. Optional DSR Flow State Extension
This section describes an optional, compatible extension to the DSR
protocol, known as "flow state", that allows the routing of most
packets without an explicit source route header in the packet. The
DSR flow state extension further reduces the overhead of the protocol
yet still preserves the fundamental properties of DSR's operation.
Once a sending node has discovered a source route such as through
DSR's Route Discovery mechanism, the flow state mechanism allows the
sending node to establish hop-by-hop forwarding state within the
network, based on this source route, to enable each node along the
route to forward the packet to the next hop based on the node's own
local knowledge of the flow along which this packet is being routed.
Flow state is dynamically initialized by the first packet using a
source route and is then able to route subsequent packets along the
same flow without use of a source route header in the packet. The
state established at each hop along a flow is "soft state" and thus
automatically expires when no longer needed and can be quickly
recreated as necessary. Extending DSR's basic operation based on an
explicit source route in the header of each packet routed, the flow
state extension operates as a form of "implicit source routing" by
preserving DSR's basic operation but removing the explicit source
route from packets.
Johnson, et al. Experimental [Page 20]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
3.5.1. Flow Establishment
A source node sending packets to some destination node MAY use the
DSR flow state extension described here to establish a route to that
destination as a flow. A "flow" is a route from the source to the
destination represented by hop-by-hop forwarding state within the
nodes along the route. Each flow is uniquely identified by a
combination of the source node address, the destination node address,
and a flow identifier (flow ID) chosen by the source node.
Each flow ID is a 16-bit unsigned integer. Comparison between
different flow IDs MUST be performed modulo 2**16. For example,
using an implementation in the C programming language, a flow ID
value (a) is greater than another flow ID value (b) if
((short)((a) - (b)) > 0), if a C language "short" data type is
implemented as a 16-bit signed integer.
A DSR Flow State header in a packet identifies the flow ID to be
followed in forwarding that packet. From a given source to some
destination, any number of different flows MAY exist and be in use,
for example, following different sequences of hops to reach the
destination. One of these flows MAY be considered the "default" flow
from that source to that destination. If a node receives a packet
with neither a DSR Options header specifying the route to be taken
(with a Source Route option in the DSR Options header) nor a DSR Flow
State header specifying the flow ID to be followed, it is forwarded
along the default flow for the source and destination addresses
specified in the packet's IP header.
In establishing a new flow, the source node generates a nonzero
16-bit flow ID greater than any unexpired flow IDs for this (source,
destination) pair. If the source wishes for this flow to become the
default flow, the low bit of the flow ID MUST be set (the flow ID is
an odd number); otherwise, the low bit MUST NOT be set (the flow ID
is an even number).
The source node establishing the new flow then transmits a packet
containing a DSR Options header with a Source Route option. To
establish the flow, the source node also MUST include in the packet a
DSR Flow State header, with the Flow ID field set to the chosen flow
ID for the new flow, and MUST include a Timeout option in the DSR
Options header, giving the lifetime after which state information
about this flow is to expire. This packet will generally be a normal
data packet being sent from this sender to the destination (for
example, the first packet sent after discovering the new route) but
is also treated as a "flow establishment" packet.
Johnson, et al. Experimental [Page 21]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
The source node records this flow in its Flow Table for future use,
setting the TTL in this Flow Table entry to the value used in the TTL
field in the packet's IP header and setting the Lifetime in this
entry to the lifetime specified in the Timeout option in the DSR
Options header. The TTL field is used for Default Flow Forwarding,
as described in Sections 3.5.3 and 3.5.4.
Any further packets sent with this flow ID before the timeout that
also contain a DSR Options header with a Source Route option MUST use
this same source route in the Source Route option.
3.5.2. Receiving and Forwarding Establishment Packets
Packets intended to establish a flow, as described in Section 3.5.1,
contain a DSR Options header with a Source Route option and are
forwarded along the indicated route. A node implementing the DSR
flow state extension, when receiving and forwarding such a DSR
packet, also keeps some state in its own Flow Table to enable it to
forward future packets that are sent along this flow with only the
flow ID specified. Specifically, if the packet also contains a DSR
Flow State header, this packet SHOULD cause an entry to be
established for this flow in the Flow Table of each node along the
packet's route.
The Hop Count field of the DSR Flow State header is also stored in
the Flow Table, as is the lifetime specified in the Timeout option
specified in the DSR Options header.
If the Flow ID is odd and there is no flow in the Flow Table with
Flow ID greater than the received Flow ID, set the default Flow ID
for this (IP Source Address, IP Destination Address) pair to the
received Flow ID, and the TTL of the packet is recorded.
The Flow ID option is removed before final delivery of the packet.
3.5.3. Sending Packets along Established Flows
When a flow is established as described in Section 3.5.1, a packet is
sent that establishes state in each node along the route. This state
is soft; that is, the protocol contains mechanisms for recovering
from the loss of this state. However, the use of these mechanisms
may result in reduced performance for packets sent along flows with
forgotten state. As a result, it is desirable to differentiate
behavior based on whether or not the sender is reasonably certain
that the flow state exists on each node along the route. We define a
flow's state to be "established end-to-end" if the Flow Tables of all
nodes on the route contains forwarding information for that flow.
While it is impossible to detect whether or not a flow's state has
Johnson, et al. Experimental [Page 22]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
been established end-to-end without sending packets, implementations
may make reasonable assumptions about the retention of flow state and
the probability that an establishment packet has been seen by all
nodes on the route.
A source wishing to send a packet along an established flow
determines if the flow state has been established end-to-end. If it
has not, a DSR Options header with Source Route option with this
flow's route is added to the packet. The source SHOULD set the Flow
ID field of the DSR Flow State header either to the flow ID
previously associated with this flow's route or to zero. If it sets
the Flow ID field to any other value, it MUST follow the processing
steps in Section 3.5.1 for establishing a new flow ID. If it sets
the Flow ID field to a nonzero value, it MUST include a Timeout
option with a value not greater than the timeout remaining in the
node's Flow Table, and if its TTL is not equal to that specified in
the Flow Table, the flow MUST NOT be used as a default flow in the
future.
Once flow state has been established end-to-end for non-default
flows, a source adds a DSR Flow State header to each packet it wishes
to send along that flow, setting the Flow ID field to the flow ID of
that flow. A Source Route option SHOULD NOT be added to the packet,
though if one is, then the steps for processing flows that have not
been established end-to-end MUST be followed.
Once flow state has been established end-to-end for default flows,
sources sending packets with IP TTL equal to the TTL value in the
local Flow Table entry for this flow then transmit the packet to the
next hop. In this case, a DSR Flow State header SHOULD NOT be added
to the packet and a DSR Options header likewise SHOULD NOT be added
to the packet; though if one is, the steps for sending packets along
non-default flows MUST be followed. If the IP TTL is not equal to
the TTL value in the local Flow Table, then the steps for processing
a non-default flow MUST be followed.
3.5.4. Receiving and Forwarding Packets Sent along Established Flows
The handling of packets containing a DSR Options header with both a
nonzero Flow ID and a Source Route option is described in Section
3.5.2. The Flow ID is ignored when it is equal to zero. This
section only describes handling of packets without a Source Route
option.
If a node receives a packet with a Flow ID in the DSR Options header
that indicates an unexpired flow in the node's Flow Table, it
increments the Hop Count in the DSR Options header and forwards the
packet to the next hop indicated in the Flow Table.
Johnson, et al. Experimental [Page 23]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
If a node receives a packet with a Flow ID that indicates a flow not
currently in the node's Flow Table, it returns a Route Error of type
UNKNOWN_FLOW with Error Destination and IP Destination addresses
copied from the IP Source of the packet triggering the error. This
error packet SHOULD be MAC-destined to the node from which the packet
was received; if it cannot confirm reachability of the previous node
using Route Maintenance, it MUST send the error as described in
Section 8.1.1. The node sending the error SHOULD attempt to salvage
the packet triggering the Route Error. If it does salvage the
packet, it MUST zero the Flow ID in the packet.
If a node receives a packet with no DSR Options header and no DSR
Flow State header, it checks the Default Flow Table. If there is a
matching entry, it forwards to the next hop indicated in the Flow
Table for the default flow. Otherwise, it returns a Route Error of
type DEFAULT_FLOW_UNKNOWN with Error Destination and IP Destination
addresses copied from the IP Source Address of the packet triggering
the error. This error packet SHOULD be MAC-destined to the node from
which it was received; if this node cannot confirm reachability of
the previous node using Route Maintenance, it MUST send the error as
described in Section 8.1.1. The node sending the error SHOULD
attempt to salvage the packet triggering the Route Error. If it does
salvage the packet, it MUST zero the Flow ID in the packet.
3.5.5. Processing Route Errors
When a node receives a Route Error of type UNKNOWN_FLOW, it marks the
flow to indicate that it has not been established end-to-end. When a
node receives a Route Error of type DEFAULT_FLOW_UNKNOWN, it marks
the default flow to indicate that it has not been established end-
to-end.
3.5.6. Interaction with Automatic Route Shortening
Because a full source route is not carried in every packet, an
alternative method for performing automatic route shortening is
necessary for packets using the flow state extension. Instead, nodes
promiscuously listen to packets, and if a node receives a packet with
(IP Source, IP Destination, Flow ID) found in the Flow Table but the
MAC-layer (next hop) destination address of the packet is not this
node, the node determines whether the packet was sent by an upstream
or downstream node by examining the Hop Count field in the DSR Flow
State header. If the Hop Count field is less than the expected Hop
Count at this node (that is, the expected Hop Count field in the Flow
Table described in Section 5.1), the node assumes that the packet was
sent by an upstream node and adds an entry for the packet to its
Automatic Route Shortening Table, possibly evicting an earlier entry
added to this table. When the packet is then sent to that node for
Johnson, et al. Experimental [Page 24]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
forwarding, the node finds that it has previously received the packet
by checking its Automatic Route Shortening Table and returns a
gratuitous Route Reply to the source of the packet.
3.5.7. Loop Detection
If a node receives a packet for forwarding with TTL lower than
expected and default flow forwarding is being used, it sends a Route
Error of type DEFAULT_FLOW_UNKNOWN back to the IP source. It can
attempt delivery of the packet by normal salvaging (subject to
constraints described in Section 8.6.7).
3.5.8. Acknowledgement Destination
In packets sent using Flow State, the previous hop is not necessarily
known. In order to allow nodes that have lost flow state to
determine the previous hop, the address of the previous hop can
optionally be stored in the Acknowledgement Request. This extension
SHOULD NOT be used when a Source Route option is present, MAY be used
when flow state routing is used without a Source Route option, and
SHOULD be used before Route Maintenance determines that the next-hop
destination is unreachable.
3.5.9. Crash Recovery
Each node has a maximum Timeout value that it can possibly generate.
This can be based on the largest number that can be set in a timeout
option (2**16 - 1 seconds) or may be less than this, set in system
software. When a node crashes, it does not establish new flows for a
period equal to this maximum Timeout value, in order to avoid
colliding with its old Flow IDs.
3.5.10. Rate Limiting
Flow IDs can be assigned with a counter. More specifically, the
"Current Flow ID" is kept. When a new default Flow ID needs to be
assigned, if the Current Flow ID is odd, the Current Flow ID is
assigned as the Flow ID and the Current Flow ID is incremented by
one; if the Current Flow ID is even, one plus the Current Flow ID is
assigned as the Flow ID and the Current Flow ID is incremented by
two.
If Flow IDs are assigned in this way, one algorithm for avoiding
duplicate, unexpired Flow IDs is to rate limit new Flow IDs to an
average rate of n assignments per second, where n is 2**15 divided by
the maximum Timeout value. This can be averaged over any period not
exceeding the maximum Timeout value.
Johnson, et al. Experimental [Page 25]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
3.5.11. Interaction with Packet Salvaging
Salvaging is modified to zero the Flow ID field in the packet. Also,
anytime this document refers to the Salvage field in the Source Route
option in a DSR Options header, packets without a Source Route option
are considered to have the value zero in the Salvage field.
4. Conceptual Data Structures
This document describes the operation of the DSR protocol in terms of
a number of conceptual data structures. This section describes each
of these data structures and provides an overview of its use in the
protocol. In an implementation of the protocol, these data
structures MUST be implemented in a manner consistent with the
external behavior described in this document, but the choice of
implementation used is otherwise unconstrained. Additional
conceptual data structures are required for the optional flow state
extensions to DSR; these data structures are described in Section 5.
4.1. Route Cache
Each node implementing DSR MUST maintain a Route Cache, containing
routing information needed by the node. A node adds information to
its Route Cache as it learns of new links between nodes in the ad hoc
network; for example, a node may learn of new links when it receives
a packet carrying a Route Request, Route Reply, or DSR source route.
Likewise, a node removes information from its Route Cache as it
learns that existing links in the ad hoc network have broken. For
example, a node may learn of a broken link when it receives a packet
carrying a Route Error or through the link-layer retransmission
mechanism reporting a failure in forwarding a packet to its next-hop
destination.
Anytime a node adds new information to its Route Cache, the node
SHOULD check each packet in its own Send Buffer (Section 4.2) to
determine whether a route to that packet's IP Destination Address now
exists in the node's Route Cache (including the information just
added to the Cache). If so, the packet SHOULD then be sent using
that route and removed from the Send Buffer.
It is possible to interface a DSR network with other networks,
external to this DSR network. Such external networks may, for
example, be the Internet or may be other ad hoc networks routed with
a routing protocol other than DSR. Such external networks may also
be other DSR networks that are treated as external networks in order
to improve scalability. The complete handling of such external
networks is beyond the scope of this document. However, this
document specifies a minimal set of requirements and features
Johnson, et al. Experimental [Page 26]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
necessary to allow nodes only implementing this specification to
interoperate correctly with nodes implementing interfaces to such
external networks. This minimal set of requirements and features
involve the First Hop External (F) and Last Hop External (L) bits in
a DSR Source Route option (Section 6.7) and a Route Reply option
(Section 6.3) in a packet's DSR Options header (Section 6). These
requirements also include the addition of an External flag bit
tagging each link in the Route Cache, copied from the First Hop
External (F) and Last Hop External (L) bits in the DSR Source Route
option or Route Reply option from which this link was learned.
The Route Cache SHOULD support storing more than one route to each
destination. In searching the Route Cache for a route to some
destination node, the Route Cache is searched by destination node
address. The following properties describe this searching function
on a Route Cache:
- Each implementation of DSR at any node MAY choose any appropriate
strategy and algorithm for searching its Route Cache and selecting
a "best" route to the destination from among those found. For
example, a node MAY choose to select the shortest route to the
destination (the shortest sequence of hops), or it MAY use an
alternate metric to select the route from the Cache.
- However, if there are multiple cached routes to a destination, the
selection of routes when searching the Route Cache SHOULD prefer
routes that do not have the External flag set on any link. This
preference will select routes that lead directly to the target
node over routes that attempt to reach the target via any external
networks connected to the DSR ad hoc network.
- In addition, any route selected when searching the Route Cache
MUST NOT have the External bit set for any links other than
possibly the first link, the last link, or both; the External bit
MUST NOT be set for any intermediate hops in the route selected.
An implementation of a Route Cache MAY provide a fixed capacity for
the cache, or the cache size MAY be variable. The following
properties describe the management of available space within a node's
Route Cache:
- Each implementation of DSR at each node MAY choose any appropriate
policy for managing the entries in its Route Cache, such as when
limited cache capacity requires a choice of which entries to
retain in the Cache. For example, a node MAY chose a "least
recently used" (LRU) cache replacement policy, in which the entry
Johnson, et al. Experimental [Page 27]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
last used longest ago is discarded from the cache if a decision
needs to be made to allow space in the cache for some new entry
being added.
- However, the Route Cache replacement policy SHOULD allow routes to
be categorized based upon "preference", where routes with a higher
preferences are less likely to be removed from the cache. For
example, a node could prefer routes for which it initiated a Route
Discovery over routes that it learned as the result of promiscuous
snooping on other packets. In particular, a node SHOULD prefer
routes that it is presently using over those that it is not.
Any suitable data structure organization, consistent with this
specification, MAY be used to implement the Route Cache in any node.
For example, the following two types of organization are possible:
- In DSR, the route returned in each Route Reply that is received by
the initiator of a Route Discovery (or that is learned from the
header of overhead packets, as described in Section 8.1.4)
represents a complete path (a sequence of links) leading to the
destination node. By caching each of these paths separately, a
"path cache" organization for the Route Cache can be formed. A
path cache is very simple to implement and easily guarantees that
all routes are loop-free, since each individual route from a Route
Reply or Route Request or used in a packet is loop-free. To
search for a route in a path cache data structure, the sending
node can simply search its Route Cache for any path (or prefix of
a path) that leads to the intended destination node.
This type of organization for the Route Cache in DSR has been
extensively studied through simulation [BROCH98, HU00,
JOHANSSON99, MALTZ99a] and through implementation of DSR in a
mobile outdoor testbed under significant workload [MALTZ99b,
MALTZ00, MALTZ01].
- Alternatively, a "link cache" organization could be used for the
Route Cache, in which each individual link (hop) in the routes
returned in Route Reply packets (or otherwise learned from the
header of overhead packets) is added to a unified graph data
structure of this node's current view of the network topology. To
search for a route in link cache, the sending node must use a more
complex graph search algorithm, such as the well-known Dijkstra's
shortest-path algorithm, to find the current best path through the
graph to the destination node. Such an algorithm is more
difficult to implement and may require significantly more CPU time
to execute.
Johnson, et al. Experimental [Page 28]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
However, a link cache organization is more powerful than a path
cache organization, in its ability to effectively utilize all of
the potential information that a node might learn about the state
of the network. In particular, links learned from different Route
Discoveries or from the header of any overheard packets can be
merged together to form new routes in the network, but this is not
possible in a path cache due to the separation of each individual
path in the cache.
This type of organization for the Route Cache in DSR, including
the effect of a range of implementation choices, has been studied
through detailed simulation [HU00].
The choice of data structure organization to use for the Route Cache
in any DSR implementation is a local matter for each node and affects
only performance; any reasonable choice of organization for the Route
Cache does not affect either correctness or interoperability.
Each entry in the Route Cache SHOULD have a timeout associated with
it, to allow that entry to be deleted if not used within some time.
The particular choice of algorithm and data structure used to
implement the Route Cache SHOULD be considered in choosing the
timeout for entries in the Route Cache. The configuration variable
RouteCacheTimeout defined in Section 9 specifies the timeout to be
applied to entries in the Route Cache, although it is also possible
to instead use an adaptive policy in choosing timeout values rather
than using a single timeout setting for all entries. For example,
the Link-MaxLife cache design (below) uses an adaptive timeout
algorithm and does not use the RouteCacheTimeout configuration
variable.
As guidance to implementers, Appendix A describes a type of link
cache known as "Link-MaxLife" that has been shown to outperform other
types of link caches and path caches studied in detailed simulation
[HU00]. Link-MaxLife is an adaptive link cache in which each link in
the cache has a timeout that is determined dynamically by the caching
node according to its observed past behavior of the two nodes at the
ends of the link. In addition, when selecting a route for a packet
being sent to some destination, among cached routes of equal length
(number of hops) to that destination, Link-MaxLife selects the route
with the longest expected lifetime (highest minimum timeout of any
link in the route). Use of the Link-MaxLife design for the Route
Cache is recommended in implementations of DSR.
Johnson, et al. Experimental [Page 29]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
4.2. Send Buffer
The Send Buffer of a node implementing DSR is a queue of packets that
cannot be sent by that node because it does not yet have a source
route to each such packet's destination. Each packet in the Send
Buffer is logically associated with the time that it was placed into
the buffer and SHOULD be removed from the Send Buffer and silently
discarded after a period of SendBufferTimeout after initially being
placed in the buffer. If necessary, a FIFO strategy SHOULD be used
to evict packets before they time out to prevent the buffer from
overflowing.
Subject to the rate limiting defined in Section 4.3, a Route
Discovery SHOULD be initiated as often as allowed for the destination
address of any packets residing in the Send Buffer.
4.3. Route Request Table
The Route Request Table of a node implementing DSR records
information about Route Requests that have been recently originated
or forwarded by this node. The table is indexed by IP address.
The Route Request Table on a node records the following information
about nodes to which this node has initiated a Route Request:
- The Time-to-Live (TTL) field used in the IP header of the Route
Request for the last Route Discovery initiated by this node for
that target node. This value allows the node to implement a
variety of algorithms for controlling the spread of its Route
Request on each Route Discovery initiated for a target. As
examples, two possible algorithms for this use of the TTL field
are described in Section 3.3.3.
- The time that this node last originated a Route Request for that
target node.
- The number of consecutive Route Discoveries initiated for this
target since receiving a valid Route Reply giving a route to that
target node.
- The remaining amount of time before which this node MAY next
attempt at a Route Discovery for that target node. When the node
initiates a new Route Discovery for this target node, this field
in the Route Request Table entry for that target node is
initialized to the timeout for that Route Discovery, after which
the node MAY initiate a new Discovery for that target. Until a
valid Route Reply is received for this target node address, a node
MUST implement a back-off algorithm in determining this timeout
Johnson, et al. Experimental [Page 30]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
value for each successive Route Discovery initiated for this
target using the same Time-to-Live (TTL) value in the IP header of
the Route Request packet. The timeout between such consecutive
Route Discovery initiations SHOULD increase by doubling the
timeout value on each new initiation.
In addition, the Route Request Table on a node also records the
following information about initiator nodes from which this node has
received a Route Request:
- A FIFO cache of size RequestTableIds entries containing the
Identification value and target address from the most recent Route
Requests received by this node from that initiator node.
Nodes SHOULD use an LRU policy to manage the entries in their Route
Request Table.
The number of Identification values to retain in each Route Request
Table entry, RequestTableIds, MUST NOT be unlimited, since, in the
worst case, when a node crashes and reboots, the first
RequestTableIds Route Discoveries it initiates after rebooting could
appear to be duplicates to the other nodes in the network. In
addition, a node SHOULD base its initial Identification value, used
for Route Discoveries after rebooting, on a battery backed-up clock
or other persistent memory device, if available, in order to help
avoid any possible such delay in successfully discovering new routes
after rebooting; if no such source of initial Identification value is
available, a node after rebooting SHOULD base its initial
Identification value on a random number.
4.4. Gratuitous Route Reply Table
The Gratuitous Route Reply Table of a node implementing DSR records
information about "gratuitous" Route Replies sent by this node as
part of automatic route shortening. As described in Section 3.4.3, a
node returns a gratuitous Route Reply when it overhears a packet
transmitted by some node, for which the node overhearing the packet
was not the intended next-hop node but was named later in the
unexpended hops of the source route in that packet; the node
overhearing the packet returns a gratuitous Route Reply to the
original sender of the packet, listing the shorter route (not
including the hops of the source route "skipped over" by this
packet). A node uses its Gratuitous Route Reply Table to limit the
rate at which it originates gratuitous Route Replies to the same
original sender for the same node from which it overheard a packet to
trigger the gratuitous Route Reply.
Johnson, et al. Experimental [Page 31]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Each entry in the Gratuitous Route Reply Table of a node contains the
following fields:
- The address of the node to which this node originated a gratuitous
Route Reply.
- The address of the node from which this node overheard the packet
triggering that gratuitous Route Reply.
- The remaining time before which this entry in the Gratuitous Route
Reply Table expires and SHOULD be deleted by the node. When a
node creates a new entry in its Gratuitous Route Reply Table, the
timeout value for that entry SHOULD be initialized to the value
GratReplyHoldoff.
When a node overhears a packet that would trigger a gratuitous Route
Reply, if a corresponding entry already exists in the node's
Gratuitous Route Reply Table, then the node SHOULD NOT send a
gratuitous Route Reply for that packet. Otherwise (i.e., if no
corresponding entry already exists), the node SHOULD create a new
entry in its Gratuitous Route Reply Table to record that gratuitous
Route Reply, with a timeout value of GratReplyHoldoff.
4.5. Network Interface Queue and Maintenance Buffer
Depending on factors such as the structure and organization of the
operating system, protocol stack implementation, network interface
device driver, and network interface hardware, a packet being
transmitted could be queued in a variety of ways. For example,
outgoing packets from the network protocol stack might be queued at
the operating system or link layer, before transmission by the
network interface. The network interface might also provide a
retransmission mechanism for packets, such as occurs in IEEE 802.11
[IEEE80211]; the DSR protocol, as part of Route Maintenance, requires
limited buffering of packets already transmitted for which the
reachability of the next-hop destination has not yet been determined.
The operation of DSR is defined here in terms of two conceptual data
structures that, together, incorporate this queuing behavior.
The Network Interface Queue of a node implementing DSR is an output
queue of packets from the network protocol stack waiting to be
transmitted by the network interface; for example, in the 4.4BSD Unix
network protocol stack implementation, this queue for a network
interface is represented as a "struct ifqueue" [WRIGHT95]. This
queue is used to hold packets while the network interface is in the
process of transmitting another packet.
Johnson, et al. Experimental [Page 32]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
The Maintenance Buffer of a node implementing DSR is a queue of
packets sent by this node that are awaiting next-hop reachability
confirmation as part of Route Maintenance. For each packet in the
Maintenance Buffer, a node maintains a count of the number of
retransmissions and the time of the last retransmission. Packets are
added to the Maintenance buffer after the first transmission attempt
is made. The Maintenance Buffer MAY be of limited size; when adding
a new packet to the Maintenance Buffer, if the buffer size is
insufficient to hold the new packet, the new packet SHOULD be
silently discarded. If, after MaxMaintRexmt attempts to confirm
next-hop reachability of some node, no confirmation is received, all
packets in this node's Maintenance Buffer with this next-hop
destination SHOULD be removed from the Maintenance Buffer. In this
case, the node also SHOULD originate a Route Error for this packet to
each original source of a packet removed in this way (Section 8.3)
and SHOULD salvage each packet removed in this way (Section 8.3.6) if
it has another route to that packet's IP Destination Address in its
Route Cache. The definition of MaxMaintRexmt conceptually includes
any retransmissions that might be attempted for a packet at the link
layer or within the network interface hardware. The timeout value to
use for each transmission attempt for an acknowledgement request
depends on the type of acknowledgement mechanism used by Route
Maintenance for that attempt, as described in Section 8.3.
4.6. Blacklist
When a node using the DSR protocol is connected through a network
interface that requires physically bidirectional links for unicast
transmission, the node MUST maintain a blacklist. The blacklist is a
table, indexed by neighbor node address, that indicates that the link
between this node and the specified neighbor node may not be
bidirectional. A node places another node's address in this list
when it believes that broadcast packets from that other node reach
this node, but that unicast transmission between the two nodes is not
possible. For example, if a node forwarding a Route Reply discovers
that the next hop is unreachable, it places that next hop in the
node's blacklist.
Once a node discovers that it can communicate bidirectionally with
one of the nodes listed in the blacklist, it SHOULD remove that node
from the blacklist. For example, if node A has node B listed in its
blacklist, but after transmitting a Route Request, node A hears B
forward the Route Request with a route record indicating that the
broadcast from A to B was successful, then A SHOULD remove the entry
for node B from its blacklist.
Johnson, et al. Experimental [Page 33]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
A node MUST associate a state with each node listed in its blacklist,
specifying whether the unidirectionality of the link to that node is
"questionable" or "probable". Each time the unreachability is
positively determined, the node SHOULD set the state to "probable".
After the unreachability has not been positively determined for some
amount of time, the state SHOULD revert to "questionable". A node
MAY expire entries for nodes from its blacklist after a reasonable
amount of time.
5. Additional Conceptual Data Structures for Flow State Extension
This section defines additional conceptual data structures used by
the optional "flow state" extension to DSR. In an implementation of
the protocol, these data structures MUST be implemented in a manner
consistent with the external behavior described in this document, but
the choice of implementation used is otherwise unconstrained.
5.1. Flow Table
A node implementing the flow state extension MUST implement a Flow
Table or other data structure consistent with the external behavior
described in this section. A node not implementing the flow state
extension SHOULD NOT implement a Flow Table.
The Flow Table records information about flows from which packets
recently have been sent or forwarded by this node. The table is
indexed by a triple (IP Source Address, IP Destination Address, Flow
ID), where Flow ID is a 16-bit number assigned by the source as
described in Section 3.5.1. Each entry in the Flow Table contains
the following fields:
- The MAC address of the next-hop node along this flow.
- An indication of the outgoing network interface on this node to be
used in transmitting packets along this flow.
- The MAC address of the previous-hop node along this flow.
- An indication of the network interface on this node from which
packets from that previous-hop node are received.
- A timeout after which this entry in the Flow Table MUST be
deleted.
- The expected value of the Hop Count field in the DSR Flow State
header for packets received for forwarding along this field (for
use with packets containing a DSR Flow State header).
Johnson, et al. Experimental [Page 34]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- An indication of whether or not this flow can be used as a default
flow for packets originated by this node (the Flow ID of a default
flow MUST be odd).
- The entry SHOULD record the complete source route for the flow.
(Nodes not recording the complete source route cannot participate
in Automatic Route Shortening.)
- The entry MAY contain a field recording the time this entry was
last used.
The entry MUST be deleted when its timeout expires.
5.2. Automatic Route Shortening Table
A node implementing the flow state extension SHOULD implement an
Automatic Route Shortening Table or other data structure consistent
with the external behavior described in this section. A node not
implementing the flow state extension SHOULD NOT implement an
Automatic Route Shortening Table.
The Automatic Route Shortening Table records information about
received packets for which Automatic Route Shortening may be
possible. The table is indexed by a triple (IP Source Address, IP
Destination Address, Flow ID). Each entry in the Automatic Route
Shortening Table contains a list of (packet identifier, Hop Count)
pairs for that flow. The packet identifier in the list may be any
unique identifier for the received packet; for example, for IPv4
packets, the combination of the following fields from the packet's IP
header MAY be used as a unique identifier for the packet: Source
Address, Destination Address, Identification, Protocol, Fragment
Offset, and Total Length. The Hop Count in the list in the entry is
copied from the Hop Count field in the DSR Flow State header of the
received packet for which this table entry was created. Any packet
identifier SHOULD appear at most once in an entry's list, and this
list item SHOULD record the minimum Hop Count value received for that
packet (if the wireless signal strength or signal-to-noise ratio at
which a packet is received is available to the DSR implementation in
a node, the node MAY, for example, remember instead in this list the
minimum Hop Count value for which the received packet's signal
strength or signal-to-noise ratio exceeded some threshold).
Space in the Automatic Route Shortening Table of a node MAY be
dynamically managed by any local algorithm at the node. For example,
in order to limit the amount of memory used to store the table, any
existing entry MAY be deleted at any time, and the number of packets
listed in each entry MAY be limited. However, when reclaiming space
in the table, nodes SHOULD favor retaining information about more
Johnson, et al. Experimental [Page 35]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
flows in the table rather than about more packets listed in each
entry in the table, as long as at least the listing of some small
number of packets (e.g., 3) can be retained in each entry.
5.3. Default Flow ID Table
A node implementing the flow state extension MUST implement a Default
Flow Table or other data structure consistent with the external
behavior described in this section. A node not implementing the flow
state extension SHOULD NOT implement a Default Flow Table.
For each (IP Source Address, IP Destination Address) pair for which a
node forwards packets, the node MUST record:
- The largest odd Flow ID value seen.
- The time at which all the corresponding flows that are forwarded
by this node expire.
- The current default Flow ID.
- A flag indicating whether or not the current default Flow ID is
valid.
If a node deletes this record for an (IP Source Address, IP
Destination Address) pair, it MUST also delete all Flow Table entries
for that pair. Nodes MUST delete table entries if all of this (IP
Source Address, IP Destination Address) pair's flows that are
forwarded by this node expire.
6. DSR Options Header Format
The Dynamic Source Routing protocol makes use of a special header
carrying control information that can be included in any existing IP
packet. This DSR Options header in a packet contains a small fixed-
sized, 4-octet portion, followed by a sequence of zero or more DSR
options carrying optional information. The end of the sequence of
DSR options in the DSR Options header is implied by the total length
of the DSR Options header.
For IPv4, the DSR Options header MUST immediately follow the IP
header in the packet. (If a Hop-by-Hop Options extension header, as
defined in IPv6 [RFC2460], becomes defined for IPv4, the DSR Options
header MUST immediately follow the Hop-by-Hop Options extension
header, if one is present in the packet, and MUST otherwise
immediately follow the IP header.)
Johnson, et al. Experimental [Page 36]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
To add a DSR Options header to a packet, the DSR Options header is
inserted following the packet's IP header, before any following
header such as a traditional (e.g., TCP or UDP) transport layer
header. Specifically, the Protocol field in the IP header is used to
indicate that a DSR Options header follows the IP header, and the
Next Header field in the DSR Options header is used to indicate the
type of protocol header (such as a transport layer header) following
the DSR Options header.
If any headers follow the DSR Options header in a packet, the total
length of the DSR Options header (and thus the total, combined length
of all DSR options present) MUST be a multiple of 4 octets. This
requirement preserves the alignment of these following headers in the
packet.
6.1. Fixed Portion of DSR Options Header
The fixed portion of the DSR Options header is used to carry
information that must be present in any DSR Options header. This
fixed portion of the DSR Options header has the following format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header |F| Reserved | Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. Options .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Next Header
8-bit selector. Identifies the type of header immediately
following the DSR Options header. Uses the same values as the
IPv4 Protocol field [RFC1700]. If no header follows, then Next
Header MUST have the value 59, "No Next Header" [RFC2460].
Flow State Header (F)
Flag bit. MUST be set to 0. This bit is set in a DSR Flow
State header (Section 7.1) and clear in a DSR Options header.
Reserved
MUST be sent as 0 and ignored on reception.
Johnson, et al. Experimental [Page 37]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Payload Length
The length of the DSR Options header, excluding the 4-octet
fixed portion. The value of the Payload Length field defines
the total length of all options carried in the DSR Options
header.
Options
Variable-length field; the length of the Options field is
specified by the Payload Length field in this DSR Options
header. Contains one or more pieces of optional information
(DSR options), encoded in type-length-value (TLV) format (with
the exception of the Pad1 option described in Section 6.8).
The placement of DSR options following the fixed portion of the DSR
Options header MAY be padded for alignment. However, due to the
typically limited available wireless bandwidth in ad hoc networks,
this padding is not required, and receiving nodes MUST NOT expect
options within a DSR Options header to be aligned.
Each DSR option is assigned a unique Option Type code. The most
significant 3 bits (that is, Option Type & 0xE0) allow a node not
implementing processing for this Option Type value to behave in the
manner closest to correct for that type:
- The most significant bit in the Option Type value (that is, Option
Type & 0x80) represents whether or not a node receiving this
Option Type (when the node does not implement processing for this
Option Type) SHOULD respond to such a DSR option with a Route
Error of type OPTION_NOT_SUPPORTED, except that such a Route Error
SHOULD never be sent in response to a packet containing a Route
Request option.
- The two following bits in the Option Type value (that is, Option
Type & 0x60) are a two-bit field indicating how such a node that
does not support this Option Type MUST process the packet:
00 = Ignore Option
01 = Remove Option
10 = Mark Option
11 = Drop Packet
When these 2 bits are 00 (that is, Option Type & 0x60 == 0), a
node not implementing processing for that Option Type MUST use the
Opt Data Len field to skip over the option and continue
processing. When these 2 bits are 01 (that is, Option Type & 0x60
== 0x20), a node not implementing processing for that Option Type
Johnson, et al. Experimental [Page 38]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
MUST use the Opt Data Len field to remove the option from the
packet and continue processing as if the option had not been
included in the received packet. When these 2 bits are 10 (that
is, Option Type & 0x60 == 0x40), a node not implementing
processing for that Option Type MUST set the most significant bit
following the Opt Data Len field, MUST ignore the contents of the
option using the Opt Data Len field, and MUST continue processing
the packet. Finally, when these 2 bits are 11 (that is, Option
Type & 0x60 == 0x60), a node not implementing processing for that
Option Type MUST drop the packet.
The following types of DSR options are defined in this document for
use within a DSR Options header:
- Route Request option (Section 6.2)
- Route Reply option (Section 6.3)
- Route Error option (Section 6.4)
- Acknowledgement Request option (Section 6.5)
- Acknowledgement option (Section 6.6)
- DSR Source Route option (Section 6.7)
- Pad1 option (Section 6.8)
- PadN option (Section 6.9)
In addition, Section 7 specifies further DSR options for use with the
optional DSR flow state extension.
Johnson, et al. Experimental [Page 39]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
6.2. Route Request Option
The Route Request option in a DSR Options header is encoded as
follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Identification |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Target Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[1] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[2] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[n] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IP fields:
Source Address
MUST be set to the address of the node originating this packet.
Intermediate nodes that retransmit the packet to propagate the
Route Request MUST NOT change this field.
Destination Address
MUST be set to the IP limited broadcast address
(255.255.255.255).
Hop Limit (TTL)
MAY be varied from 1 to 255, for example, to implement non-
propagating Route Requests and Route Request expanding-ring
searches (Section 3.3.3).
Route Request fields:
Option Type
1. Nodes not understanding this option will ignore this
option.
Johnson, et al. Experimental [Page 40]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields. MUST be set
equal to (4 * n) + 6, where n is the number of addresses in the
Route Request Option.
Identification
A unique value generated by the initiator (original sender) of
the Route Request. Nodes initiating a Route Request generate a
new Identification value for each Route Request, for example
based on a sequence number counter of all Route Requests
initiated by the node.
This value allows a receiving node to determine whether it has
recently seen a copy of this Route Request. If this
Identification value (for this IP Source address and Target
Address) is found by this receiving node in its Route Request
Table (in the cache of Identification values in the entry there
for this initiating node), this receiving node MUST discard the
Route Request. When a Route Request is propagated, this field
MUST be copied from the received copy of the Route Request
being propagated.
Target Address
The address of the node that is the target of the Route
Request.
Address[1..n]
Address[i] is the IPv4 address of the i-th node recorded in the
Route Request option. The address given in the Source Address
field in the IP header is the address of the initiator of the
Route Discovery and MUST NOT be listed in the Address[i]
fields; the address given in Address[1] is thus the IPv4
address of the first node on the path after the initiator. The
number of addresses present in this field is indicated by the
Opt Data Len field in the option (n = (Opt Data Len - 6) / 4).
Each node propagating the Route Request adds its own address to
this list, increasing the Opt Data Len value by 4 octets.
The Route Request option MUST NOT appear more than once within a DSR
Options header.
Johnson, et al. Experimental [Page 41]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
6.3. Route Reply Option
The Route Reply option in a DSR Options header is encoded as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len |L| Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[1] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[2] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[n] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IP fields:
Source Address
Set to the address of the node sending the Route Reply. In the
case of a node sending a reply from its Route Cache (Section
3.3.2) or sending a gratuitous Route Reply (Section 3.4.3),
this address can differ from the address that was the target of
the Route Discovery.
Destination Address
MUST be set to the address of the source node of the route
being returned. Copied from the Source Address field of the
Route Request generating the Route Reply or, in the case of a
gratuitous Route Reply, copied from the Source Address field of
the data packet triggering the gratuitous Reply.
Route Reply fields:
Option Type
2. Nodes not understanding this option will ignore this
option.
Johnson, et al. Experimental [Page 42]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields. MUST be set
equal to (4 * n) + 1, where n is the number of addresses in the
Route Reply Option.
Last Hop External (L)
Set to indicate that the last hop given by the Route Reply (the
link from Address[n-1] to Address[n]) is actually an arbitrary
path in a network external to the DSR network; the exact route
outside the DSR network is not represented in the Route Reply.
Nodes caching this hop in their Route Cache MUST flag the
cached hop with the External flag. Such hops MUST NOT be
returned in a cached Route Reply generated from this Route
Cache entry, and selection of routes from the Route Cache to
route a packet being sent SHOULD prefer routes that contain no
hops flagged as External.
Reserved
MUST be sent as 0 and ignored on reception.
Address[1..n]
The source route being returned by the Route Reply. The route
indicates a sequence of hops, originating at the source node
specified in the Destination Address field of the IP header of
the packet carrying the Route Reply, through each of the
Address[i] nodes in the order listed in the Route Reply, ending
at the node indicated by Address[n]. The number of addresses
present in the Address[1..n] field is indicated by the Opt Data
Len field in the option (n = (Opt Data Len - 1) / 4).
A Route Reply option MAY appear one or more times within a DSR
Options header.
Johnson, et al. Experimental [Page 43]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
6.4. Route Error Option
The Route Error option in a DSR Options header is encoded as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Error Type |Reservd|Salvage|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Error Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Error Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. Type-Specific Information .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Option Type
3. Nodes not understanding this option will ignore this
option.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
For the current definition of the Route Error option,
this field MUST be set to 10, plus the size of any
Type-Specific Information present in the Route Error. Further
extensions to the Route Error option format may also be
included after the Type-Specific Information portion of the
Route Error option specified above. The presence of such
extensions will be indicated by the Opt Data Len field.
When the Opt Data Len is greater than that required for
the fixed portion of the Route Error plus the necessary
Type-Specific Information as indicated by the Option Type
value in the option, the remaining octets are interpreted as
extensions. Currently, no such further extensions have been
defined.
Error Type
The type of error encountered. Currently, the following type
values are defined:
Johnson, et al. Experimental [Page 44]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
1 = NODE_UNREACHABLE
2 = FLOW_STATE_NOT_SUPPORTED
3 = OPTION_NOT_SUPPORTED
Other values of the Error Type field are reserved for future
use.
Reservd
Reserved. MUST be sent as 0 and ignored on reception.
Salvage
A 4-bit unsigned integer. Copied from the Salvage field in the
DSR Source Route option of the packet triggering the Route
Error.
The "total salvage count" of the Route Error option is derived
from the value in the Salvage field of this Route Error option
and all preceding Route Error options in the packet as follows:
the total salvage count is the sum of, for each such Route
Error option, one plus the value in the Salvage field of that
Route Error option.
Error Source Address
The address of the node originating the Route Error (e.g., the
node that attempted to forward a packet and discovered the link
failure).
Error Destination Address
The address of the node to which the Route Error must be
delivered. For example, when the Error Type field is set to
NODE_UNREACHABLE, this field will be set to the address of the
node that generated the routing information claiming that the
hop from the Error Source Address to Unreachable Node Address
(specified in the Type-Specific Information) was a valid hop.
Type-Specific Information
Information specific to the Error Type of this Route Error
message.
A Route Error option MAY appear one or more times within a DSR
Options header.
Johnson, et al. Experimental [Page 45]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
6.4.1. Node Unreachable Type-Specific Information
When the Route Error is of type NODE_UNREACHABLE, the Type-Specific
Information field is defined as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unreachable Node Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Unreachable Node Address
The IP address of the node that was found to be unreachable
(the next-hop neighbor to which the node with address
Error Source Address was attempting to transmit the packet).
6.4.2. Flow State Not Supported Type-Specific Information
When the Route Error is of type FLOW_STATE_NOT_SUPPORTED, the
Type-Specific Information field is empty.
6.4.3. Option Not Supported Type-Specific Information
When the Route Error is of type OPTION_NOT_SUPPORTED, the
Type-Specific Information field is defined as follows:
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|Unsupported Opt|
+-+-+-+-+-+-+-+-+
Unsupported Opt
The Option Type of option triggering the Route Error.
6.5. Acknowledgement Request Option
The Acknowledgement Request option in a DSR Options header is encoded
as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Identification |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Johnson, et al. Experimental [Page 46]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Option Type
160. Nodes not understanding this option will remove the
option and return a Route Error.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
Identification
The Identification field is set to a unique value and is copied
into the Identification field of the Acknowledgement option
when returned by the node receiving the packet over this hop.
An Acknowledgement Request option MUST NOT appear more than once
within a DSR Options header.
6.6. Acknowledgement Option
The Acknowledgement option in a DSR Options header is encoded as
follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Identification |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ACK Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ACK Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Option Type
32. Nodes not understanding this option will remove the
option.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
Identification
Copied from the Identification field of the Acknowledgement
Request option of the packet being acknowledged.
Johnson, et al. Experimental [Page 47]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
ACK Source Address
The address of the node originating the acknowledgement.
ACK Destination Address
The address of the node to which the acknowledgement is to be
delivered.
An Acknowledgement option MAY appear one or more times within a DSR
Options header.
6.7. DSR Source Route Option
The DSR Source Route option in a DSR Options header is encoded as
follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len |F|L|Reservd|Salvage| Segs Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[1] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[2] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address[n] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Option Type
96. Nodes not understanding this option will drop the packet.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields. For the
format of the DSR Source Route option defined here, this field
MUST be set to the value (n * 4) + 2, where n is the number of
addresses present in the Address[i] fields.
First Hop External (F)
Set to indicate that the first hop indicated by the DSR Source
Route option is actually an arbitrary path in a network
external to the DSR network; the exact route outside the DSR
Johnson, et al. Experimental [Page 48]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
network is not represented in the DSR Source Route option.
Nodes caching this hop in their Route Cache MUST flag the
cached hop with the External flag. Such hops MUST NOT be
returned in a Route Reply generated from this Route Cache
entry, and selection of routes from the Route Cache to route a
packet being sent SHOULD prefer routes that contain no hops
flagged as External.
Last Hop External (L)
Set to indicate that the last hop indicated by the DSR Source
Route option is actually an arbitrary path in a network
external to the DSR network; the exact route outside the DSR
network is not represented in the DSR Source Route option.
Nodes caching this hop in their Route Cache MUST flag the
cached hop with the External flag. Such hops MUST NOT be
returned in a Route Reply generated from this Route Cache
entry, and selection of routes from the Route Cache to route a
packet being sent SHOULD prefer routes that contain no hops
flagged as External.
Reserved
MUST be sent as 0 and ignored on reception.
Salvage
A 4-bit unsigned integer. Count of number of times that this
packet has been salvaged as a part of DSR routing (Section
3.4.1).
Segments Left (Segs Left)
Number of route segments remaining, i.e., number of explicitly
listed intermediate nodes still to be visited before reaching
the final destination.
Address[1..n]
The sequence of addresses of the source route. In routing and
forwarding the packet, the source route is processed as
described in Sections 8.1.3 and 8.1.5. The number of addresses
present in the Address[1..n] field is indicated by the Opt Data
Len field in the option (n = (Opt Data Len - 2) / 4).
When forwarding a packet along a DSR source route using a DSR Source
Route option in the packet's DSR Options header, the Destination
Address field in the packet's IP header is always set to the address
Johnson, et al. Experimental [Page 49]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
of the packet's ultimate destination. A node receiving a packet
containing a DSR Options header with a DSR Source Route option MUST
examine the indicated source route to determine if it is the intended
next-hop node for the packet and how to forward the packet, as
defined in Sections 8.1.4 and 8.1.5.
6.8. Pad1 Option
The Pad1 option in a DSR Options header is encoded as follows:
+-+-+-+-+-+-+-+-+
| Option Type |
+-+-+-+-+-+-+-+-+
Option Type
224. Nodes not understanding this option will drop the packet
and return a Route Error.
A Pad1 option MAY be included in the Options field of a DSR Options
header in order to align subsequent DSR options, but such alignment
is not required and MUST NOT be expected by a node receiving a packet
containing a DSR Options header.
If any headers follow the DSR Options header in a packet, the total
length of a DSR Options header, indicated by the Payload Length field
in the DSR Options header MUST be a multiple of 4 octets. In this
case, when building a DSR Options header in a packet, sufficient Pad1
or PadN options MUST be included in the Options field of the DSR
Options header to make the total length a multiple of 4 octets.
If more than one consecutive octet of padding is being inserted in
the Options field of a DSR Options header, the PadN option described
next, SHOULD be used, rather than multiple Pad1 options.
Note that the format of the Pad1 option is a special case; it does
not have an Opt Data Len or Option Data field.
6.9. PadN Option
The PadN option in a DSR Options header is encoded as follows:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| Option Type | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
Johnson, et al. Experimental [Page 50]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Option Type
0. Nodes not understanding this option will ignore this
option.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields. The size of
the Option Data field.
Option Data
A number of zero-valued octets equal to the Opt Data Len.
A PadN option MAY be included in the Options field of a DSR Options
header in order to align subsequent DSR options, but such alignment
is not required and MUST NOT be expected by a node receiving a packet
containing a DSR Options header.
If any headers follow the DSR Options header in a packet, the total
length of a DSR Options header, indicated by the Payload Length field
in the DSR Options header, MUST be a multiple of 4 octets. In this
case, when building a DSR Options header in a packet, sufficient Pad1
or PadN options MUST be included in the Options field of the DSR
Options header to make the total length a multiple of 4 octets.
7. Additional Header Formats and Options for Flow State Extension
The optional DSR flow state extension requires a new header type, the
DSR Flow State header.
In addition, the DSR flow state extension adds the following options
for the DSR Options header defined in Section 6:
- Timeout option (Section 7.2.1)
- Destination and Flow ID option (Section 7.2.2)
Two new Error Type values are also defined for use in the Route Error
option in a DSR Options header:
- UNKNOWN_FLOW
- DEFAULT_FLOW_UNKNOWN
Finally, an extension to the Acknowledgement Request option in a DSR
Options header is also defined:
Johnson, et al. Experimental [Page 51]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Previous Hop Address
This section defines each of these new header, option, or extension
formats.
7.1. DSR Flow State Header
The DSR Flow State header is a small 4-byte header optionally used to
carry the flow ID and hop count for a packet being sent along a DSR
flow. It is distinguished from the fixed DSR Options header (Section
6.1) in that the Flow State Header (F) bit is set in the DSR Flow
State header and is clear in the fixed DSR Options header.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header |F| Hop Count | Flow Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Next Header
8-bit selector. Identifies the type of header immediately
following the DSR Flow State header. Uses the same values as
the IPv4 Protocol field [RFC1700].
Flow State Header (F)
Flag bit. MUST be set to 1. This bit is set in a DSR Flow
State header and clear in a DSR Options header (Section 6.1).
Hop Count
7-bit unsigned integer. The number of hops through which this
packet has been forwarded.
Flow Identification
The flow ID for this flow, as described in Section 3.5.1.
7.2. New Options and Extensions in DSR Options Header
7.2.1. Timeout Option
The Timeout option is defined for use in a DSR Options header to
indicate the amount of time before the expiration of the flow ID
along which the packet is being sent.
Johnson, et al. Experimental [Page 52]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Timeout |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Option Type
128. Nodes not understanding this option will ignore the
option and return a Route Error.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
When no extensions are present, the Opt Data Len of a Timeout
option is 2. Further extensions to DSR may include additional
data in a Timeout option. The presence of such extensions is
indicated by an Opt Data Len greater than 2. Currently, no
such extensions have been defined.
Timeout
The number of seconds for which this flow remains valid.
The Timeout option MUST NOT appear more than once within a DSR
Options header.
7.2.2. Destination and Flow ID Option
The Destination and Flow ID option is defined for use in a DSR
Options header to send a packet to an intermediate host along one
flow, for eventual forwarding to the final destination along a
different flow. This option enables the aggregation of the state of
multiple flows.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | New Flow Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| New IP Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Johnson, et al. Experimental [Page 53]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Option Type
129. Nodes not understanding this option will ignore the
option and return a Route Error.
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
When no extensions are present, the Opt Data Len of a
Destination and Flow ID option is 6. Further extensions to DSR
may include additional data in a Destination and Flow ID
option. The presence of such extensions is indicated by an Opt
Data Len greater than 6. Currently, no such extensions have
been defined.
New Flow Identifier
Indicates the next identifier to store in the Flow ID field of
the DSR Options header.
New IP Destination Address
Indicates the next address to store in the Destination Address
field of the IP header.
The Destination and Flow ID option MAY appear one or more times
within a DSR Options header.
7.3. New Error Types for Route Error Option
7.3.1. Unknown Flow Type-Specific Information
A new Error Type value of 129 (UNKNOWN_FLOW) is defined for use in a
Route Error option in a DSR Options header. The Type-Specific
Information for errors of this type is encoded as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Original IP Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flow ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Johnson, et al. Experimental [Page 54]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Original IP Destination Address
The IP Destination Address of the packet that caused the error.
Flow ID
The Flow ID contained in the DSR Flow ID option that caused the
error.
7.3.2. Default Flow Unknown Type-Specific Information
A new Error Type value of 130 (DEFAULT_FLOW_UNKNOWN) is defined
for use in a Route Error option in a DSR Options header. The
Type-Specific Information for errors of this type is encoded as
follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Original IP Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Original IP Destination Address
The IP Destination Address of the packet that caused the error.
7.4. New Acknowledgement Request Option Extension
7.4.1. Previous Hop Address Extension
When the Opt Data Len field of an Acknowledgement Request option
in a DSR Options header is greater than or equal to 6, the
ACK Request Source Address field is present. The option is then
formatted as follows:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Option Type | Opt Data Len | Packet Identifier |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ACK Request Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Option Type
160. Nodes not understanding this option will remove the
option and return a Route Error.
Johnson, et al. Experimental [Page 55]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Opt Data Len
8-bit unsigned integer. Length of the option, in octets,
excluding the Option Type and Opt Data Len fields.
When no extensions are presents, the Opt Data Len of an
Acknowledgement Request option is 2. Further extensions to DSR
may include additional data in an Acknowledgement Request
option. The presence of such extensions is indicated by an Opt
Data Len greater than 2.
Currently, one such extension has been defined. If the Opt
Data Len is at least 6, then an ACK Request Source Address is
present.
Packet Identifier
The Packet Identifier field is set to a unique number and is
copied into the Identification field of the DSR Acknowledgement
option when returned by the node receiving the packet over this
hop.
ACK Request Source Address
The address of the node requesting the DSR Acknowledgement.
8. Detailed Operation
8.1. General Packet Processing
8.1.1. Originating a Packet
When originating any packet, a node using DSR routing MUST perform
the following sequence of steps:
- Search the node's Route Cache for a route to the address given in
the IP Destination Address field in the packet's header.
- If no such route is found in the Route Cache, then perform Route
Discovery for the Destination Address, as described in Section
8.2. Initiating a Route Discovery for this target node address
results in the node adding a Route Request option in a DSR Options
header in this existing packet, or saving this existing packet to
its Send Buffer and initiating the Route Discovery by sending a
separate packet containing such a Route Request option. If the
node chooses to initiate the Route Discovery by adding the Route
Request option to this existing packet, it will replace the IP
Destination Address field with the IP "limited broadcast" address
Johnson, et al. Experimental [Page 56]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
(255.255.255.255) [RFC1122], copying the original IP Destination
Address to the Target Address field of the new Route Request
option added to the packet, as described in Section 8.2.1.
- If the packet now does not contain a Route Request option, then
this node must have a route to the Destination Address of the
packet; if the node has more than one route to this Destination
Address, the node selects one to use for this packet. If the
length of this route is greater than 1 hop, or if the node
determines to request a DSR network-layer acknowledgement from the
first-hop node in that route, then insert a DSR Options header
into the packet, as described in Section 8.1.2, and insert a DSR
Source Route option, as described in Section 8.1.3. The source
route in the packet is initialized from the selected route to the
Destination Address of the packet.
- Transmit the packet to the first-hop node address given in
selected source route, using Route Maintenance to determine the
reachability of the next hop, as described in Section 8.3.
8.1.2. Adding a DSR Options Header to a Packet
A node originating a packet adds a DSR Options header to the packet,
if necessary, to carry information needed by the routing protocol. A
packet MUST NOT contain more than one DSR Options header. A DSR
Options header is added to a packet by performing the following
sequence of steps (these steps assume that the packet contains no
other headers that MUST be located in the packet before the DSR
Options header):
- Insert a DSR Options header after the IP header but before any
other header that may be present.
- Set the Next Header field of the DSR Options header to the
Protocol number field of the packet's IP header.
- Set the Protocol field of the packet's IP header to the protocol
number assigned for DSR (48).
8.1.3. Adding a DSR Source Route Option to a Packet
A node originating a packet adds a DSR Source Route option to the
packet, if necessary, in order to carry the source route from this
originating node to the final destination address of the packet.
Specifically, the node adding the DSR Source Route option constructs
the DSR Source Route option and modifies the IP packet according to
the following sequence of steps:
Johnson, et al. Experimental [Page 57]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- The node creates a DSR Source Route option, as described in
Section 6.7, and appends it to the DSR Options header in the
packet. (A DSR Options header is added, as described in Section
8.1.2, if not already present.)
- The number of Address[i] fields to include in the DSR Source Route
option (n) is the number of intermediate nodes in the source route
for the packet (i.e., excluding the address of the originating
node and the final destination address of the packet). The
Segments Left field in the DSR Source Route option is initialized
equal to n.
- The addresses within the source route for the packet are copied
into sequential Address[i] fields in the DSR Source Route option,
for i = 1, 2, ..., n.
- The First Hop External (F) bit in the DSR Source Route option is
copied from the External bit flagging the first hop in the source
route for the packet, as indicated in the Route Cache.
- The Last Hop External (L) bit in the DSR Source Route option is
copied from the External bit flagging the last hop in the source
route for the packet, as indicated in the Route Cache.
- The Salvage field in the DSR Source Route option is initialized to
0.
8.1.4. Processing a Received Packet
When a node receives any packet (whether for forwarding, overheard,
or the final destination of the packet), if that packet contains a
DSR Options header, then that node MUST process any options contained
in that DSR Options header, in the order contained there.
Specifically:
- If the DSR Options header contains a Route Request option, the
node SHOULD extract the source route from the Route Request and
add this routing information to its Route Cache, subject to the
conditions identified in Section 3.3.1. The routing information
from the Route Request is the sequence of hop addresses
initiator, Address[1], Address[2], ..., Address[n]
where initiator is the value of the Source Address field in the IP
header of the packet carrying the Route Request (the address of
the initiator of the Route Discovery), and each Address[i] is a
node through which this Route Request has passed, in turn, during
Johnson, et al. Experimental [Page 58]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
this Route Discovery. The value n, here, is the number of
addresses recorded in the Route Request option, or
(Opt Data Len - 6) / 4.
After possibly updating the node's Route Cache in response to the
routing information in the Route Request option, the node MUST
then process the Route Request option as described in Section
8.2.2.
- If the DSR Options header contains a Route Reply option, the node
SHOULD extract the source route from the Route Reply and add this
routing information to its Route Cache, subject to the conditions
identified in Section 3.3.1. The source route from the Route
Reply is the sequence of hop addresses
initiator, Address[1], Address[2], ..., Address[n]
where initiator is the value of the Destination Address field in
the IP header of the packet carrying the Route Reply (the address
of the initiator of the Route Discovery), and each Address[i] is a
node through which the source route passes, in turn, on the route
to the target of the Route Discovery. Address[n] is the address
of the target. If the Last Hop External (L) bit is set in the
Route Reply, the node MUST flag the last hop from the Route Reply
(the link from Address[n-1] to Address[n]) in its Route Cache as
External. The value n here is the number of addresses in the
source route being returned in the Route Reply option, or
(Opt Data Len - 1) / 4.
After possibly updating the node's Route Cache in response to the
routing information in the Route Reply option, then if the
packet's IP Destination Address matches one of this node's IP
addresses, the node MUST then process the Route Reply option as
described in Section 8.2.6.
- If the DSR Options header contains a Route Error option, the node
MUST process the Route Error option as described in Section 8.3.5.
- If the DSR Options header contains an Acknowledgement Request
option, the node MUST process the Acknowledgement Request option
as described in Section 8.3.3.
- If the DSR Options header contains an Acknowledgement option, then
subject to the conditions identified in Section 3.3.1, the node
SHOULD add to its Route Cache the single link from the node
identified by the ACK Source Address field to the node identified
by the ACK Destination Address field.
Johnson, et al. Experimental [Page 59]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
After possibly updating the node's Route Cache in response to the
routing information in the Acknowledgement option, the node MUST
then process the Acknowledgement option as described in Section
8.3.3.
- If the DSR Options header contains a DSR Source Route option, the
node SHOULD extract the source route from the DSR Source Route
option and add this routing information to its Route Cache,
subject to the conditions identified in Section 3.3.1. If the
value of the Salvage field in the DSR Source Route option is zero,
then the routing information from the DSR Source Route is the
sequence of hop addresses
source, Address[1], Address[2], ..., Address[n], destination
Otherwise (i.e., if Salvage is nonzero), the routing information
from the DSR Source Route is the sequence of hop addresses
Address[1], Address[2], ..., Address[n], destination
where source is the value of the Source Address field in the IP
header of the packet carrying the DSR Source Route option (the
original sender of the packet), each Address[i] is the value in
the Address[i] field in the DSR Source Route option, and
destination is the value of the Destination Address field in the
packet's IP header (the last-hop address of the source route).
The value n here is the number of addresses in source route in the
DSR Source Route option, or (Opt Data Len - 2) / 4.
After possibly updating the node's Route Cache in response to the
routing information in the DSR Source Route option, the node MUST
then process the DSR Source Route option as described in Section
8.1.5.
- Any Pad1 or PadN options in the DSR Options header are ignored.
- Finally, if the Destination Address in the packet's IP header
matches one of this receiving node's own IP address(es), remove
the DSR Options header and all the included DSR options in the
header, and pass the rest of the packet to the network layer.
8.1.5. Processing a Received DSR Source Route Option
When a node receives a packet containing a DSR Source Route option
(whether for forwarding, overheard, or the final destination of the
packet), that node SHOULD examine the packet to determine if the
receipt of that packet indicates an opportunity for automatic route
shortening, as described in Section 3.4.3. Specifically, if this
Johnson, et al. Experimental [Page 60]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
node is not the intended next-hop destination for the packet but is
named in the later unexpended portion of the source route in the
packet's DSR Source Route option, then this packet indicates an
opportunity for automatic route shortening: the intermediate nodes
after the node from which this node overheard the packet and before
this node itself are no longer necessary in the source route. In
this case, this node SHOULD perform the following sequence of steps
as part of automatic route shortening:
- The node searches its Gratuitous Route Reply Table for an entry
describing a gratuitous Route Reply earlier sent by this node, for
which the original sender (of the packet triggering the gratuitous
Route Reply) and the transmitting node (from which this node
overheard that packet in order to trigger the gratuitous Route
Reply) both match the respective node addresses for this new
received packet. If such an entry is found in the node's
Gratuitous Route Reply Table, the node SHOULD NOT perform
automatic route shortening in response to this receipt of this
packet.
- Otherwise, the node creates an entry for this overheard packet in
its Gratuitous Route Reply Table. The timeout value for this new
entry SHOULD be initialized to the value GratReplyHoldoff. After
this timeout has expired, the node SHOULD delete this entry from
its Gratuitous Route Reply Table.
- After creating the new Gratuitous Route Reply Table entry above,
the node originates a gratuitous Route Reply to the IP Source
Address of this overheard packet, as described in Section 3.4.3.
If the MAC protocol in use in the network is not capable of
transmitting unicast packets over unidirectional links, as
discussed in Section 3.3.1, then in originating this Route Reply,
the node MUST use a source route for routing the Route Reply
packet that is obtained by reversing the sequence of hops over
which the packet triggering the gratuitous Route Reply was routed
in reaching and being overheard by this node. This reversing of
the route uses the gratuitous Route Reply to test this sequence of
hops for bidirectionality, preventing the gratuitous Route Reply
from being received by the initiator of the Route Discovery unless
each of the hops over which the gratuitous Route Reply is returned
is bidirectional.
- Discard the overheard packet, since the packet has been received
before its normal traversal of the packet's source route would
have caused it to reach this receiving node. Another copy of the
packet will normally arrive at this node as indicated in the
Johnson, et al. Experimental [Page 61]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
packet's source route; discarding this initial copy of the packet,
which triggered the gratuitous Route Reply, will prevent the
duplication of this packet that would otherwise occur.
If the packet is not discarded as part of automatic route shortening
above, then the node MUST process the Source Route option according
to the following sequence of steps:
- If the value of the Segments Left field in the DSR Source Route
option equals 0, then remove the DSR Source Route option from the
DSR Options header.
- Else, let n equal (Opt Data Len - 2) / 4. This is the number of
addresses in the DSR Source Route option.
- If the value of the Segments Left field is greater than n, then
send an ICMP Parameter Problem, Code 0, message [RFC792] to the IP
Source Address, pointing to the Segments Left field, and discard
the packet. Do not process the DSR Source Route option further.
- Else, decrement the value of the Segments Left field by 1. Let i
equal n minus Segments Left. This is the index of the next
address to be visited in the Address vector.
- If Address[i] or the IP Destination Address is a multicast
address, then discard the packet. Do not process the DSR Source
Route option further.
- If this node has more than one network interface and if Address[i]
is the address of one this node's network interfaces, then this
indicates a change in the network interface to use in forwarding
the packet, as described in Section 8.4. In this case, decrement
the value of the Segments Left field by 1 to skip over this
address (that indicated the change of network interface) and go to
the first step above (checking the value of the Segments Left
field) to continue processing this Source Route option; in further
processing of this Source Route option, the indicated new network
interface MUST be used in forwarding the packet.
- If the MTU of the link over which this node would transmit the
packet to forward it to the node Address[i] is less than the size
of the packet, the node MUST either discard the packet and send an
ICMP Packet Too Big message to the packet's Source Address
[RFC792] or fragment it as specified in Section 8.5.
- Forward the packet to the IP address specified in the Address[i]
field of the IP header, following normal IP forwarding procedures,
including checking and decrementing the Time-to-Live (TTL) field
Johnson, et al. Experimental [Page 62]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
in the packet's IP header [RFC791, RFC1122]. In this forwarding
of the packet, the next-hop node (identified by Address[i]) MUST
be treated as a direct neighbor node: the transmission to that
next node MUST be done in a single IP forwarding hop, without
Route Discovery and without searching the Route Cache.
- In forwarding the packet, perform Route Maintenance for the next
hop of the packet, by verifying that the next-hop node is
reachable, as described in Section 8.3.
Multicast addresses MUST NOT appear in a DSR Source Route option or
in the IP Destination Address field of a packet carrying a DSR Source
Route option in a DSR Options header.
8.1.6. Handling an Unknown DSR Option
Nodes implementing DSR MUST handle all options specified in this
document, except those options pertaining to the optional flow state
extension (Section 7). However, further extensions to DSR may
include other option types that may not be understood by
implementations conforming to this version of the DSR specification.
In DSR, Option Type codes encode required behavior for nodes not
implementing that type of option. These behaviors are included in
the most significant 3 bits of the Option Type.
If the most significant bit of the Option Type is set (that is,
Option Type & 0x80 is nonzero), and this packet does not contain a
Route Request option, a node SHOULD return a Route Error to the IP
Source Address, following the steps described in Section 8.3.4,
except that the Error Type MUST be set to OPTION_NOT_SUPPORTED and
the Unsupported Opt field MUST be set to the Option Type triggering
the Route Error.
Whether or not a Route Error is sent in response to this DSR option,
as described above, the node also MUST examine the next 2 most
significant bits (that is, Option Type & 0x60):
- When these 2 bits are 00 (that is, Option Type & 0x60 == 0), a
node not implementing processing for that Option Type MUST use the
Opt Data Len field to skip over the option and continue
processing.
- When these 2 bits are 01 (that is, Option Type & 0x60 == 0x20), a
node not implementing processing for that Option Type MUST use the
Opt Data Len field to remove the option from the packet and
continue processing as if the option had not been included in the
received packet.
Johnson, et al. Experimental [Page 63]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- When these 2 bits are 10 (that is, Option Type & 0x60 == 0x40), a
node not implementing processing for that Option Type MUST set the
most significant bit following the Opt Data Len field. In
addition, the node MUST then ignore and skip over the contents of
the option using the Opt Data Len field and MUST continue
processing the packet.
- Finally, when these 2 bits are 11 (that is,
Option Type & 0x60 == 0x60), a node not implementing processing
for that Option Type MUST drop the packet.
8.2. Route Discovery Processing
Route Discovery is the mechanism by which a node S wishing to send a
packet to a destination node D obtains a source route to D. Route
Discovery SHOULD be used only when S attempts to send a packet to D
and does not already know a route to D. The node initiating a Route
Discovery is known as the "initiator" of the Route Discovery, and the
destination node for which the Route Discovery is initiated is known
as the "target" of the Route Discovery.
Route Discovery operates entirely on demand; a node initiates Route
Discovery based on its own origination of new packets for some
destination address to which it does not currently know a route.
Route Discovery does not depend on any periodic or background
exchange of routing information or neighbor node detection at any
layer in the network protocol stack at any node.
The Route Discovery procedure utilizes two types of messages, a Route
Request (Section 6.2) and a Route Reply (Section 6.3), to actively
search the ad hoc network for a route to the desired target
destination. These DSR messages MAY be carried in any type of IP
packet, through use of the DSR Options header as described in Section
6.
Except as discussed in Section 8.3.5, a Route Discovery for a
destination address SHOULD NOT be initiated unless the initiating
node has a packet in its Send Buffer requiring delivery to that
destination. A Route Discovery for a given target node MUST NOT be
initiated unless permitted by the rate-limiting information contained
in the Route Request Table. After each Route Discovery attempt, the
interval between successive Route Discoveries for this target SHOULD
be doubled, up to a maximum of MaxRequestPeriod, until a valid Route
Reply is received for this target.
Johnson, et al. Experimental [Page 64]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.2.1. Originating a Route Request
A node initiating a Route Discovery for some target creates and
initializes a Route Request option in a DSR Options header in some IP
packet. This MAY be a separate IP packet, used only to carry this
Route Request option, or the node MAY include the Route Request
option in some existing packet that it needs to send to the target
node (e.g., the IP packet originated by this node that caused the
node to attempt Route Discovery for the destination address of the
packet). The Route Request option MUST be included in a DSR Options
header in the packet. To initialize the Route Request option, the
node performs the following sequence of steps:
- The Option Type in the option MUST be set to the value 2.
- The Opt Data Len field in the option MUST be set to the value 6.
The total size of the Route Request option, when initiated, is 8
octets; the Opt Data Len field excludes the size of the Option
Type and Opt Data Len fields themselves.
- The Identification field in the option MUST be set to a new value,
different from that used for other Route Requests recently
initiated by this node for this same target address. For example,
each node MAY maintain a single counter value for generating a new
Identification value for each Route Request it initiates.
- The Target Address field in the option MUST be set to the IP
address that is the target of this Route Discovery.
The Source Address in the IP header of this packet MUST be the node's
own IP address. The Destination Address in the IP header of this
packet MUST be the IP "limited broadcast" address (255.255.255.255).
A node MUST maintain, in its Route Request Table, information about
Route Requests that it initiates. When initiating a new Route
Request, the node MUST use the information recorded in the Route
Request Table entry for the target of that Route Request, and it MUST
update that information in the table entry for use in the next Route
Request initiated for this target. In particular:
- The Route Request Table entry for a target node records the Time-
to-Live (TTL) field used in the IP header of the Route Request for
the last Route Discovery initiated by this node for that target
node. This value allows the node to implement a variety of
algorithms for controlling the spread of its Route Request on each
Route Discovery initiated for a target. As examples, two possible
algorithms for this use of the TTL field are described in Section
3.3.3.
Johnson, et al. Experimental [Page 65]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- The Route Request Table entry for a target node records the number
of consecutive Route Requests initiated for this target since
receiving a valid Route Reply giving a route to that target node,
and the remaining amount of time before which this node MAY next
attempt at a Route Discovery for that target node.
A node MUST use these values to implement a back-off algorithm to
limit the rate at which this node initiates new Route Discoveries
for the same target address. In particular, until a valid Route
Reply is received for this target node address, the timeout
between consecutive Route Discovery initiations for this target
node with the same hop limit SHOULD increase by doubling the
timeout value on each new initiation.
The behavior of a node processing a packet containing DSR Options
header with both a DSR Source Route option and a Route Request option
is unspecified. Packets SHOULD NOT contain both a DSR Source Route
option and a Route Request option.
Packets containing a Route Request option SHOULD NOT include an
Acknowledgement Request option, SHOULD NOT expect link-layer
acknowledgement or passive acknowledgement, and SHOULD NOT be
retransmitted. The retransmission of packets containing a Route
Request option is controlled solely by the logic described in this
section.
8.2.2. Processing a Received Route Request Option
When a node receives a packet containing a Route Request option, that
node MUST process the option according to the following sequence of
steps:
- If the Target Address field in the Route Request matches this
node's own IP address, then the node SHOULD return a Route Reply
to the initiator of this Route Request (the Source Address in the
IP header of the packet), as described in Section 8.2.4. The
source route for this Reply is the sequence of hop addresses
initiator, Address[1], Address[2], ..., Address[n], target
where initiator is the address of the initiator of this Route
Request, each Address[i] is an address from the Route Request, and
target is the target of the Route Request (the Target Address
field in the Route Request). The value n here is the number of
addresses recorded in the Route Request, or
(Opt Data Len - 6) / 4.
Johnson, et al. Experimental [Page 66]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
The node then MUST replace the Destination Address field in the
Route Request packet's IP header with the value in the Target
Address field in the Route Request option, and continue processing
the rest of the Route Request packet normally. The node MUST NOT
process the Route Request option further and MUST NOT retransmit
the Route Request to propagate it to other nodes as part of the
Route Discovery.
- Else, the node MUST examine the route recorded in the Route
Request option (the IP Source Address field and the sequence of
Address[i] fields) to determine if this node's own IP address
already appears in this list of addresses. If so, the node MUST
discard the entire packet carrying the Route Request option.
- Else, if the Route Request was received through a network
interface that requires physically bidirectional links for unicast
transmission, the node MUST check if the Route Request was last
forwarded by a node on its blacklist (Section 4.6). If such an
entry is found in the blacklist, and the state of the
unidirectional link is "probable", then the Request MUST be
silently discarded.
- Else, if the Route Request was received through a network
interface that requires physically bidirectional links for unicast
transmission, the node MUST check if the Route Request was last
forwarded by a node on its blacklist. If such an entry is found
in the blacklist, and the state of the unidirectional link is
"questionable", then the node MUST create and unicast a Route
Request packet to that previous node, setting the IP Time-To-Live
(TTL) to 1 to prevent the Request from being propagated. If the
node receives a Route Reply in response to the new Request, it
MUST remove the blacklist entry for that node, and SHOULD continue
processing. If the node does not receive a Route Reply within
some reasonable amount of time, the node MUST silently discard the
Route Request packet.
- Else, the node MUST search its Route Request Table for an entry
for the initiator of this Route Request (the IP Source Address
field). If such an entry is found in the table, the node MUST
search the cache of Identification values of recently received
Route Requests in that table entry, to determine if an entry is
present in the cache matching the Identification value and target
node address in this Route Request. If such an (Identification,
target address) entry is found in this cache in this entry in the
Route Request Table, then the node MUST discard the entire packet
carrying the Route Request option.
Johnson, et al. Experimental [Page 67]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Else, this node SHOULD further process the Route Request according
to the following sequence of steps:
o Add an entry for this Route Request in its cache of
(Identification, target address) values of recently received
Route Requests.
o Conceptually create a copy of this entire packet and perform
the following steps on the copy of the packet.
o Append this node's own IP address to the list of Address[i]
values in the Route Request and increase the value of the Opt
Data Len field in the Route Request by 4 (the size of an IP
address). However, if the node has multiple network
interfaces, this step MUST be modified by the special
processing specified in Section 8.4.
o This node SHOULD search its own Route Cache for a route (from
itself, as if it were the source of a packet) to the target of
this Route Request. If such a route is found in its Route
Cache, then this node SHOULD follow the procedure outlined in
Section 8.2.3 to return a "cached Route Reply" to the initiator
of this Route Request, if permitted by the restrictions
specified there.
o If the node does not return a cached Route Reply, then this
node SHOULD transmit this copy of the packet as a link-layer
broadcast, with a short jitter delay before the broadcast is
sent. The jitter period SHOULD be chosen as a random period,
uniformly distributed between 0 and BroadcastJitter.
8.2.3. Generating a Route Reply Using the Route Cache
As described in Section 3.3.2, it is possible for a node processing a
received Route Request to avoid propagating the Route Request further
toward the target of the Request, if this node has in its Route Cache
a route from itself to this target. Such a Route Reply generated by
a node from its own cached route to the target of a Route Request is
called a "cached Route Reply", and this mechanism can greatly reduce
the overall overhead of Route Discovery on the network by reducing
the flood of Route Requests. The general processing of a received
Route Request is described in Section 8.2.2; this section specifies
the additional requirements that MUST be met before a cached Route
Reply may be generated and returned and specifies the procedure for
returning such a cached Route Reply.
Johnson, et al. Experimental [Page 68]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
While processing a received Route Request, for a node to possibly
return a cached Route Reply, it MUST have in its Route Cache a route
from itself to the target of this Route Request. However, before
generating a cached Route Reply for this Route Request, the node MUST
verify that there are no duplicate addresses listed in the route
accumulated in the Route Request together with the route from this
node's Route Cache. Specifically, there MUST be no duplicates among
the following addresses:
- The IP Source Address of the packet containing the Route Request,
- The Address[i] fields in the Route Request, and
- The nodes listed in the route obtained from this node's Route
Cache, excluding the address of this node itself (this node itself
is the common point between the route accumulated in the Route
Request and the route obtained from the Route Cache).
If any duplicates exist among these addresses, then the node MUST NOT
send a cached Route Reply using this route from the Route Cache (it
is possible that this node has another route in its Route Cache for
which the above restriction on duplicate addresses is met, allowing
the node to send a cached Route Reply based on that cached route,
instead). The node SHOULD continue to process the Route Request as
described in Section 8.2.2 if it does not send a cached Route Reply.
If the Route Request and the route from the Route Cache meet the
restriction above, then the node SHOULD construct and return a cached
Route Reply as follows:
- The source route for this Route Reply is the sequence of hop
addresses
initiator, Address[1], Address[2], ..., Address[n], c-route
where initiator is the address of the initiator of this Route
Request, each Address[i] is an address from the Route Request, and
c-route is the sequence of hop addresses in the source route to
this target node, obtained from the node's Route Cache. In
appending this cached route to the source route for the reply, the
address of this node itself MUST be excluded, since it is already
listed as Address[n].
- Send a Route Reply to the initiator of the Route Request, using
the procedure defined in Section 8.2.4. The initiator of the
Route Request is indicated in the Source Address field in the
packet's IP header.
Johnson, et al. Experimental [Page 69]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Before sending the cached Route Reply, however, the node MAY delay
the Reply in order to help prevent a possible Route Reply "storm", as
described in Section 8.2.5.
If the node returns a cached Route Reply as described above, then the
node MUST NOT propagate the Route Request further (i.e., the node
MUST NOT rebroadcast the Route Request). In this case, instead, if
the packet contains no other DSR options and contains no payload
after the DSR Options header (e.g., the Route Request is not
piggybacked on a TCP or UDP packet), then the node SHOULD simply
discard the packet. Otherwise (if the packet contains other DSR
options or contains any payload after the DSR Options header), the
node SHOULD forward the packet along the cached route to the target
of the Route Request. Specifically, if the node does so, it MUST use
the following steps:
- Copy the Target Address from the Route Request option in the DSR
Options header to the Destination Address field in the packet's IP
header.
- Remove the Route Request option from the DSR Options header in the
packet, and add a DSR Source Route option to the packet's DSR
Options header.
- In the DSR Source Route option, set the Address[i] fields to
represent the source route found in this node's Route Cache to the
original target of the Route Discovery (the new IP Destination
Address of the packet). Specifically, the node copies the hop
addresses of the source route into sequential Address[i] fields in
the DSR Source Route option, for i = 1, 2, ..., n. Address[1],
here, is the address of this node itself (the first address in the
source route found from this node to the original target of the
Route Discovery). The value n, here, is the number of hop
addresses in this source route, excluding the destination of the
packet (which is instead already represented in the Destination
Address field in the packet's IP header).
- Initialize the Segments Left field in the DSR Source Route option
to n as defined above.
- The First Hop External (F) bit in the DSR Source Route option MUST
be set to 0.
- The Last Hop External (L) bit in the DSR Source Route option is
copied from the External bit flagging the last hop in the source
route for the packet, as indicated in the Route Cache.
Johnson, et al. Experimental [Page 70]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- The Salvage field in the DSR Source Route option MUST be
initialized to some nonzero value; the particular nonzero value
used SHOULD be MAX_SALVAGE_COUNT. By initializing this field to a
nonzero value, nodes forwarding or overhearing this packet will
not consider a link to exist between the IP Source Address of the
packet and the Address[1] address in the DSR Source Route option
(e.g., they will not attempt to add this to their Route Cache as a
link). By choosing MAX_SALVAGE_COUNT as the nonzero value to
which the node initializes this field, nodes furthermore will not
attempt to salvage this packet.
- Transmit the packet to the next-hop node on the new source route
in the packet, using the forwarding procedure described in Section
8.1.5.
8.2.4. Originating a Route Reply
A node originates a Route Reply in order to reply to a received and
processed Route Request, according to the procedures described in
Sections 8.2.2 and 8.2.3. The Route Reply is returned in a Route
Reply option (Section 6.3). The Route Reply option MAY be returned
to the initiator of the Route Request in a separate IP packet, used
only to carry this Route Reply option, or it MAY be included in any
other IP packet being sent to this address.
The Route Reply option MUST be included in a DSR Options header in
the packet returned to the initiator. To initialize the Route Reply
option, the node performs the following sequence of steps:
- The Option Type in the option MUST be set to the value 3.
- The Opt Data Len field in the option MUST be set to the value
(n * 4) + 3, where n is the number of addresses in the source
route being returned (excluding the Route Discovery initiator
node's address).
- If this node is the target of the Route Request, the Last Hop
External (L) bit in the option MUST be initialized to 0.
- The Reserved field in the option MUST be initialized to 0.
- The Route Request Identifier MUST be initialized to the Identifier
field of the Route Request to which this Route Reply is sent in
response.
- The sequence of hop addresses in the source route are copied into
the Address[i] fields of the option. Address[1] MUST be set to
the first-hop address of the route after the initiator of the
Johnson, et al. Experimental [Page 71]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Route Discovery, Address[n] MUST be set to the last-hop address of
the source route (the address of the target node), and each other
Address[i] MUST be set to the next address in sequence in the
source route being returned.
The Destination Address field in the IP header of the packet carrying
the Route Reply option MUST be set to the address of the initiator of
the Route Discovery (i.e., for a Route Reply being returned in
response to some Route Request, the IP Source Address of the Route
Request).
After creating and initializing the Route Reply option and the IP
packet containing it, send the Route Reply. In sending the Route
Reply from this node (but not from nodes forwarding the Route Reply),
this node SHOULD delay the Reply by a small jitter period chosen
randomly between 0 and BroadcastJitter.
When returning any Route Reply in the case in which the MAC protocol
in use in the network is not capable of transmitting unicast packets
over unidirectional links, the source route used for routing the
Route Reply packet MUST be obtained by reversing the sequence of hops
in the Route Request packet (the source route that is then returned
in the Route Reply). This restriction on returning a Route Reply
enables the Route Reply to test this sequence of hops for
bidirectionality, preventing the Route Reply from being received by
the initiator of the Route Discovery unless each of the hops over
which the Route Reply is returned (and thus each of the hops in the
source route being returned in the Reply) is bidirectional.
If sending a Route Reply to the initiator of the Route Request
requires performing a Route Discovery, the Route Reply option MUST be
piggybacked on the packet that contains the Route Request. This
piggybacking prevents a recursive dependency wherein the target of
the new Route Request (which was itself the initiator of the original
Route Request) must do another Route Request in order to return its
Route Reply.
If sending the Route Reply to the initiator of the Route Request does
not require performing a Route Discovery, a node SHOULD send a
unicast Route Reply in response to every Route Request it receives
for which it is the target node.
8.2.5. Preventing Route Reply Storms
The ability for nodes to reply to a Route Request based on
information in their Route Caches, as described in Sections 3.3.2 and
8.2.3, could result in a possible Route Reply "storm" in some cases.
In particular, if a node broadcasts a Route Request for a target node
Johnson, et al. Experimental [Page 72]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
for which the node's neighbors have a route in their Route Caches,
each neighbor may attempt to send a Route Reply, thereby wasting
bandwidth and possibly increasing the number of network collisions in
the area.
For example, the figure below shows a situation in which nodes B, C,
D, E, and F all receive A's Route Request for target G, and each has
the indicated route cached for this target:
+-----+ +-----+
| D |< >| C |
+-----+ \ / +-----+
Cache: C - B - G \ / Cache: B - G
\ +-----+ /
-| A |-
+-----+\ +-----+ +-----+
| | \--->| B | | G |
/ \ +-----+ +-----+
/ \ Cache: G
v v
+-----+ +-----+
| E | | F |
+-----+ +-----+
Cache: F - B - G Cache: B - G
Normally, each of these nodes would attempt to reply from its own
Route Cache, and they would thus all send their Route Replies at
about the same time, since they all received the broadcast Route
Request at about the same time. Such simultaneous Route Replies from
different nodes all receiving the Route Request may cause local
congestion in the wireless network and may create packet collisions
among some or all of these Replies if the MAC protocol in use does
not provide sufficient collision avoidance for these packets. In
addition, it will often be the case that the different replies will
indicate routes of different lengths, as shown in this example.
In order to reduce these effects, if a node can put its network
interface into promiscuous receive mode, it MAY delay sending its own
Route Reply for a short period, while listening to see if the
initiating node begins using a shorter route first. Specifically,
this node MAY delay sending its own Route Reply for a random period
d = H * (h - 1 + r)
where h is the length in number of network hops for the route to be
returned in this node's Route Reply, r is a random floating point
number between 0 and 1, and H is a small constant delay (at least
twice the maximum wireless link propagation delay) to be introduced
Johnson, et al. Experimental [Page 73]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
per hop. This delay effectively randomizes the time at which each
node sends its Route Reply, with all nodes sending Route Replies
giving routes of length less than h sending their Replies before this
node, and all nodes sending Route Replies giving routes of length
greater than h send their Replies after this node.
Within the delay period, this node promiscuously receives all
packets, looking for data packets from the initiator of this Route
Discovery destined for the target of the Route Discovery. If such a
data packet received by this node during the delay period uses a
source route of length less than or equal to h, this node may infer
that the initiator of the Route Discovery has already received a
Route Reply giving an equally good or better route. In this case,
this node SHOULD cancel its delay timer and SHOULD NOT send its Route
Reply for this Route Discovery.
8.2.6. Processing a Received Route Reply Option
Section 8.1.4 describes the general processing for a received packet,
including the addition of routing information from options in the
packet's DSR Options header to the receiving node's Route Cache.
If the received packet contains a Route Reply, no additional special
processing of the Route Reply option is required beyond what is
described there. As described in Section 4.1, anytime a node adds
new information to its Route Cache (including the information added
from this Route Reply option), the node SHOULD check each packet in
its own Send Buffer (Section 4.2) to determine whether a route to
that packet's IP Destination Address now exists in the node's Route
Cache (including the information just added to the Cache). If so,
the packet SHOULD then be sent using that route and removed from the
Send Buffer. This general procedure handles all processing required
for a received Route Reply option.
When using a MAC protocol that requires bidirectional links for
unicast transmission, a unidirectional link may be discovered by the
propagation of the Route Request. When the Route Reply is sent over
the reverse path, a forwarding node may discover that the next-hop is
unreachable. In this case, it MUST add the next-hop address to its
blacklist (Section 4.6).
8.3. Route Maintenance Processing
Route Maintenance is the mechanism by which a source node S is able
to detect, while using a source route to some destination node D, if
the network topology has changed such that it can no longer use its
route to D because a link along the route no longer works. When
Route Maintenance indicates that a source route is broken, S can
Johnson, et al. Experimental [Page 74]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
attempt to use any other route it happens to know to D or can invoke
Route Discovery again to find a new route for subsequent packets to
D. Route Maintenance for this route is used only when S is actually
sending packets to D.
Specifically, when forwarding a packet, a node MUST attempt to
confirm the reachability of the next-hop node, unless such
confirmation had been received in the last MaintHoldoffTime period.
Individual implementations MAY choose to bypass such confirmation for
some limited number of packets, as long as those packets all fall
within MaintHoldoffTime since the last confirmation. If no
confirmation is received after the retransmission of MaxMaintRexmt
acknowledgement requests, after the initial transmission of the
packet, and conceptually including all retransmissions provided by
the MAC layer, the node determines that the link for this next-hop
node of the source route is "broken". This confirmation from the
next-hop node for Route Maintenance can be implemented using a link-
layer acknowledgement (Section 8.3.1), a "passive acknowledgement"
(Section 8.3.2), or a network-layer acknowledgement (Section 8.3.3);
the particular strategy for retransmission timing depends on the type
of acknowledgement mechanism used. When not using link-layer
acknowledgements for Route Maintenance, nodes SHOULD use passive
acknowledgements when possible but SHOULD try requesting a network-
layer acknowledgement one or more times before deciding that the link
has failed and originating a Route Error to the original sender of
the packet, as described in Section 8.3.4.
In deciding whether or not to send a Route Error in response to
attempting to forward a packet from some sender over a broken link, a
node MUST limit the number of consecutive packets from a single
sender that the node attempts to forward over this same broken link
for which the node chooses not to return a Route Error. This
requirement MAY be satisfied by returning a Route Error for each
packet that the node attempts to forward over a broken link.
8.3.1. Using Link-Layer Acknowledgements
If the MAC protocol in use provides feedback as to the successful
delivery of a data packet (such as is provided for unicast packets by
the link-layer acknowledgement frame defined by IEEE 802.11
[IEEE80211]), then the use of the DSR Acknowledgement Request and
Acknowledgement options is not necessary. If such link-layer
feedback is available, it SHOULD be used instead of any other
acknowledgement mechanism for Route Maintenance, and the node SHOULD
NOT use either passive acknowledgements or network-layer
acknowledgements for Route Maintenance.
Johnson, et al. Experimental [Page 75]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
When using link-layer acknowledgements for Route Maintenance, the
retransmission timing and the timing at which retransmission attempts
are scheduled are generally controlled by the particular link layer
implementation in use in the network. For example, in IEEE 802.11,
the link-layer acknowledgement is returned after a unicast packet as
a part of the basic access method of the IEEE 802.11 Distributed
Coordination Function (DCF) MAC protocol; the time at which the
acknowledgement is expected to arrive and the time at which the next
retransmission attempt (if necessary) will occur are controlled by
the MAC protocol implementation.
When a node receives a link-layer acknowledgement for any packet in
its Maintenance Buffer, that node SHOULD remove from its Maintenance
Buffer that packet, as well as any other packets in its Maintenance
Buffer with the same next-hop destination.
8.3.2. Using Passive Acknowledgements
When link-layer acknowledgements are not available, but passive
acknowledgements [JUBIN87] are available, passive acknowledgements
SHOULD be used for Route Maintenance when originating or forwarding a
packet along any hop other than the last hop (the hop leading to the
IP Destination Address node of the packet). In particular, passive
acknowledgements SHOULD be used for Route Maintenance in such cases
if the node can place its network interface into "promiscuous"
receive mode, and if network links used for data packets generally
operate bidirectionally.
A node MUST NOT attempt to use passive acknowledgements for Route
Maintenance for a packet originated or forwarded over its last hop
(the hop leading to the IP Destination Address node of the packet),
since the receiving node will not be forwarding the packet and thus
no passive acknowledgement will be available to be heard by this
node. Beyond this restriction, a node MAY utilize a variety of
strategies in using passive acknowledgements for Route Maintenance of
a packet that it originates or forwards. For example, the following
two strategies are possible:
- Each time a node receives a packet to be forwarded to a node other
than the final destination (the IP Destination Address of the
packet), that node sends the original transmission of that packet
without requesting a network-layer acknowledgement for it. If no
passive acknowledgement is received within PassiveAckTimeout after
this transmission, the node retransmits the packet, again without
requesting a network-layer acknowledgement for it; the same
PassiveAckTimeout timeout value is used for each such attempt. If
no acknowledgement has been received after a total of
TryPassiveAcks retransmissions of the packet, network-layer
Johnson, et al. Experimental [Page 76]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
acknowledgements (as described in Section 8.3.3) are requested for
all remaining attempts for that packet.
- Each node maintains a table of possible next-hop destination
nodes, noting whether or not passive acknowledgements can
typically be expected from transmission to that node, and the
expected latency and jitter of a passive acknowledgement from that
node. Each time a node receives a packet to be forwarded to a
node other than the IP Destination Address, the node checks its
table of next-hop destination nodes to determine whether to use a
passive acknowledgement or a network-layer acknowledgement for
that transmission to that node. The timeout for this packet can
also be derived from this table. A node using this method SHOULD
prefer using passive acknowledgements to network-layer
acknowledgements.
In using passive acknowledgements for a packet that it originates or
forwards, a node considers the later receipt of a new packet (e.g.,
with promiscuous receive mode enabled on its network interface) an
acknowledgement of this first packet if both of the following two
tests succeed:
- The Source Address, Destination Address, Protocol, Identification,
and Fragment Offset fields in the IP header of the two packets
MUST match [RFC791].
- If either packet contains a DSR Source Route header, both packets
MUST contain one, and the value in the Segments Left field in the
DSR Source Route header of the new packet MUST be less than that
in the first packet.
When a node hears such a passive acknowledgement for any packet in
its Maintenance Buffer, that node SHOULD remove from its Maintenance
Buffer that packet, as well as any other packets in its Maintenance
Buffer with the same next-hop destination.
8.3.3. Using Network-Layer Acknowledgements
When a node originates or forwards a packet and has no other
mechanism of acknowledgement available to determine reachability of
the next-hop node in the source route for Route Maintenance, that
node SHOULD request a network-layer acknowledgement from that next-
hop node. To do so, the node inserts an Acknowledgement Request
option in the DSR Options header in the packet. The Identification
field in that Acknowledgement Request option MUST be set to a value
unique over all packets recently transmitted by this node to the same
next-hop node.
Johnson, et al. Experimental [Page 77]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
When a node receives a packet containing an Acknowledgement Request
option, that node performs the following tests on the packet:
- If the indicated next-hop node address for this packet does not
match any of this node's own IP addresses, then this node MUST NOT
process the Acknowledgement Request option. The indicated next-
hop node address is the next Address[i] field in the DSR Source
Route option in the DSR Options header in the packet, or the IP
Destination Address in the packet if the packet does not contain a
DSR Source Route option or the Segments Left there is zero.
- If the packet contains an Acknowledgement option, then this node
MUST NOT process the Acknowledgement Request option.
If neither of the tests above fails, then this node MUST process the
Acknowledgement Request option by sending an Acknowledgement option
to the previous-hop node; to do so, the node performs the following
sequence of steps:
- Create a packet and set the IP Protocol field to the protocol
number assigned for DSR (48).
- Set the IP Source Address field in this packet to the IP address
of this node, copied from the source route in the DSR Source Route
option in that packet (or from the IP Destination Address field of
the packet, if the packet does not contain a DSR Source Route
option).
- Set the IP Destination Address field in this packet to the IP
address of the previous-hop node, copied from the source route in
the DSR Source Route option in that packet (or from the IP Source
Address field of the packet, if the packet does not contain a DSR
Source Route option).
- Add a DSR Options header to the packet. Set the Next Header field
in the DSR Options header to the value 59, "No Next Header"
[RFC2460].
- Add an Acknowledgement option to the DSR Options header in the
packet; set the Acknowledgement option's Option Type field to 6
and the Opt Data Len field to 10.
- Copy the Identification field from the received Acknowledgement
Request option into the Identification field in the
Acknowledgement option.
Johnson, et al. Experimental [Page 78]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Set the ACK Source Address field in the Acknowledgement option to
be the IP Source Address of this new packet (set above to be the
IP address of this node).
- Set the ACK Destination Address field in the Acknowledgement
option to be the IP Destination Address of this new packet (set
above to be the IP address of the previous-hop node).
- Send the packet as described in Section 8.1.1.
Packets containing an Acknowledgement option SHOULD NOT be placed in
the Maintenance Buffer.
When a node receives a packet with both an Acknowledgement option and
an Acknowledgement Request option, if that node is not the
destination of the Acknowledgement option (the IP Destination Address
of the packet), then the Acknowledgement Request option MUST be
ignored. Otherwise (that node is the destination of the
Acknowledgement option), that node MUST process the Acknowledgement
Request option by returning an Acknowledgement option according to
the following sequence of steps:
- Create a packet and set the IP Protocol field to the protocol
number assigned for DSR (48).
- Set the IP Source Address field in this packet to the IP address
of this node, copied from the source route in the DSR Source Route
option in that packet (or from the IP Destination Address field of
the packet, if the packet does not contain a DSR Source Route
option).
- Set the IP Destination Address field in this packet to the IP
address of the node originating the Acknowledgement option.
- Add a DSR Options header to the packet, and set the DSR Options
header's Next Header field to the value 59, "No Next Header"
[RFC2460].
- Add an Acknowledgement option to the DSR Options header in this
packet; set the Acknowledgement option's Option Type field to 6
and the Opt Data Len field to 10.
- Copy the Identification field from the received Acknowledgement
Request option into the Identification field in the
Acknowledgement option.
Johnson, et al. Experimental [Page 79]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Set the ACK Source Address field in the option to the IP Source
Address of this new packet (set above to be the IP address of this
node).
- Set the ACK Destination Address field in the option to the IP
Destination Address of this new packet (set above to be the IP
address of the node originating the Acknowledgement option).
- Send the packet directly to the destination. The IP Destination
Address MUST be treated as a direct neighbor node: the
transmission to that node MUST be done in a single IP forwarding
hop, without Route Discovery and without searching the Route
Cache. In addition, this packet MUST NOT contain a DSR
Acknowledgement Request, MUST NOT be retransmitted for Route
Maintenance, and MUST NOT expect a link-layer acknowledgement or
passive acknowledgement.
When using network-layer acknowledgements for Route Maintenance, a
node SHOULD use an adaptive algorithm in determining the
retransmission timeout for each transmission attempt of an
acknowledgement request. For example, a node SHOULD maintain a
separate round-trip time (RTT) estimate for each node to which it has
recently attempted to transmit packets, and it SHOULD use this RTT
estimate in setting the timeout for each retransmission attempt for
Route Maintenance. The TCP RTT estimation algorithm has been shown
to work well for this purpose in implementation and testbed
experiments with DSR [MALTZ99b, MALTZ01].
8.3.4. Originating a Route Error
When a node is unable to verify reachability of a next-hop node after
reaching a maximum number of retransmission attempts, it SHOULD send
a Route Error to the IP Source Address of the packet. When sending a
Route Error for a packet containing either a Route Error option or an
Acknowledgement option, a node SHOULD add these existing options to
its Route Error, subject to the limit described below.
A node transmitting a Route Error MUST perform the following steps:
- Create an IP packet and set the IP Protocol field to the protocol
number assigned for DSR (48). Set the Source Address field in
this packet's IP header to the address of this node.
- If the Salvage field in the DSR Source Route option in the packet
triggering the Route Error is zero, then copy the Source Address
field of the packet triggering the Route Error into the
Destination Address field in the new packet's IP header;
Johnson, et al. Experimental [Page 80]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
otherwise, copy the Address[1] field from the DSR Source Route
option of the packet triggering the Route Error into the
Destination Address field in the new packet's IP header
- Insert a DSR Options header into the new packet.
- Add a Route Error Option to the new packet, setting the Error Type
to NODE_UNREACHABLE, the Salvage value to the Salvage value from
the DSR Source Route option of the packet triggering the Route
Error, and the Unreachable Node Address field to the address of
the next-hop node from the original source route. Set the Error
Source Address field to this node's IP address, and the Error
Destination field to the new packet's IP Destination Address.
- If the packet triggering the Route Error contains any Route Error
or Acknowledgement options, the node MAY append to its Route Error
each of these options, with the following constraints:
o The node MUST NOT include any Route Error option from the
packet triggering the new Route Error, for which the total
Salvage count (Section 6.4) of that included Route Error would
be greater than MAX_SALVAGE_COUNT in the new packet.
o If any Route Error option from the packet triggering the new
Route Error is not included in the packet, the node MUST NOT
include any following Route Error or Acknowledgement options
from the packet triggering the new Route Error.
o Any appended options from the packet triggering the Route Error
MUST follow the new Route Error in the packet.
o In appending these options to the new Route Error, the order of
these options from the packet triggering the Route Error MUST
be preserved.
- Send the packet as described in Section 8.1.1.
8.3.5. Processing a Received Route Error Option
When a node receives a packet containing a Route Error option, that
node MUST process the Route Error option according to the following
sequence of steps:
- The node MUST remove from its Route Cache the link from the node
identified by the Error Source Address field to the node
identified by the Unreachable Node Address field (if this link is
present in its Route Cache). If the node implements its Route
Cache as a link cache, as described in Section 4.1, only this
Johnson, et al. Experimental [Page 81]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
single link is removed; if the node implements its Route Cache as
a path cache, however, all routes (paths) that use this link are
either truncated before the link or removed completely.
- If the option following the Route Error is an Acknowledgement or
Route Error option sent by this node (that is, with
Acknowledgement or Error Source Address equal to this node's
address), copy the DSR options following the current Route Error
into a new packet with IP Source Address equal to this node's own
IP address and IP Destination Address equal to the Acknowledgement
or Error Destination Address. Transmit this packet as described
in Section 8.1.1, with the Salvage count in the DSR Source Route
option set to the Salvage value of the Route Error.
In addition, after processing the Route Error as described above, the
node MAY initiate a new Route Discovery for any destination node for
which it then has no route in its Route Cache as a result of
processing this Route Error, if the node has indication that a route
to that destination is needed. For example, if the node has an open
TCP connection to some destination node, then if the processing of
this Route Error removed the only route to that destination from this
node's Route Cache, then this node MAY initiate a new Route Discovery
for that destination node. Any node, however, MUST limit the rate at
which it initiates new Route Discoveries for any single destination
address, and any new Route Discovery initiated in this way as part of
processing this Route Error MUST conform as a part of this limit.
8.3.6. Salvaging a Packet
When an intermediate node forwarding a packet detects through Route
Maintenance that the next-hop link along the route for that packet is
broken (Section 8.3), if the node has another route to the packet's
IP Destination Address in its Route Cache, the node SHOULD "salvage"
the packet rather than discard it. To do so using the route found in
its Route Cache, this node processes the packet as follows:
- If the MAC protocol in use in the network is not capable of
transmitting unicast packets over unidirectional links, as
discussed in Section 3.3.1, then if this packet contains a Route
Reply option, remove and discard the Route Reply option in the
packet; if the DSR Options header in the packet then contains no
DSR options or only a DSR Source Route Option, remove the DSR
Options header from the packet. If the resulting packet then
contains only an IP header (e.g., no transport layer header or
payload), the node SHOULD NOT salvage the packet and instead
SHOULD discard the entire packet.
Johnson, et al. Experimental [Page 82]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Modify the existing DSR Source Route option in the packet so that
the Address[i] fields represent the source route found in this
node's Route Cache to this packet's IP Destination Address.
Specifically, the node copies the hop addresses of the source
route into sequential Address[i] fields in the DSR Source Route
option, for i = 1, 2, ..., n. Address[1], here, is the address of
the salvaging node itself (the first address in the source route
found from this node to the IP Destination Address of the packet).
The value n, here, is the number of hop addresses in this source
route, excluding the destination of the packet (which is instead
already represented in the Destination Address field in the
packet's IP header).
- Initialize the Segments Left field in the DSR Source Route option
to n as defined above.
- The First Hop External (F) bit in the DSR Source Route option MUST
be set to 0.
- The Last Hop External (L) bit in the DSR Source Route option is
copied from the External bit flagging the last hop in the source
route for the packet, as indicated in the Route Cache.
- The Salvage field in the DSR Source Route option is set to 1 plus
the value of the Salvage field in the DSR Source Route option of
the packet that caused the error.
- Transmit the packet to the next-hop node on the new source route
in the packet, using the forwarding procedure described in Section
8.1.5.
As described in Section 8.3.4, the node in this case also SHOULD
return a Route Error to the original sender of the packet. If the
node chooses to salvage the packet, it SHOULD do so after originating
the Route Error.
When returning any Route Reply in the case in which the MAC protocol
in use in the network is not capable of transmitting unicast packets
over unidirectional links, the source route used for routing the
Route Reply packet MUST be obtained by reversing the sequence of hops
in the Route Request packet (the source route that is then returned
in the Route Reply). This restriction on returning a Route Reply and
on salvaging a packet that contains a Route Reply option enables the
Route Reply to test this sequence of hops for bidirectionality,
preventing the Route Reply from being received by the initiator of
the Route Discovery unless each of the hops over which the Route
Reply is returned (and thus each of the hops in the source route
being returned in the Reply) is bidirectional.
Johnson, et al. Experimental [Page 83]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.4. Multiple Network Interface Support
A node using DSR MAY have multiple network interfaces that support
DSR ad hoc network routing. This section describes special packet
processing at such nodes.
A node with multiple network interfaces that support DSR ad hoc
network routing MUST have some policy for determining which Route
Request packets are forwarded using which network interfaces. For
example, a node MAY choose to forward all Route Requests over all
network interfaces.
When a node with multiple network interfaces that support DSR
propagates a Route Request on a network interface other than the one
on which it received the Route Request, it MUST in this special case
modify the Address list in the Route Request as follows:
- Append the node's IP address for the incoming network interface.
- Append the node's IP address for the outgoing network interface.
When a node forwards a packet containing a source route, it MUST
assume that the next-hop node is reachable on the incoming network
interface, unless the next hop is the address of one of this node's
network interfaces, in which case this node MUST skip over this
address in the source route and process the packet in the same way as
if it had just received it from that network interface, as described
in Section 8.1.5.
If a node that previously had multiple network interfaces that
support DSR receives a packet sent with a source route specifying a
change to a network interface, as described above, that is no longer
available, it MAY send a Route Error to the source of the packet
without attempting to forward the packet on the incoming network
interface, unless the network uses an autoconfiguration mechanism
that may have allowed another node to acquire the now unused address
of the unavailable network interface.
8.5. IP Fragmentation and Reassembly
When a node using DSR wishes to fragment a packet that contains a DSR
header not containing a Route Request option, it MUST perform the
following sequence of steps:
- Remove the DSR Options header from the packet.
Johnson, et al. Experimental [Page 84]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
- Fragment the packet using normal IP fragmentation processing
[RFC791]. However, when determining the size of each fragment to
create from the original packet, the fragment size MUST be reduced
by the size of the DSR Options header from the original packet.
- IP-in-IP encapsulate each fragment [RFC2003]. The IP Destination
address of the outer (encapsulating) packet MUST be set equal to
the IP Destination address of the original packet.
- Add the DSR Options header from the original packet to each
resulting encapsulating packet. If a Source Route header is
present in the DSR Options header, increment the Salvage field.
When a node using the DSR protocol receives an IP-in-IP encapsulated
packet destined to itself, it SHOULD decapsulate the packet [RFC2003]
and then process the inner packet according to standard IP reassembly
processing [RFC791].
8.6. Flow State Processing
A node implementing the optional DSR flow state extension MUST follow
these additional processing steps.
8.6.1. Originating a Packet
When originating any packet to be routed using flow state, a node
using DSR flow state MUST do the following:
- If the route to be used for this packet has never had a DSR flow
state established along it (or the existing flow state has
expired):
o Generate a 16-bit Flow ID larger than any unexpired Flow IDs
used by this node for this destination. Odd Flow IDs MUST be
chosen for "default" flows; even Flow IDs MUST be chosen for
non-default flows.
o Add a DSR Options header, as described in Section 8.1.2.
o Add a DSR Flow State header, as described in Section 8.6.2.
o Initialize the Hop Count field in the DSR Flow State header to
0.
o Set the Flow ID field in the DSR Flow State header to the Flow
ID generated in the first step.
o Add a Timeout option to the DSR Options header.
Johnson, et al. Experimental [Page 85]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o Add a Source Route option after the Timeout option with the
route to be used, as described in Section 8.1.3.
o The source node SHOULD record this flow in its Flow Table.
o If this flow is recorded in the Flow Table, the TTL in this
Flow Table entry MUST be set to be the TTL of this flow
establishment packet.
o If this flow is recorded in the Flow Table, the timeout in this
Flow Table entry MUST be set to a value no less than the value
specified in the Timeout option.
- If the route to be used for this packet has had DSR flow state
established along it, but has not been established end-to-end:
o Add a DSR Options header, as described in Section 8.1.2.
o Add a DSR Flow State header, as described in Section 8.6.2.
o Initialize the Hop Count field in the DSR Flow State header to
0.
o The Flow ID field of the DSR Flow State header SHOULD be the
Flow ID previously used for this route. If it is not, the
steps for sending packets along never-before-established routes
above MUST be followed in place of these.
o Add a Timeout option to the DSR Options header, setting the
Timeout to a value not greater than the timeout remaining for
this flow in the Flow Table.
o Add a Source Route option after the Timeout option with the
route to be used, as described in Section 8.1.3.
o If the IP TTL is not equal to the TTL specified in the Flow
Table, the source node MUST set a flag to indicate that this
flow cannot be used as default.
- If the route the node wishes to use for this packet has been
established as a flow end-to-end and is not the default flow:
o Add a DSR Flow State header, as described in Section 8.6.2.
o Initialize the Hop Count field in the DSR Flow State header to
0.
Johnson, et al. Experimental [Page 86]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o The Flow ID field of the DSR Flow State header SHOULD be set to
the Flow ID previously used for this route. If it is not, the
steps for sending packets along never-before-established routes
above MUST be followed in place of these.
o If the next hop requires a network-layer acknowledgement for
Route Maintenance, add a DSR Options header, as described in
Section 8.1.2, and an Acknowledgement Request option, as
described in Section 8.3.3.
o A DSR Options header SHOULD NOT be added to a packet, unless it
is added to carry an Acknowledgement Request option, in which
case:
+ A Source Route option in the DSR Options header SHOULD NOT
be added.
+ If a Source Route option in the DSR Options header is added,
the steps for sending packets along flows not yet
established end-to-end MUST be followed in place of these.
+ A Timeout option SHOULD NOT be added.
+ If a Timeout option is added, it MUST specify a timeout not
greater than the timeout remaining for this flow in the Flow
Table.
- If the route the node wishes to use for this packet has been
established as a flow end-to-end and is the current default flow:
o If the IP TTL is not equal to the TTL specified in the Flow
Table, the source node MUST follow the steps above for sending
a packet along a non-default flow that has been established
end-to-end in place of these steps.
o If the next hop requires a network-layer acknowledgement for
Route Maintenance, the sending node MUST add a DSR Options
header and an Acknowledgement Request option, as described in
Section 8.3.3. The sending node MUST NOT add any additional
options to this header.
o A DSR Options header SHOULD NOT be added, except as specified
in the previous step. If one is added in a way inconsistent
with the previous step, the source node MUST follow the steps
above for sending a packet along a non-default flow that has
been established end-to-end in place of these steps.
Johnson, et al. Experimental [Page 87]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.6.2. Inserting a DSR Flow State Header
A node originating a packet adds a DSR Flow State header to the
packet, if necessary, to carry information needed by the routing
protocol. A packet MUST NOT contain more than one DSR Flow State
header. A DSR Flow State header is added to a packet by performing
the following sequence of steps:
- Insert a DSR Flow State header after the IP header and any Hop-
by-Hop Options header that may already be in the packet, but
before any other header that may be present.
- Set the Next Header field of the DSR Flow State header to the Next
Header field of the previous header (either an IP header or a
Hop-by-Hop Options header).
- Set the Flow (F) bit in the DSR Flow State header to 1.
- Set the Protocol field of the IP header to the protocol number
assigned for DSR (48).
8.6.3. Receiving a Packet
This section describes processing only for packets that are sent to
this processing node as the next-hop node; that is, when the MAC-
layer destination address is the MAC address of this node.
Otherwise, the process described in Sections 8.6.5 should be
followed.
The flow along which a packet is being sent is considered to be in
the Flow Table if the triple (IP Source Address, IP Destination
Address, Flow ID) has an unexpired entry in this node's Flow Table.
When a node using DSR flow state receives a packet, it MUST follow
the following steps for processing:
- If a DSR Flow State header is present, increment the Hop Count
field.
- In addition, if a DSR Flow State header is present, then if the
triple (IP Source Address, IP Destination Address, Flow ID) is in
this node's Automatic Route Shortening Table and the packet is
listed in the entry, then the node MAY send a gratuitous Route
Reply as described in Section 4.4, subject to the rate limiting
specified therein. This gratuitous Route Reply gives the route by
which the packet originally reached this node. Specifically, the
node sending the gratuitous Route Reply constructs the route to
return in the Route Reply as follows:
Johnson, et al. Experimental [Page 88]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o Let k = (packet Hop Count) - (table Hop Count), where packet
Hop Count is the value of the Hop Count field in this received
packet, and table Hop Count is the Hop Count value stored for
this packet in the corresponding entry in this node's Automatic
Route Shortening Table.
o Copy the complete source route for this flow from the
corresponding entry in the node's Flow Table.
o Remove from this route the k hops immediately preceding this
node in the route, since these are the hops "skipped over" by
the packet as recorded in the Automatic Route Shortening Table
entry.
- Process each of the DSR options within the DSR Options header in
order:
o On receiving a Pad1 or PadN option, skip over the option.
o On receiving a Route Request for which this node is the
destination, remove the option and return a Route Reply as
specified in Section 8.2.2.
o On receiving a broadcast Route Request that this node has not
previously seen for which this node is not the destination,
append this node's incoming interface address to the Route
Request, continue propagating the Route Request as specified in
Section 8.2.2, pass the payload, if any, to the network layer,
and stop processing.
o On receiving a Route Request that this node has previously seen
for which this node is not the destination, discard the packet
and stop processing.
o On receiving any Route Request, add appropriate links to the
Route Cache, as specified in Section 8.2.2.
o On receiving a Route Reply for which this node is the
initiator, remove the Route Reply from the packet and process
it as specified in Section 8.2.6.
o On receiving any Route Reply, add appropriate links to the
Route Cache, as specified in Section 8.2.6.
o On receiving any Route Error of type NODE_UNREACHABLE, remove
appropriate links to the Route Cache, as specified in Section
8.3.5.
Johnson, et al. Experimental [Page 89]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o On receiving a Route Error of type NODE_UNREACHABLE that this
node is the Error Destination Address of, remove the Route
Error from the packet and process it as specified in Section
8.3.5. It also MUST stop originating packets along any flows
using the link from Error Source Address to Unreachable Node,
and it MAY remove from its Flow Table any flows using the link
from Error Source Address to Unreachable Node.
o On receiving a Route Error of type UNKNOWN_FLOW that this node
is not the Error Destination Address of, the node checks if the
Route Error corresponds to a flow in its Flow Table. If it
does not, the node silently discards the Route Error;
otherwise, it forwards the packet to the expected previous hop
of the corresponding flow. If Route Maintenance cannot confirm
the reachability of the previous hop, the node checks if the
network interface requires bidirectional links for operation.
If it does, the node silently discards the Route Error;
otherwise, it sends the Error as if it were originating it, as
described in Section 8.1.1.
o On receiving a Route Error of type UNKNOWN_FLOW that this node
is the Error Destination Address of, remove the Route Error
from the packet and mark the flow specified by the triple
(Error Destination Address, Original IP Destination Address,
Flow ID) as not having been established end-to-end.
o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN that
this node is not the Error Destination Address of, the node
checks if the Route Error corresponds to a flow in its Default
Flow Table. If it does not, the node silently discards the
Route Error; otherwise, it forwards the packet to the expected
previous hop of the corresponding flow. If Route Maintenance
cannot confirm the reachability of the previous hop, the node
checks if the network interface requires bidirectional links
for operation. If it does, the node silently discards the
Route Error; otherwise, it sends the Error as if it were
originating it, as described in Section 8.1.1.
o On receiving a Route Error of type DEFAULT_FLOW_UNKNOWN that
this node is the Error Destination Address of, remove the Route
Error from the packet and mark the default flow between the
Error Destination Address and the Original IP Destination
Address as not having been established end-to-end.
Johnson, et al. Experimental [Page 90]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o On receiving an Acknowledgement Request option, the receiving
node removes the Acknowledgement Request option and replies to
the previous hop with an Acknowledgement option. If the
previous hop cannot be determined, the Acknowledgement Request
option is discarded, and processing continues.
o On receiving an Acknowledgement option, the receiving node
removes the Acknowledgement option and processes it.
o On receiving any Acknowledgement option, add the appropriate
link to the Route Cache, as specified in Section 8.1.4.
o On receiving any Source Route option, add appropriate links to
the Route Cache, as specified in Section 8.1.4.
o On receiving a Source Route option, if no DSR Flow State header
is present, if the flow this packet is being sent along is in
the Flow Table, or if no Timeout option preceded the Source
Route option in this DSR Options header, process it as
specified in Section 8.1.4. Stop processing this packet unless
the last address in the Source Route option is an address of
this node.
o On receiving a Source Route option in a packet with a DSR Flow
State header, if the Flow ID specified in the DSR Flow State
header is not in the Flow Table, add the flow to the Flow
Table, setting the Timeout value to a value not greater than
the Timeout field of the Timeout option in this header. If no
Timeout option preceded the Source Route option in this header,
the flow MUST NOT be added to the Flow Table.
If the Flow ID is odd and larger than any unexpired, odd Flow
IDs for this (IP Source Address, IP Destination Address), it is
set to be default in the Default Flow ID Table.
Then process the Route option as specified in Section 8.1.4.
Stop processing this packet unless the last address in the
Source Route option is an address of this node.
o On receiving a Timeout option, check if this packet contains a
DSR Flow State header. If this packet does not contain a DSR
Flow State header, discard the DSR option. Otherwise, record
the Timeout value in the option for future reference. The
value recorded SHOULD be discarded when the node has finished
processing this DSR Options header. If the flow that this
packet is being sent along is in the Flow Table, it MAY set the
flow to time out no more than Timeout seconds in the future.
Johnson, et al. Experimental [Page 91]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
o On receiving a Destination and Flow ID option, if the IP
Destination Address is not an address of this node, forward the
packet according to the Flow ID, as described in Section 8.6.4,
and stop processing this packet.
o On receiving a Destination and Flow ID option, if the IP
Destination Address is an address of this node, set the IP
Destination Address to the New IP Destination Address specified
in the option and set the Flow ID to the New Flow Identifier.
Then remove the Destination and Flow ID option from the packet
and continue processing.
- If the IP Destination Address is an address of this node, remove
the DSR Options header, if any, pass the packet up the network
stack, and stop processing.
- If there is still a DSR Options header containing no options,
remove the DSR Options header.
- If there is still a DSR Flow State header, forward the packet
according to the Flow ID, as described in Section 8.6.4.
- If there is neither a DSR Options header nor a DSR Flow State
header, but there is an entry in the Default Flow Table for the
(IP Source Address, IP Destination Address) pair:
o If the IP TTL is not equal to the TTL expected in the Flow
Table, insert a DSR Flow State header, setting the Hop Count
equal to the Hop Count of this node, and the Flow ID equal to
the default Flow ID found in the Default Flow Table, and
forward this packet according to the Flow ID, as described in
Section 8.6.4.
o Otherwise, follow the steps for forwarding the packet using
Flow IDs described in Section 8.6.4, but taking the Flow ID to
be the default Flow ID found in the Default Flow Table.
- If there is no DSR Options header and no DSR Flow State header and
no default flow can be found, the node returns a Route Error of
type DEFAULT_FLOW_UNKNOWN to the IP Source Address, specifying the
IP Destination Address as the Original IP Destination in the
type-specific field.
Johnson, et al. Experimental [Page 92]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.6.4. Forwarding a Packet Using Flow IDs
To forward a packet using Flow IDs, a node MUST follow the following
sequence of steps:
- If the triple (IP Source Address, IP Destination Address, Flow ID)
is not in the Flow Table, return a Route Error of type
UNKNOWN_FLOW.
- If a network-layer acknowledgement is required for Route
Maintenance for the next hop, the node MUST include an
Acknowledgement Request option as specified in Section 8.3.3. If
no DSR Options header is in the packet in which the
Acknowledgement Request option is to be added, it MUST be
included, as described in Section 8.1.2, except that it MUST be
added after the DSR Flow State header, if one is present.
- Attempt to transmit this packet to the next hop as specified in
the Flow Table, performing Route Maintenance to detect broken
routes.
8.6.5. Promiscuously Receiving a Packet
This section describes processing only for packets that have MAC
destinations other than this processing node. Otherwise, the process
described in Section 8.6.3 should be followed.
When a node using DSR flow state promiscuously overhears a packet, it
SHOULD follow the following steps for processing:
- If the packet contains a DSR Flow State header, and if the triple
(IP Source Address, IP Destination Address, Flow ID) is in the
Flow Table and the Hop Count is less than the Hop Count in the
flow's entry, the node MAY retain the packet in the Automatic
Route Shortening Table. If it can be determined that this Flow ID
has been recently used, the node SHOULD retain the packet in the
Automatic Route Shortening Table.
- If the packet contains neither a DSR Flow State header nor a
Source Route option and a Default Flow ID can be found in the
Default Flow Table for the (IP Source Address, IP Destination
Address), and if the IP TTL is greater than the TTL in the Flow
Table for the default flow, the node MAY retain the packet in the
Automatic Route Shortening Table. If it can be determined that
this Flow ID has been used recently, the node SHOULD retain the
packet in the Automatic Route Shortening Table.
Johnson, et al. Experimental [Page 93]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
8.6.6. Operation Where the Layer below DSR Decreases the IP TTL
Non-uniformly
Some nodes may use an IP tunnel as a DSR hop. If different packets
sent along this IP tunnel can take different routes, the reduction in
IP TTL across this link may be different for different packets. This
prevents the Automatic Route Shortening and Loop Detection
functionality from working properly when used in conjunction with
default routes.
Nodes forwarding packets without a Source Route option onto a link
with unpredictable TTL changes MUST ensure that a DSR Flow State
header is present, indicating the correct Hop Count and Flow ID.
8.6.7. Salvage Interactions with DSR
Nodes salvaging packets MUST remove the DSR Flow State header, if
present.
Anytime this document refers to the Salvage field in the Source Route
option, packets without a Source Route option are considered to have
the value zero in the Salvage field.
Johnson, et al. Experimental [Page 94]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
9. Protocol Constants and Configuration Variables
Any DSR implementation MUST support the following configuration
variables and MUST support a mechanism enabling the value of these
variables to be modified by system management. The specific variable
names are used for demonstration purposes only, and an implementation
is not required to use these names for the configuration variables,
so long as the external behavior of the implementation is consistent
with that described in this document.
For each configuration variable below, the default value is specified
to simplify configuration. In particular, the default values given
below are chosen for a DSR network running over 2 Mbps IEEE 802.11
network interfaces using the Distributed Coordination Function (DCF)
MAC protocol with RTS and CTS [IEEE80211, BROCH98].
DiscoveryHopLimit 255 hops
BroadcastJitter 10 milliseconds
RouteCacheTimeout 300 seconds
SendBufferTimeout 30 seconds
RequestTableSize 64 nodes
RequestTableIds 16 identifiers
MaxRequestRexmt 16 retransmissions
MaxRequestPeriod 10 seconds
RequestPeriod 500 milliseconds
NonpropRequestTimeout 30 milliseconds
RexmtBufferSize 50 packets
MaintHoldoffTime 250 milliseconds
MaxMaintRexmt 2 retransmissions
TryPassiveAcks 1 attempt
PassiveAckTimeout 100 milliseconds
GratReplyHoldoff 1 second
In addition, the following protocol constant MUST be supported by any
implementation of the DSR protocol:
MAX_SALVAGE_COUNT 15 salvages
Johnson, et al. Experimental [Page 95]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
10. IANA Considerations
This document specifies the DSR Options header and DSR Flow State
header, for which the IP protocol number 48 has been assigned. A
single IP protocol number can be used for both header types, since
they can be distinguished by the Flow State Header (F) bit in each
header.
In addition, this document proposes use of the value "No Next Header"
(originally defined for use in IPv6 [RFC2460]) within an IPv4 packet,
to indicate that no further header follows a DSR Options header.
Finally, this document introduces a number of DSR options for use in
the DSR Options header, and additional new DSR options may be defined
in the future. Each of these options requires a unique Option Type
value, the most significant 3 bits (that is, Option Type & 0xE0)
encoded as defined in Section 6.1. It is necessary only that each
Option Type value be unique, not that they be unique in the remaining
5 bits of the value after these 3 most significant bits.
Two registries (DSR Protocol Options and DSR Protocol Route Error
Types) have been created and contain the initial registrations.
Assignment of new values for DSR options will be by Expert Review
[RFC2434], with the authors of this document serving as the
Designated Experts.
11. Security Considerations
This document does not specifically address security concerns. This
document does assume that all nodes participating in the DSR protocol
do so in good faith and without malicious intent to corrupt the
routing ability of the network.
Depending on the threat model, a number of different mechanisms can
be used to secure DSR. For example, in an environment where node
compromise is unrealistic and where all the nodes participating in
the DSR protocol share a common goal that motivates their
participation in the protocol, the communications between the nodes
can be encrypted at the physical channel or link layer to prevent
attack by outsiders. Cryptographic approaches, such as that provided
by Ariadne [HU02] or Secure Routing Protocol (SRP)
[PAPADIMITRATOS02], can resist stronger attacks.
Johnson, et al. Experimental [Page 96]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Appendix A. Link-MaxLife Cache Description
As guidance to implementers of DSR, the description below outlines
the operation of a possible implementation of a Route Cache for DSR
that has been shown to outperform other caches studied in detailed
simulations. Use of this design for the Route Cache is recommended
in implementations of DSR.
This cache, called "Link-MaxLife" [HU00], is a link cache, in that
each individual link (hop) in the routes returned in Route Reply
packets (or otherwise learned from the header of overhead packets) is
added to a unified graph data structure of this node's current view
of the network topology, as described in Section 4.1. To search for
a route in this cache to some destination node, the sending node uses
a graph search algorithm, such as the well-known Dijkstra's
shortest-path algorithm, to find the current best path through the
graph to the destination node.
The Link-MaxLife form of link cache is adaptive in that each link in
the cache has a timeout that is determined dynamically by the caching
node according to its observed past behavior of the two nodes at the
ends of the link; in addition, when selecting a route for a packet
being sent to some destination, among cached routes of equal length
(number of hops) to that destination, Link-MaxLife selects the route
with the longest expected lifetime (highest minimum timeout of any
link in the route).
Specifically, in Link-MaxLife, a link's timeout in the Route Cache is
chosen according to a "Stability Table" maintained by the caching
node. Each entry in a node's Stability Table records the address of
another node and a factor representing the perceived "stability" of
this node. The stability of each other node in a node's Stability
Table is initialized to InitStability. When a link from the Route
Cache is used in routing a packet originated or salvaged by that
node, the stability metric for each of the two endpoint nodes of that
link is incremented by the amount of time since that link was last
used, multiplied by StabilityIncrFactor (StabilityIncrFactor >= 1);
when a link is observed to break and the link is thus removed from
the Route Cache, the stability metric for each of the two endpoint
nodes of that link is multiplied by StabilityDecrFactor
(StabilityDecrFactor < 1).
When a node adds a new link to its Route Cache, the node assigns a
lifetime for that link in the Cache equal to the stability of the
less "stable" of the two endpoint nodes for the link, except that a
link is not allowed to be given a lifetime less than MinLifetime.
When a link is used in a route chosen for a packet originated or
salvaged by this node, the link's lifetime is set to be at least
Johnson, et al. Experimental [Page 97]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
UseExtends into the future; if the lifetime of that link in the Route
Cache is already further into the future, the lifetime remains
unchanged.
When a node using Link-MaxLife selects a route from its Route Cache
for a packet being originated or salvaged by this node, it selects
the shortest-length route that has the longest expected lifetime
(highest minimum timeout of any link in the route), as opposed to
simply selecting an arbitrary route of shortest length.
The following configuration variables are used in the description of
Link-MaxLife above. The specific variable names are used for
demonstration purposes only, and an implementation is not required to
use these names for these configuration variables. For each
configuration variable below, the default value is specified to
simplify configuration. In particular, the default values given
below are chosen for a DSR network where nodes move at relative
velocities between 12 and 25 seconds per wireless transmission
radius.
InitStability 25 seconds
StabilityIncrFactor 4
StabilityDecrFactor 0.5
MinLifetime 1 second
UseExtends 120 seconds
Johnson, et al. Experimental [Page 98]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Appendix B. Location of DSR in the ISO Network Reference Model
When designing DSR, we had to determine at what layer within the
protocol hierarchy to implement ad hoc network routing. We
considered two different options: routing at the link layer (ISO
layer 2) and routing at the network layer (ISO layer 3). Originally,
we opted to route at the link layer for several reasons:
- Pragmatically, running the DSR protocol at the link layer
maximizes the number of mobile nodes that can participate in ad
hoc networks. For example, the protocol can route equally well
between IPv4 [RFC791], IPv6 [RFC2460], and IPX [TURNER90] nodes.
- Historically [JOHNSON94, JOHNSON96a], DSR grew from our
contemplation of a multi-hop propagating version of the Internet's
Address Resolution Protocol (ARP) [RFC826], as well as from the
routing mechanism used in IEEE 802 source routing bridges
[PERLMAN92]. These are layer 2 protocols.
- Technically, we designed DSR to be simple enough that it could be
implemented directly in the firmware inside wireless network
interface cards [JOHNSON94, JOHNSON96a], well below the layer 3
software within a mobile node. We see great potential in this for
DSR running inside a cloud of mobile nodes around a fixed base
station, where DSR would act to transparently extend the coverage
range to these nodes. Mobile nodes that would otherwise be unable
to communicate with the base station due to factors such as
distance, fading, or local interference sources could then reach
the base station through their peers.
Ultimately, however, we decided to specify and to implement
[MALTZ99b] DSR as a layer 3 protocol, since this is the only layer at
which we could realistically support nodes with multiple network
interfaces of different types forming an ad hoc network.
Johnson, et al. Experimental [Page 99]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Appendix C. Implementation and Evaluation Status
The initial design of the DSR protocol, including DSR's basic Route
Discovery and Route Maintenance mechanisms, was first published in
December 1994 [JOHNSON94]; significant additional design details and
initial simulation results were published in early 1996 [JOHNSON96a].
The DSR protocol has been extensively studied since then through
additional detailed simulations. In particular, we have implemented
DSR in the ns-2 network simulator [NS-2, BROCH98] and performed
extensive simulations of DSR using ns-2 (e.g., [BROCH98, MALTZ99a]).
We have also conducted evaluations of the different caching
strategies in this document [HU00].
We have also implemented the DSR protocol under the FreeBSD 2.2.7
operating system running on Intel x86 platforms. FreeBSD [FREEBSD]
is based on a variety of free software, including 4.4 BSD Lite, from
the University of California, Berkeley. For the environments in
which we used it, this implementation is functionally equivalent to
the version of the DSR protocol specified in this document.
During the 7 months from August 1998 to February 1999, we designed
and implemented a full-scale physical testbed to enable the
evaluation of ad hoc network performance in the field, in an actively
mobile ad hoc network under realistic communication workloads. The
last week of February and the first week of March of 1999 included
demonstrations of this testbed to a number of our sponsors and
partners, including Lucent Technologies, Bell Atlantic, and the
Defense Advanced Research Projects Agency (DARPA). A complete
description of the testbed is available [MALTZ99b, MALTZ00, MALTZ01].
We have since ported this implementation of DSR to FreeBSD 3.3, and
we have also added a preliminary version of Quality of Service (QoS)
support for DSR. A demonstration of this modified version of DSR was
presented in July 2000. These QoS features are not included in this
document and will be added later in a separate document on top of the
base protocol specified here.
DSR has also been implemented under Linux by Alex Song at the
University of Queensland, Australia [SONG01]. This implementation
supports the Intel x86 PC platform and the Compaq iPAQ.
The Network and Telecommunications Research Group at Trinity College,
Dublin, have implemented a version of DSR on Windows CE.
Microsoft Research has implemented a version of DSR on Windows XP and
has used it in testbeds of over 15 nodes. Several machines use this
implementation as their primary means of accessing the Internet.
Johnson, et al. Experimental [Page 100]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Several other independent groups have also used DSR as a platform for
their own research, or as a basis of comparison between ad hoc
network routing protocols.
A preliminary version of the optional DSR flow state extension was
implemented in FreeBSD 3.3. A demonstration of this modified version
of DSR was presented in July 2000. The DSR flow state extension has
also been extensively evaluated using simulation [HU01].
Acknowledgements
The protocol described in this document has been designed and
developed within the Monarch Project, a long-term research project at
Rice University (previously at Carnegie Mellon University) that is
developing adaptive networking protocols and protocol interfaces to
allow truly seamless wireless and mobile node networking [JOHNSON96b,
MONARCH].
The authors would like to acknowledge the substantial contributions
of Josh Broch in helping to design, simulate, and implement the DSR
protocol. We thank him for his contributions to earlier versions of
this document.
We would also like to acknowledge the assistance of Robert V. Barron
at Carnegie Mellon University. Bob ported our DSR implementation
from FreeBSD 2.2.7 into FreeBSD 3.3.
Many valuable suggestions came from participants in the IETF process.
We would particularly like to acknowledge Fred Baker, who provided
extensive feedback on a previous version of this document, as well as
the working group chairs, for their suggestions of previous versions
of the document.
Johnson, et al. Experimental [Page 101]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Normative References
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
September 1981.
[RFC792] Postel, J., "Internet Control Message Protocol", STD
5, RFC 792, September 1981.
[RFC826] Plummer, David C., "Ethernet Address Resolution
Protocol: Or converting network protocol addresses to
48.bit Ethernet address for transmission on Ethernet
hardware", STD 37, RFC 826, November 1982.
[RFC1122] Braden, R., "Requirements for Internet Hosts -
Communication Layers", STD 3, RFC 1122, October 1989.
[RFC1700] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2,
RFC 1700, October 1994. See also
http://www.iana.org/numbers.html.
[RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
October 1996. RFC 2003, October 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing
an IANA Considerations Section in RFCs", BCP 26, RFC
2434, October 1998.
Informative References
[BANTZ94] David F. Bantz and Frederic J. Bauchot. Wireless LAN
Design Alternatives. IEEE Network, 8(2):43-53,
March/April 1994.
[BHARGHAVAN94] Vaduvur Bharghavan, Alan Demers, Scott Shenker, and
Lixia Zhang. MACAW: A Media Access Protocol for
Wireless LAN's. In Proceedings of the ACM SIGCOMM '94
Conference, pages 212-225. ACM, August 1994.
[BROCH98] Josh Broch, David A. Maltz, David B. Johnson, Yih-Chun
Hu, and Jorjeta Jetcheva. A Performance Comparison of
Multi-Hop Wireless Ad Hoc Network Routing Protocols.
In Proceedings of the Fourth Annual ACM/IEEE
International Conference on Mobile Computing and
Networking, pages 85-97. ACM/IEEE, October 1998.
Johnson, et al. Experimental [Page 102]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
[CLARK88] David D. Clark. The Design Philosophy of the DARPA
Internet Protocols. In Proceedings of the ACM SIGCOMM
'88 Conference, pages 106-114. ACM, August 1988.
[FREEBSD] The FreeBSD Project. Project web page available at
http://www.freebsd.org/.
[HU00] Yih-Chun Hu and David B. Johnson. Caching Strategies
in On-Demand Routing Protocols for Wireless Ad Hoc
Networks. In Proceedings of the Sixth Annual ACM
International Conference on Mobile Computing and
Networking. ACM, August 2000.
[HU01] Yih-Chun Hu and David B. Johnson. Implicit Source
Routing in On-Demand Ad Hoc Network Routing. In
Proceedings of the Second Symposium on Mobile Ad Hoc
Networking and Computing (MobiHoc 2001), pages 1-10,
October 2001.
[HU02] Yih-Chun Hu, Adrian Perrig, and David B. Johnson.
Ariadne: A Secure On-Demand Routing Protocol for Ad
Hoc Networks. In Proceedings of the Eighth Annual
International Conference on Mobile Computing and
Networking (MobiCom 2002), pages 12-23, September
2002.
[IEEE80211] IEEE Computer Society LAN MAN Standards Committee.
Wireless LAN Medium Access Control (MAC) and Physical
Layer (PHY) Specifications, IEEE Std 802.11-1997. The
Institute of Electrical and Electronics Engineers, New
York, New York, 1997.
[JOHANSSON99] Per Johansson, Tony Larsson, Nicklas Hedman, Bartosz
Mielczarek, and Mikael Degermark. Scenario-based
Performance Analysis of Routing Protocols for Mobile
Ad-hoc Networks. In Proceedings of the Fifth Annual
ACM/IEEE International Conference on Mobile Computing
and Networking, pages 195-206. ACM/IEEE, August 1999.
[JOHNSON94] David B. Johnson. Routing in Ad Hoc Networks of
Mobile Hosts. In Proceedings of the IEEE Workshop on
Mobile Computing Systems and Applications, pages 158-
163. IEEE Computer Society, December 1994.
Johnson, et al. Experimental [Page 103]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
[JOHNSON96a] David B. Johnson and David A. Maltz. Dynamic Source
Routing in Ad Hoc Wireless Networks. In Mobile
Computing, edited by Tomasz Imielinski and Hank Korth,
chapter 5, pages 153-181. Kluwer Academic Publishers,
1996.
[JOHNSON96b] David B. Johnson and David A. Maltz. Protocols for
Adaptive Wireless and Mobile Networking. IEEE
Personal Communications, 3(1):34-42, February 1996.
[JUBIN87] John Jubin and Janet D. Tornow. The DARPA Packet
Radio Network Protocols. Proceedings of the IEEE,
75(1):21-32, January 1987.
[KARN90] Phil Karn. MACA---A New Channel Access Method for
Packet Radio. In ARRL/CRRL Amateur Radio 9th Computer
Networking Conference, pages 134-140. American Radio
Relay League, September 1990.
[LAUER95] Gregory S. Lauer. Packet-Radio Routing. In Routing
in Communications Networks, edited by Martha E.
Steenstrup, chapter 11, pages 351-396. Prentice-Hall,
Englewood Cliffs, New Jersey, 1995.
[MALTZ99a] David A. Maltz, Josh Broch, Jorjeta Jetcheva, and
David B. Johnson. The Effects of On-Demand Behavior
in Routing Protocols for Multi-Hop Wireless Ad Hoc
Networks. IEEE Journal on Selected Areas of
Communications, 17(8):1439-1453, August 1999.
[MALTZ99b] David A. Maltz, Josh Broch, and David B. Johnson.
Experiences Designing and Building a Multi-Hop
Wireless Ad Hoc Network Testbed. Technical Report
CMU-CS-99-116, School of Computer Science, Carnegie
Mellon University, Pittsburgh, Pennsylvania, March
1999.
[MALTZ00] David A. Maltz, Josh Broch, and David B. Johnson.
Quantitative Lessons From a Full-Scale Multi-Hop
Wireless Ad Hoc Network Testbed. In Proceedings of
the IEEE Wireless Communications and Networking
Conference. IEEE, September 2000.
[MALTZ01] David A. Maltz, Josh Broch, and David B. Johnson.
Lessons From a Full-Scale MultiHop Wireless Ad Hoc
Network Testbed. IEEE Personal Communications,
8(1):8-15, February 2001.
Johnson, et al. Experimental [Page 104]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
[MONARCH] Rice University Monarch Project. Monarch Project Home
Page. Available at http://www.monarch.cs.rice.edu/.
[NS-2] The Network Simulator -- ns-2. Project web page
available at http://www.isi.edu/nsnam/ns/.
[PAPADIMITRATOS02]
Panagiotis Papadimitratos and Zygmunt J. Haas. Secure
Routing for Mobile Ad Hoc Networks. In SCS
Communication Networks and Distributed Systems
Modeling and Simulation Conference (CNDS 2002),
January 2002.
[PERLMAN92] Radia Perlman. Interconnections: Bridges and
Routers. Addison-Wesley, Reading, Massachusetts,
1992.
[RFC793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, September 1981.
[RFC2131] Droms, R., "Dynamic Host Configuration Protocol", RFC
2131, March 1997.
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version
6 (IPv6) Specification", RFC 2460, December 1998.
[SONG01] Alex Song. picoNet II: A Wireless Ad Hoc Network for
Mobile Handheld Devices. Submitted for the degree of
Bachelor of Engineering (Honours) in the division of
Electrical Engineering, Department of Information
Technology and Electrical Engineering, University of
Queensland, Australia, October 2001. Available at
http://piconet.sourceforge.net/thesis/index.html.
[TURNER90] Paul Turner. NetWare Communications Processes.
NetWare Application Notes, Novell Research, pages 25-
91, September 1990.
[WRIGHT95] Gary R. Wright and W. Richard Stevens. TCP/IP
Illustrated, Volume 2: The Implementation. Addison-
Wesley, Reading, Massachusetts, 1995.
Johnson, et al. Experimental [Page 105]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Authors' Addresses
David B. Johnson
Rice University
Computer Science Department, MS 132
6100 Main Street
Houston, TX 77005-1892
USA
Phone: +1 713 348-3063
Fax: +1 713 348-5930
EMail: dbj@cs.rice.edu
David A. Maltz
Microsoft Research
One Microsoft Way
Redmond, WA 98052
USA
Phone: +1 425 706-7785
Fax: +1 425 936-7329
EMail: dmaltz@microsoft.com
Yih-Chun Hu
University of Illinois at Urbana-Champaign
Coordinated Science Lab
1308 West Main St, MC 228
Urbana, IL 61801
USA
Phone: +1 217 333-4220
EMail: yihchun@uiuc.edu
Johnson, et al. Experimental [Page 106]
^L
RFC 4728 The Dynamic Source Routing Protocol February 2007
Full Copyright Statement
Copyright (C) The IETF Trust (2007).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Johnson, et al. Experimental [Page 107]
^L
|