aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-eigrp.c
blob: 9855ef4e3a724d0edc4e87e249254387567218d1 (plain)
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
/* packet-eigrp.c
 * Routines for EIGRP dissection
 * Copyright 2011, Donnie V Savage <dsavage@cisco.com>
 *
 * Complete re-write and replaces previous file of same name authored by:
 *    Copyright 2009, Jochen Bartl <jochen.bartl@gmail.co
 *    Copyright 2000, Paul Ionescu <paul@acorp.ro>
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#include "config.h"

#include <epan/packet.h>
#include <epan/guid-utils.h>
#include <epan/addr_resolv.h>
#include <epan/atalk-utils.h>
#include <epan/addr_and_mask.h>
#include <epan/ipproto.h>
#include <epan/expert.h>
#include <epan/reassemble.h>

#include "packet-ipx.h"
#include "packet-osi.h"

/**
 * EIGRP Header size in bytes
 */
#define EIGRP_HEADER_LENGTH     20

/**
 * EIGRP Packet Opcodes
 */
#define EIGRP_OPC_UPDATE        1       /*!< packet containing routing information */
#define EIGRP_OPC_REQUEST       2       /*!< sent to request one or more routes */
#define EIGRP_OPC_QUERY         3       /*!< sent when a routing is in active start */
#define EIGRP_OPC_REPLY         4       /*!< sent in response to a query */
#define EIGRP_OPC_HELLO         5       /*!< sent to maintain a peering session */
#define EIGRP_OPC_IPXSAP        6       /*!< IPX SAP information */
#define EIGRP_OPC_PROBE         7       /*!< for test purposes   */
#define EIGRP_OPC_ACK           8       /*!< acknowledge         */
#define EIGRP_OPC_STUB          9       /*!< peering operating in restricted mode */
#define EIGRP_OPC_SIAQUERY      10      /*!< QUERY - with relaxed restrictions */
#define EIGRP_OPC_SIAREPLY      11      /*!< REPLY - may contain old routing information */

/**
 * EIGRP TLV Range definitions
 *      PDM             TLV Range
 *      General         0x0000
 *      IPv4            0x0100          ** TLVs for one and all
 *      ATALK           0x0200          ** legacy
 *      IPX             0x0300          ** discontinued
 *      IPv6            0x0400          ** legacy
 *      Multiprotocol   0x0600          ** wide metrics
 *      MultiTopology   0x00f0          ** deprecated
 */
#define EIGRP_TLV_RANGEMASK     0xfff0  /*!< should be 0xff00 - opps     */
#define EIGRP_TLV_GENERAL       0x0000

/**
 * 1.2 TLV Definitions  ** legacy
 * These have been deprecated and should not be used for future packets
 */
#define EIGRP_TLV_IPv4          0x0100          /*!< Classic IPv4 TLV encoding */
#define EIGRP_TLV_ATALK         0x0200          /*!< Classic Appletalk TLV encoding*/
#define EIGRP_TLV_IPX           0x0300          /*!< Classic IPX TLV encoding */
#define EIGRP_TLV_IPv6          0x0400          /*!< Classic IPv6 TLV encoding */

/**
 * 2.0 Multi-Protocol TLV Definitions
 * These have been deprecated and should not be used for future packets
 */
#define EIGRP_TLV_MP            0x0600  /*!< Non-PDM specific encoding */

/**
 * 3.0 TLV Definitions  ** deprecated
 * These have been deprecated and should not be used for future packets
 */
#define EIGRP_TLV_MTR           0x00f0          /*!< MTR TLV encoding */

/**
 * TLV type definitions.  Generic (protocol-independent) TLV types are
 * defined here.  Protocol-specific ones are defined elsewhere.
 */
#define EIGRP_TLV_PARAMETER             (EIGRP_TLV_GENERAL | 0x0001)    /*!< eigrp parameters */
#define EIGRP_TLV_AUTH                  (EIGRP_TLV_GENERAL | 0x0002)    /*!< authentication */
#define EIGRP_TLV_SEQ                   (EIGRP_TLV_GENERAL | 0x0003)    /*!< sequenced packet */
#define EIGRP_TLV_SW_VERSION            (EIGRP_TLV_GENERAL | 0x0004)    /*!< software version */
#define EIGRP_TLV_NEXT_MCAST_SEQ        (EIGRP_TLV_GENERAL | 0x0005)    /*!< */
#define EIGRP_TLV_PEER_STUBINFO         (EIGRP_TLV_GENERAL | 0x0006)    /*!< stub information */
#define EIGRP_TLV_PEER_TERMINATION      (EIGRP_TLV_GENERAL | 0x0007)    /*!< peer termination */
#define EIGRP_TLV_PEER_TIDLIST          (EIGRP_TLV_GENERAL | 0x0008)    /*!< peer sub-topology list */

/**
 * Route Based TLVs
 */
#define EIGRP_TLV_TYPEMASK      0x000f
#define EIGRP_TLV_REQUEST       0x0001
#define EIGRP_TLV_INTERNAL      0x0002
#define EIGRP_TLV_EXTERNAL      0x0003
#define EIGRP_TLV_COMMUNITY     0x0004

/* Legacy TLV formats */
#define EIGRP_TLV_IPv4_REQ      (EIGRP_TLV_IPv4 | EIGRP_TLV_REQUEST)
#define EIGRP_TLV_IPv4_INT      (EIGRP_TLV_IPv4 | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_IPv4_EXT      (EIGRP_TLV_IPv4 | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_IPv4_COM      (EIGRP_TLV_IPv4 | EIGRP_TLV_COMMUNITY)
#define EIGRP_TLV_IPX_INT       (EIGRP_TLV_IPX | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_IPX_EXT       (EIGRP_TLV_IPX | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_IPX_COM       (EIGRP_TLV_IPX | EIGRP_TLV_COMMUNITY)
#define EIGRP_TLV_IPv6_INT      (EIGRP_TLV_IPv6 | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_IPv6_EXT      (EIGRP_TLV_IPv6 | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_IPv6_COM      (EIGRP_TLV_IPv6 | EIGRP_TLV_COMMUNITY)

/* Deprecated TLV formats */
#define EIGRP_TLV_AT_INT        (EIGRP_TLV_ATALK | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_AT_EXT        (EIGRP_TLV_ATALK | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_AT_CBL        (EIGRP_TLV_ATALK | 0x04)
#define EIGRP_TLV_MTR_REQ       (EIGRP_TLV_MTR | EIGRP_TLV_REQUEST)
#define EIGRP_TLV_MTR_INT       (EIGRP_TLV_MTR | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_MTR_EXT       (EIGRP_TLV_MTR | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_MTR_COM       (EIGRP_TLV_MTR | EIGRP_TLV_COMMUNITY)
#define EIGRP_TLV_MTR_TIDLIST   (EIGRP_TLV_MTR | 0x0005)

/* Current "Wide Metric" TLV formats */
#define EIGRP_TLV_MP_REQ        (EIGRP_TLV_MP | EIGRP_TLV_REQUEST)
#define EIGRP_TLV_MP_INT        (EIGRP_TLV_MP | EIGRP_TLV_INTERNAL)
#define EIGRP_TLV_MP_EXT        (EIGRP_TLV_MP | EIGRP_TLV_EXTERNAL)
#define EIGRP_TLV_MP_COM        (EIGRP_TLV_MP | EIGRP_TLV_COMMUNITY)

/**
 * External routes originate from some other protocol - these are them
 */
#define NULL_PROTID     0       /*!< unknown protocol */
#define IGRP1_PROTID    1       /*!< IGRP.. who's your daddy! */
#define IGRP2_PROTID    2       /*!< EIGRP - Just flat out the best */
#define STATIC_PROTID   3       /*!< Staticly configured source */
#define RIP_PROTID      4       /*!< Routing Information Protocol */
#define HELLO_PROTID    5       /*!< Hello? RFC-891 you there? */
#define OSPF_PROTID     6       /*!< OSPF - Open Shortest Path First */
#define ISIS_PROTID     7       /*!< Intermediate System To Intermediate System */
#define EGP_PROTID      8       /*!< Exterior Gateway Protocol */
#define BGP_PROTID      9       /*!< Border Gateway Protocol */
#define IDRP_PROTID     10      /*!< InterDomain Routing Protocol */
#define CONN_PROTID     11      /*!< Connected source */

/**
 *
 * extdata flag field definitions
 */
#define EIGRP_OPAQUE_EXT      0x01   /*!< Route is external */
#define EIGRP_OPAQUE_CD       0x02   /*!< Candidate default route */

/**
 * Address-Family types are taken from:
 *       http://www.iana.org/assignments/address-family-numbers
 * to provide a standards based exchange of AFI information between
 * EIGRP routers.
 */
#define EIGRP_AF_IPv4           1       /*!< IPv4 (IP version 4) */
#define EIGRP_AF_IPv6           2       /*!< IPv6 (IP version 6) */
#define EIGRP_AF_IPX            11      /*!< IPX */
#define EIGRP_AF_ATALK          12      /*!< Appletalk */
#define EIGRP_SF_COMMON         16384   /*!< Cisco Service Family */
#define EIGRP_SF_IPv4           16385   /*!< Cisco IPv4 Service Family */
#define EIGRP_SF_IPv6           16386   /*!< Cisco IPv6 Service Family */

/**
 * Authentication types supported by EIGRP
 */
#define EIGRP_AUTH_TYPE_NONE            0
#define EIGRP_AUTH_TYPE_TEXT            1
#define EIGRP_AUTH_TYPE_MD5             2
#define EIGRP_AUTH_TYPE_MD5_LEN         16
#define EIGRP_AUTH_TYPE_SHA256          3
#define EIGRP_AUTH_TYPE_SHA256_LEN      32

/**
 * opaque flag field definitions
 */
#define EIGRP_OPAQUE_SRCWD    0x01   /*!< Route Source Withdraw */
#define EIGRP_OPAQUE_ACTIVE   0x04   /*!< Route is currently in active state */
#define EIGRP_OPAQUE_REPL     0x08   /*!< Route is replicated from different tableid */

/**
 * pak flag bit field definitions - 0 (none)-7 source priority
 */
#define EIGRP_PRIV_DEFAULT      0x00   /* 0 (none)-7 source priority */
#define EIGRP_PRIV_LOW          0x01
#define EIGRP_PRIV_MEDIUM       0x04
#define EIGRP_PRIV_HIGH         0x07

/**
 * stub bit definitions
 */
#define EIGRP_PEER_ALLOWS_CONNECTED     0x0001
#define EIGRP_PEER_ALLOWS_STATIC        0x0002
#define EIGRP_PEER_ALLOWS_SUMMARY       0x0004
#define EIGRP_PEER_ALLOWS_REDIST        0x0008
#define EIGRP_PEER_ALLOWS_LEAKING       0x0010
#define EIGRP_PEER_ALLOWS_RCVONLY       0x0020

/*
 * Init bit definition. First unicast transmitted Update has this
 * bit set in the flags field of the fixed header. It tells the neighbor
 * to down-load his topology table.
 */
#define EIGRP_INIT_FLAG 0x01

/*
 * CR bit (Conditionally Received) definition in flags field on header. Any
 * packets with the CR-bit set can be accepted by an EIGRP speaker if and
 * only if a previous Hello was received with the SEQUENCE_TYPE TLV present.
 *
 * This allows multicasts to be transmitted in order and reliably at the
 * same time as unicasts are transmitted.
 */
#define EIGRP_CR_FLAG 0x02

/*
 * RS bit.  The Restart flag is set in the hello and the init
 * update packets during the nsf signaling period.  A nsf-aware
 * router looks at the RS flag to detect if a peer is restarting
 * and maintain the adjacency. A restarting router looks at
 * this flag to determine if the peer is helping out with the restart.
 */
#define EIGRP_RS_FLAG 0x04

/*
 * EOT bit.  The End-of-Table flag marks the end of the start-up updates
 * sent to a new peer.  A nsf restarting router looks at this flag to
 * determine if it has finished receiving the start-up updates from all
 * peers.  A nsf-aware router waits for this flag before cleaning up
 * the stale routes from the restarting peer.
 */
#define EIGRP_EOT_FLAG 0x08

/**
 * EIGRP Virtual Router ID
 *
 * Define values to deal with EIGRP virtual router ids.  Virtual
 * router IDs are stored in the upper short of the EIGRP fixed packet
 * header.  The lower short of the packet header continues to be used
 * as asystem number.
 *
 * Virtual Router IDs are PDM-independent.  All PDMs will use
 * VRID_BASE to indicate the 'base' or 'legacy' EIGRP instance.
 * All PDMs need to initialize their vrid to VRID_BASE for compatibility
 * with legacy routers.
 * Once IPv6 supports 'MTR Multicast', it will use the same VRID as
 * IPv4.  No current plans to support VRIDs on IPX. :)
 * Initial usage of VRID is to signal usage of Multicast topology for
 * MTR.
 *
 * VRID_MCAST is a well known constant, other VRIDs will be determined
 * programmatic...
 *
 * With the addition of SAF the VRID space has been divided into two
 * segments 0x0000-0x7fff is for EIGRP and vNets, 0x8000-0xffff is
 * for saf and its associated vNets.
 */
#define EIGRP_VRID_MASK         0x8001
#define EIGRP_VRID_AF_BASE      0x0000
#define EIGRP_VRID_MCAST_BASE   0x0001
#define EIGRP_VRID_SF_BASE      0x8000

/* Extended Attributes for a destination */
#define EIGRP_ATTR_HDRLEN (2)
#define EIGRP_ATTR_MAXDATA (512)

#define EIGRP_ATTR_NOOP         0       /*!< No-Op used as offset padding */
#define EIGRP_ATTR_SCALED       1       /*!< Scaled metric values */
#define EIGRP_ATTR_TAG          2       /*!< Tag assigned by Admin for dest */
#define EIGRP_ATTR_COMM         3       /*!< Community attribute for dest */
#define EIGRP_ATTR_JITTER       4       /*!< Variation in path delay */
#define EIGRP_ATTR_QENERGY      5       /*!< Non-Active energy usage along path */
#define EIGRP_ATTR_ENERGY       6       /*!< Active energy usage along path */

/*
 * Begin EIGRP-BGP interoperability communities
 */
#define EIGRP_EXTCOMM_SOO_ASFMT         0x0003 /* Site-of-Origin, BGP AS format */
#define EIGRP_EXTCOMM_SOO_ADRFMT        0x0103 /* Site-of-Origin, BGP/EIGRP addr format */

/*
 * EIGRP Specific communities
 */
#define EIGRP_EXTCOMM_EIGRP             0x8800 /* EIGRP route information appended*/
#define EIGRP_EXTCOMM_DAD               0x8801 /* EIGRP AS + Delay           */
#define EIGRP_EXTCOMM_VRHB              0x8802 /* EIGRP Vector: Reliability + Hop + BW */
#define EIGRP_EXTCOMM_SRLM              0x8803 /* EIGRP System: Reserve +Load + MTU   */
#define EIGRP_EXTCOMM_SAR               0x8804 /* EIGRP System: Remote AS + Remote ID  */
#define EIGRP_EXTCOMM_RPM               0x8805 /* EIGRP Remote: Protocol + Metric    */
#define EIGRP_EXTCOMM_VRR               0x8806 /* EIGRP Vecmet: Rsvd + (internal) Routerid */

/* SAF types */
#define EIGRP_SVCDATA_COMPLETE          0x01    /*!< Data is attached */
#define EIGRP_SVCDATA_TRIMMED           0x02    /*!< Data was trimmed from service */

/* SAF Defined Numbers */
#define SAF_SERVICE_ID_CAPMAN   100             /*!< Capabilities Manager */
#define SAF_SERVICE_ID_UC       101             /*!< Unified Communications */
#define SAF_SERVICE_ID_PFR      102             /*!< Performance Routing */

/* Forward declaration we need below (if using proto_reg_handoff...
   as a prefs callback)       */
void proto_reg_handoff_eigrp(void);
void proto_register_eigrp(void);

/* Initialize the protocol and registered fields */
static int proto_eigrp = -1;

/* header */
static gint hf_eigrp_version = -1;
static gint hf_eigrp_opcode = -1;
static gint hf_eigrp_flags = -1;
static gint hf_eigrp_sequence = -1;
static gint hf_eigrp_acknowledge = -1;
static gint hf_eigrp_vrid = -1;
static gint hf_eigrp_as = -1;
static gint ett_eigrp = -1;

/* packet header flags */
static gint hf_eigrp_flags_init = -1;
static gint hf_eigrp_flags_restart = -1;
static gint hf_eigrp_flags_eot = -1;
static gint hf_eigrp_flags_condrecv = -1;

static gint ett_eigrp_flags = -1;
static const int *eigrp_flag_fields[] = {
    &hf_eigrp_flags_init,
    &hf_eigrp_flags_condrecv,
    &hf_eigrp_flags_restart,
    &hf_eigrp_flags_eot,
    NULL
};

/* tlv */
static gint hf_eigrp_tlv_type = -1;
static gint hf_eigrp_tlv_len = -1;
static gint hf_eigrp_tid = -1;
static gint hf_eigrp_afi = -1;
static gint hf_eigrp_nullpad = -1;

static gint ett_eigrp_tlv = -1;
static gint ett_eigrp_tlv_metric = -1;
static gint ett_eigrp_tlv_attr = -1;
static gint ett_eigrp_tlv_extdata = -1;

/* param */
static gint hf_eigrp_par_k1 = -1;
static gint hf_eigrp_par_k2 = -1;
static gint hf_eigrp_par_k3 = -1;
static gint hf_eigrp_par_k4 = -1;
static gint hf_eigrp_par_k5 = -1;
static gint hf_eigrp_par_k6 = -1;
static gint hf_eigrp_par_holdtime = -1;

/* auth */
static gint hf_eigrp_auth_type = -1;
static gint hf_eigrp_auth_len = -1;
static gint hf_eigrp_auth_keyid = -1;
static gint hf_eigrp_auth_keyseq = -1;
static gint hf_eigrp_auth_digest = -1;

/* seq */
static gint hf_eigrp_seq_addrlen = -1;
static gint hf_eigrp_seq_ipv4addr = -1;
static gint hf_eigrp_seq_ipv6addr = -1;

/* multicast seq */
static gint hf_eigrp_next_mcast_seq = -1;

/* stub flags */
static gint hf_eigrp_stub_flags = -1;
static gint hf_eigrp_stub_flags_connected = -1;
static gint hf_eigrp_stub_flags_static = -1;
static gint hf_eigrp_stub_flags_summary = -1;
static gint hf_eigrp_stub_flags_recvonly = -1;
static gint hf_eigrp_stub_flags_redist = -1;
static gint hf_eigrp_stub_flags_leakmap = -1;

static gint ett_eigrp_stub_flags = -1;
static const int *eigrp_stub_flag_fields[] = {
    &hf_eigrp_stub_flags_connected,
    &hf_eigrp_stub_flags_static,
    &hf_eigrp_stub_flags_summary,
    &hf_eigrp_stub_flags_redist,
    &hf_eigrp_stub_flags_leakmap,
    &hf_eigrp_stub_flags_recvonly,
    NULL
};

/* tid */
static gint hf_eigrp_tidlist_tid = -1;
static gint hf_eigrp_tidlist_flags = -1;
static gint hf_eigrp_tidlist_len = -1;
static gint ett_eigrp_tidlist = -1;

/* 1.2 and 3.0 metric */
static gint hf_eigrp_legacy_metric_delay = -1;
static gint hf_eigrp_legacy_metric_bw = -1;
static gint hf_eigrp_legacy_metric_mtu = -1;
static gint hf_eigrp_legacy_metric_hopcount = -1;
static gint hf_eigrp_legacy_metric_rel = -1;
static gint hf_eigrp_legacy_metric_load = -1;
static gint hf_eigrp_legacy_metric_intag = -1;

/* 3.0 metric */
static gint hf_eigrp_legacy_metric_tag = -1;

/* 2.0 metric */
static gint hf_eigrp_metric_offset = -1;
static gint hf_eigrp_metric_priority = -1;
static gint hf_eigrp_metric_rel = -1;
static gint hf_eigrp_metric_load = -1;
static gint hf_eigrp_metric_mtu = -1;
static gint hf_eigrp_metric_hopcount = -1;
static gint hf_eigrp_metric_reserved = -1;

/* router id*/
static gint hf_eigrp_routerid = -1;

/* protocol dependent module route flags */
static gint hf_eigrp_metric_flags_srcwd = -1;
static gint hf_eigrp_metric_flags_active = -1;
static gint hf_eigrp_metric_flags_repl = -1;
static gint ett_eigrp_metric_flags = -1;

/* extended metrics */
static gint hf_eigrp_attr_opcode = -1;
static gint hf_eigrp_attr_offset = -1;
static gint hf_eigrp_attr_scaled = -1;
static gint hf_eigrp_attr_tag = -1;
static gint hf_eigrp_attr_jitter = -1;
static gint hf_eigrp_attr_qenergy = -1;
static gint hf_eigrp_attr_energy = -1;

/* route external data */
static gint hf_eigrp_extdata_origrid = -1;
static gint hf_eigrp_extdata_as = -1;
static gint hf_eigrp_extdata_tag = -1;
static gint hf_eigrp_extdata_metric = -1;
static gint hf_eigrp_extdata_reserved = -1;
static gint hf_eigrp_extdata_proto = -1;

static gint hf_eigrp_extdata_flag_ext = -1;
static gint hf_eigrp_extdata_flag_cd = -1;
static gint ett_eigrp_extdata_flags = -1;

/* ipv4 address */
static gint hf_eigrp_ipv4_nexthop = -1;
static gint hf_eigrp_ipv4_prefixlen = -1;

/* ipv6 address */
static gint hf_eigrp_ipv6_nexthop = -1;
static gint hf_eigrp_ipv6_prefixlen = -1;

/* ipx address */
static gint hf_eigrp_ipx_nexthop_net = -1;
static gint hf_eigrp_ipx_nexthop_host = -1;
static gint hf_eigrp_ipx_extdata_routerid = -1;
static gint hf_eigrp_ipx_extdata_delay = -1;
static gint hf_eigrp_ipx_extdata_metric = -1;
static gint hf_eigrp_ipx_dest = -1;

/* appletalk address */
static gint hf_eigrp_atalk_routerid = -1;

/* SAF services */
static gint hf_eigrp_saf_service = -1;
static gint hf_eigrp_saf_subservice = -1;
static gint hf_eigrp_saf_guid = -1;

static gint hf_eigrp_saf_reachability_afi = -1;
static gint hf_eigrp_saf_reachability_port = -1;
static gint hf_eigrp_saf_reachability_protocol = -1;
static gint hf_eigrp_saf_reachability_addr_ipv4 = -1;
static gint hf_eigrp_saf_reachability_addr_ipv6 = -1;
static gint hf_eigrp_saf_reachability_addr_hex = -1;
static gint ett_eigrp_saf_reachability = -1;

static gint hf_eigrp_saf_data_length = -1;
static gint hf_eigrp_saf_data_sequence = -1;
static gint hf_eigrp_saf_data_type = -1;

static expert_field ei_eigrp_checksum_bad = EI_INIT;
static expert_field ei_eigrp_unreachable = EI_INIT;
static expert_field ei_eigrp_seq_addrlen = EI_INIT;
static expert_field ei_eigrp_peer_termination = EI_INIT;
static expert_field ei_eigrp_tlv_type = EI_INIT;
static expert_field ei_eigrp_auth_type = EI_INIT;
static expert_field ei_eigrp_peer_termination_graceful = EI_INIT;
static expert_field ei_eigrp_auth_len = EI_INIT;
static expert_field ei_eigrp_tlv_len = EI_INIT;
static expert_field ei_eigrp_afi = EI_INIT;
static expert_field ei_eigrp_prefixlen = EI_INIT;
static expert_field ei_eigrp_tlv_trunc = EI_INIT;

/* some extra handle that might be needed */
static dissector_handle_t ipxsap_handle = NULL;
static dissector_table_t media_type_table = NULL;

static const value_string eigrp_opcode2string[] = {
    { EIGRP_OPC_UPDATE,         "Update" },
    { EIGRP_OPC_REQUEST,        "Request" },
    { EIGRP_OPC_QUERY,          "Query" },
    { EIGRP_OPC_REPLY,          "Reply" },
    { EIGRP_OPC_HELLO,          "Hello" },
    { EIGRP_OPC_IPXSAP,         "IPX/SAP Update" },
    { EIGRP_OPC_PROBE,          "Route Probe" },
    { EIGRP_OPC_ACK,            "Hello (Ack)" },
    { EIGRP_OPC_STUB,           "Stub-Info" },
    { EIGRP_OPC_SIAQUERY,       "SIA-Query" },
    { EIGRP_OPC_SIAREPLY,       "SIA-Reply" },
    { 0, NULL }
};

static const value_string eigrp_tlv2string[] = {
    /* General TLV formats */
    { EIGRP_TLV_PARAMETER,              "Parameters"},
    { EIGRP_TLV_AUTH,                   "Authentication"},
    { EIGRP_TLV_SEQ,                    "Sequence"},
    { EIGRP_TLV_SW_VERSION,             "Software Version"},
    { EIGRP_TLV_NEXT_MCAST_SEQ,         "Next multicast sequence"},
    { EIGRP_TLV_PEER_STUBINFO,          "Peer Stub Information"},
    { EIGRP_TLV_PEER_TERMINATION,       "Peer Termination"},
    { EIGRP_TLV_PEER_TIDLIST,           "Peer Topology ID List"},

    /* Legacy TLV formats */
    { EIGRP_TLV_IPv4_INT,               "Internal Route(IPv4)"},
    { EIGRP_TLV_IPv4_EXT,               "External Route(IPv4)"},
    { EIGRP_TLV_IPv4_COM,               "Ext-Community(IPv4)"},
    { EIGRP_TLV_IPv6_INT,               "Internal Route(IPv6)"},
    { EIGRP_TLV_IPv6_EXT,               "External Route(IPv6)"},
    { EIGRP_TLV_IPv6_COM,               "Ext-Community(IPv6)"},
    { EIGRP_TLV_IPX_INT,                "IPX Internal Route(IPX)"},
    { EIGRP_TLV_IPX_EXT,                "IPX External Route(IPX)"},

    /* Deprecated TLV formats */
    { EIGRP_TLV_AT_INT,                 "Internal Route(ATALK)"},
    { EIGRP_TLV_AT_EXT,                 "External Route(ATALK)"},
    { EIGRP_TLV_AT_CBL,                 "Cable Configuration(ATALK)"},
    { EIGRP_TLV_MTR_REQ,                "Request(MTR)"},
    { EIGRP_TLV_MTR_INT,                "Internal Route(MTR)"},
    { EIGRP_TLV_MTR_EXT,                "External Route(MTR)"},
    { EIGRP_TLV_MTR_COM,                "Ext-Community(MTR)"},
    { EIGRP_TLV_MTR_TIDLIST,            "TopologyID List"},

    /* Current "Wide Metric" TLV formats */
    { EIGRP_TLV_MP_REQ,                 "Request"},
    { EIGRP_TLV_MP_INT,                 "Internal Route"},
    { EIGRP_TLV_MP_EXT,                 "External Route"},
    { EIGRP_TLV_MP_COM,                 "Ext-Community"},

    { 0, NULL}
};

static const value_string eigrp_proto2string[] = {
    { IGRP1_PROTID,             "IGRP"},
    { IGRP2_PROTID,             "EIGRP"},
    { STATIC_PROTID,            "Static Route"},
    { RIP_PROTID,               "RIP"},
    { HELLO_PROTID,             "Hello"},
    { OSPF_PROTID,              "OSPF"},
    { ISIS_PROTID,              "IS-IS"},
    { EGP_PROTID,               "EGP"},
    { BGP_PROTID,               "BGP"},
    { IDRP_PROTID,              "IDRP"},
    { CONN_PROTID,              "Connected Route"},
    { 0, NULL}
};

static const value_string eigrp_auth2string[] = {
    { EIGRP_AUTH_TYPE_TEXT,     "TEXT"},
    { EIGRP_AUTH_TYPE_MD5,      "MD5"},
    { EIGRP_AUTH_TYPE_SHA256,   "SHA256"},
    { 0, NULL},
};

static const value_string eigrp_vrid2string[] = {
    { EIGRP_VRID_AF_BASE,       "(Address-Family)"},
    { EIGRP_VRID_SF_BASE,       "(Service-Family)"},
    { EIGRP_VRID_MCAST_BASE,    "(Multi-Cast)"},
    { 0, NULL}
};

static const value_string eigrp_afi2string[] = {
    { EIGRP_AF_IPv4,            "IPv4"},
    { EIGRP_AF_IPv6,            "IPv6"},
    { EIGRP_AF_IPX,             "IPX"},
    { EIGRP_AF_ATALK,           "Appletalk"},
    { EIGRP_SF_COMMON,          "Service Family"},
    { EIGRP_SF_IPv4,            "IPv4 Service Family"},
    { EIGRP_SF_IPv6,            "IPv6 Service Family"},
    { 0, NULL}
};

static const value_string eigrp_attr_opcode2string[] = {
    { EIGRP_ATTR_NOOP,          "NO-OP for padding"},
    { EIGRP_ATTR_SCALED,        "Scaled Metric"},
    { EIGRP_ATTR_TAG,           "Admin Tag"},
    { EIGRP_ATTR_COMM,          "Community"},
    { EIGRP_ATTR_JITTER,        "Jitter"},
    { EIGRP_ATTR_QENERGY,       "Non-Active energy"},
    { EIGRP_ATTR_ENERGY,        "Active energy"},
    { 0, NULL}
};

static const value_string eigrp_saf_type2string[] = {
    { EIGRP_SVCDATA_COMPLETE,   "Attached Service Data"},
    { EIGRP_SVCDATA_TRIMMED,    "Trimmed Service Data"},
    { 0, NULL}
};

static const value_string eigrp_saf_srv2string[] = {
    { SAF_SERVICE_ID_CAPMAN,    "Capabilities Manager"},
    { SAF_SERVICE_ID_UC,        "Unified Communications"},
    { SAF_SERVICE_ID_PFR,       "Performance Routing"},
    { 0, NULL}
};

/**
 *@fn void dissect_eigrp_parameter (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
 *
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect the Parameter TLV, which is used to convey metric weights and the
 * hold time.
 *
 * @usage
 * Note the addition of K6 for the new extended metrics, and does not apply to
 * older TLV packet formats.
 */
static void
dissect_eigrp_parameter (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
                         proto_item *ti)
{
    int    offset = 0;
    guint8 k1, k2, k3, k4, k5;

    k1 = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_par_k1, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    k2 = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_par_k2, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    k3 = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_par_k3, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    k4 = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_par_k4, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    k5 = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_par_k5, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    proto_tree_add_item(tree, hf_eigrp_par_k6, tvb, offset, 1, ENC_BIG_ENDIAN);

    offset += 1;
    proto_tree_add_item(tree, hf_eigrp_par_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);

    if (k1 == 255 && k2 == 255 && k3 == 255 && k4 == 255 && k5 == 255) {
        proto_item_append_text(ti, ": Peer Termination");
        expert_add_info(pinfo, ti, &ei_eigrp_peer_termination);
    }
}

/**
 *@fn void dissect_eigrp_auth_tlv (proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, proto_item *ti)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect the Authentication TLV and display digest. Currently MD5 and SHA256
 * HMAC is supported.  For SHA256, a "secret key" with the HMAC-SHA-256
 * password, the source address from which the packet is sent. This combined
 * string is used as the key for hash calculation.
 */
static void
dissect_eigrp_auth_tlv (proto_tree *tree, tvbuff_t *tvb,
                        packet_info *pinfo, proto_item *ti)
{
    proto_item *ti_auth_type, *ti_auth_len;
    int         offset = 0;
    guint16     auth_type, auth_len;

    /* print out what family we dealing with... */

    auth_type = tvb_get_ntohs(tvb, 0);
    auth_len = tvb_get_ntohs(tvb, 2);

    proto_item_append_text(ti, " %s", val_to_str_const(auth_type, eigrp_auth2string, ""));

    ti_auth_type = proto_tree_add_item(tree, hf_eigrp_auth_type, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    ti_auth_len = proto_tree_add_item(tree, hf_eigrp_auth_len, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    proto_tree_add_item(tree, hf_eigrp_auth_keyid, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(tree, hf_eigrp_auth_keyseq, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(tree, hf_eigrp_nullpad, tvb, offset, 8, ENC_NA);
    offset += 8;

    switch (auth_type) {
    case EIGRP_AUTH_TYPE_MD5:
        if (EIGRP_AUTH_TYPE_MD5_LEN != auth_len) {
            expert_add_info_format(pinfo, ti_auth_len, &ei_eigrp_auth_len, "Invalid auth len %u", auth_len);
        } else {
            proto_tree_add_item(tree, hf_eigrp_auth_digest, tvb, offset,
                                EIGRP_AUTH_TYPE_MD5_LEN, ENC_NA);
        }
        break;

    case EIGRP_AUTH_TYPE_SHA256:
        if (EIGRP_AUTH_TYPE_SHA256_LEN != auth_len) {
            expert_add_info_format(pinfo, ti_auth_len, &ei_eigrp_auth_len, "Invalid auth len %u", auth_len);

        } else {
            proto_tree_add_item(tree, hf_eigrp_auth_digest, tvb, offset,
                                EIGRP_AUTH_TYPE_SHA256_LEN, ENC_NA);
        }
        break;

    case EIGRP_AUTH_TYPE_NONE:
    case EIGRP_AUTH_TYPE_TEXT:
    default:
        expert_add_info_format(pinfo, ti_auth_type, &ei_eigrp_auth_type, "Invalid auth type %u", auth_type);
        break;
    }
}

/**
 *@fn void dissect_eigrp_seq_tlv (proto_tree *tree, tvbuff_t *tvb,
 *                                packet_info *pinfo, proto_item *ti)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect the Sequence TLV which consists of the addresses of peers that must
 * not receive the next multicast packet transmitted.
 */
static void
dissect_eigrp_seq_tlv (proto_tree *tree, tvbuff_t *tvb,
                       packet_info *pinfo, proto_item *ti)
{
    proto_item *ti_addrlen;
    int         offset = 0;
    guint8      addr_len;

    while (tvb_reported_length_remaining(tvb, offset) > 0) {
        addr_len = tvb_get_guint8(tvb, offset);
        ti_addrlen = proto_tree_add_item(tree, hf_eigrp_seq_addrlen, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset += 1;

        if (tvb_reported_length_remaining(tvb, offset) < addr_len) {
            /* The remaining part of the TLV is shorter than the address it should contain */
            expert_add_info(pinfo, ti, &ei_eigrp_tlv_trunc);
            break;
        }

        switch (addr_len) {
        case 4:
            /* IPv4 */
            proto_tree_add_item(tree, hf_eigrp_seq_ipv4addr, tvb, offset, addr_len, ENC_BIG_ENDIAN);
            break;
        case 10:
            /* IPX */
            proto_tree_add_text(tree, tvb, offset, addr_len,
                                "IPX Address = %08x.%04x.%04x.%04x",
                                tvb_get_ntohl(tvb, 1), tvb_get_ntohs(tvb, 5),
                                tvb_get_ntohs(tvb, 7), tvb_get_ntohs(tvb, 9));
            break;
        case 16:
            /* IPv6 */
            proto_tree_add_item(tree, hf_eigrp_seq_ipv6addr, tvb, offset, addr_len,
                                ENC_NA);
            break;
        default:
            expert_add_info(pinfo, ti_addrlen, &ei_eigrp_seq_addrlen);
        }

        offset += addr_len;
    }
}

/**
 *@fn void dissect_eigrp_sw_version (tvbuff_t *tvb, proto_tree *tree,
 *                                   proto_item *ti)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect Software Version TLV.  The older versions of EIGRP sent the IOS
 * version along with the TLV Version.   When EIGRP "plugins" were created,
 * this as change to send the "Release" of EIGRP to better identify where fixes
 * are present(missing)
 */
static void
dissect_eigrp_sw_version (tvbuff_t *tvb, proto_tree *tree,
                          proto_item *ti)
{
    int    offset = 0;
    guint8 ios_rel_major, ios_rel_minor;
    guint8 eigrp_rel_major, eigrp_rel_minor;

    ios_rel_major = tvb_get_guint8(tvb, 0);
    ios_rel_minor = tvb_get_guint8(tvb, 1);
    proto_tree_add_text(tree, tvb, offset, 2, "EIGRP Release: %u.%u",
                        ios_rel_major, ios_rel_minor);
    offset += 2;
    proto_item_append_text(ti, ": EIGRP=%u.%u", ios_rel_major, ios_rel_minor);

    eigrp_rel_major = tvb_get_guint8(tvb, 2);
    eigrp_rel_minor = tvb_get_guint8(tvb, 3);
    proto_tree_add_text(tree,tvb,offset, 2, "EIGRP TLV version: %u.%u",
                        eigrp_rel_major, eigrp_rel_minor);
    proto_item_append_text(ti, ", TLV=%u.%u",
                           eigrp_rel_major, eigrp_rel_minor);
}

/**
 *@fn void dissect_eigrp_next_mcast_seq (tvbuff_t *tvb, proto_tree *tree,
 *                                      proto_item *ti)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect Next Multicast Sequence TLV, which is part of the Hello with a
 * Sequence TLV;  this gives a two-way binding between the packets and plugs a
 * hole where a multicast could be received  by the wrong peers (due to a
 * string of lost packets).
 */
static void
dissect_eigrp_next_mcast_seq (tvbuff_t *tvb, proto_tree *tree,
                              proto_item *ti)
{
    proto_tree_add_item(tree, hf_eigrp_next_mcast_seq, tvb, 0, 4,
                        ENC_BIG_ENDIAN);
    proto_item_append_text(ti, ": %u", tvb_get_ntohl(tvb, 0));
}

/**
 *@fn void dissect_eigrp_peer_stubinfo (tvbuff_t *tvb, proto_tree *tree)
 *
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 *
 * @par
 * Dissect the PEER STUB TLV which contains the route types which the Peer will
 * advertise. This is used to suppress QUERYs from being sent to the Peer
 */
static void
dissect_eigrp_peer_stubinfo (tvbuff_t *tvb, proto_tree *tree)
{
    proto_tree_add_bitmask(tree, tvb, 0, hf_eigrp_stub_flags, ett_eigrp_stub_flags,
                           eigrp_stub_flag_fields, ENC_BIG_ENDIAN);
}

/**
 *@fn void dissect_eigrp_peer_termination (packet_info *pinfo, proto_item *ti)
 *
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 *
 * @par
 * Dissect Peer Termination TLV.  This TLV has no parameters and is used to
 * signal an adjacency should be tore down
 */
static void
dissect_eigrp_peer_termination (packet_info *pinfo, proto_item *ti)
{
    expert_add_info(pinfo, ti, &ei_eigrp_peer_termination_graceful);
}

/**
 *@fn void dissect_eigrp_peer_tidlist (proto_tree *tree, tvbuff_t *tvb)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 *
 * @par
 *  Dissect the Topology Identifier List TLV.  This TLV was introduced as part
 *  of the "MTR (Multi-Topology Routing) Project to support sub topologies
 *  within a given Autonomous System. The following represents the format of
 *  the TID list
 *
 *    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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |            Flags             |         Length                 |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |        Variable Length TID (two bytes) list                   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static void
dissect_eigrp_peer_tidlist (proto_tree *tree, tvbuff_t *tvb)
{
    proto_tree *sub_tree;
    int         offset = 0;
    guint16     size;

    proto_tree_add_item(tree, hf_eigrp_tidlist_flags, tvb, offset, 2,
                        ENC_BIG_ENDIAN);
    offset += 2;

    size = tvb_get_ntohs(tvb, offset) / 2;
    proto_tree_add_item(tree, hf_eigrp_tidlist_len, tvb, offset, 2,
                        ENC_BIG_ENDIAN);
    offset += 2;

    sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, (size*2), ett_eigrp_tidlist, NULL, "%d TIDs", size);
    for (; size ; size--) {
        proto_tree_add_item(sub_tree, hf_eigrp_tidlist_tid, tvb, offset, 2,
                            ENC_BIG_ENDIAN);
        offset += 2;
    }
}

/**
 *@fn int dissect_eigrp_extdata_flags (proto_tree *tree, tvbuff_t *tvb, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the Flags field in the external data section of an external
 * route.The following represents the format of the bit field
 *
 *    7 6 5 4 3 2 1 0
 *   +-+-+-+-+-+-+-+-+
 *   |   Flags       |
 *   +-+-+-+-+-+-+-+-+
 *                | |
 *                | +- Route is External *not used*
 *                +--- Route is Candidate Default
 */
static int
dissect_eigrp_extdata_flags (proto_tree *tree, tvbuff_t *tvb, int offset)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;

    /* Decode the route flags field */
    sub_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_eigrp_extdata_flags, NULL, "External Flags");
    sub_tvb = tvb_new_subset_remaining(tvb, offset);

    proto_tree_add_item(sub_tree, hf_eigrp_extdata_flag_ext, sub_tvb, 0, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_flag_cd, sub_tvb, 0, 1,
                        ENC_BIG_ENDIAN);

    offset += 1;
    return(offset);
}

/**
 *@fn int dissect_eigrp_metric_flags (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 * @param[in] limit     maximum number of bytes which can be process
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect Protocol Dependent Module (PDM) Flags field in the route metric
 * section of an internal and external route. The following represents the
 * format of the bit field
 *
 *       MSB             LSB
 *    7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |   Flags       |    MP Flags   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *              | | |
 *              | | +- Route is Replicated
 *              | +--- Route is Active
 *              +----- Source Withdraw
 */
static int
dissect_eigrp_metric_flags (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;

    /* Decode the route flags field */
    sub_tree = proto_tree_add_subtree(tree, tvb, offset, limit, ett_eigrp_metric_flags, NULL, "Flags");
    sub_tvb = tvb_new_subset(tvb, offset, limit, -1);

    /* just care about 'flags' byte, there are no MP flags for now */
    proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_srcwd, sub_tvb, 0, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_active, sub_tvb, 0, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_flags_repl, sub_tvb, 0, 1,
                        ENC_BIG_ENDIAN);

    offset += limit;
    return(offset);
}

/**
 *@fn int dissect_eigrp_ipv4_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, int offset, int unreachable)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect all IPv4 address from offset though the end of the packet
 */
static int
dissect_eigrp_ipv4_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                         packet_info *pinfo, int offset, int unreachable)
{
    guint8      ip_addr[4], length;
    int         addr_len;
    proto_item *ti_prefixlen, *ti_dst;
    int         first = TRUE;

    for (; tvb_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
        length = tvb_get_guint8(tvb, offset);
        addr_len = ipv4_addr_and_mask(tvb, offset + 1, ip_addr, length);

        if (addr_len < 0) {
            ti_prefixlen = proto_tree_add_item(tree, hf_eigrp_ipv4_prefixlen,
                                               tvb, offset, 1, ENC_BIG_ENDIAN);
            expert_add_info_format(pinfo, ti_prefixlen, &ei_eigrp_prefixlen, "Invalid prefix length %u, must be <= 32", length);
            addr_len = 4; /* assure we can exit the loop */

        } else {
            proto_tree_add_item(tree, hf_eigrp_ipv4_prefixlen, tvb, offset, 1,
                                ENC_BIG_ENDIAN);
            offset += 1;
            ti_dst = proto_tree_add_text(tree, tvb, offset, addr_len,
                                         "Destination: %s", ip_to_str(ip_addr));

            /* add it to the top level line */
            proto_item_append_text(ti,"  %c   %s/%u", first ? '=':',',
                                   ip_to_str(ip_addr), length);

            if (unreachable) {
                expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
            }
        }
        first = FALSE;
    }
    return (offset);
}

/**
 *@fn int dissect_eigrp_ipv6_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, int offset, int unreachable)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect all IPv6 address from offset though the end of the packet
 */
static int
dissect_eigrp_ipv6_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                         packet_info *pinfo, int offset, int unreachable)
{
    guint8             length;
    int                addr_len;
    struct e_in6_addr  addr;
    proto_item        *ti_prefixlen, *ti_dst;
    int                first = TRUE;

    for (; tvb_length_remaining(tvb, offset) > 0; offset += (1 + addr_len)) {
        length = tvb_get_guint8(tvb, offset);
        addr_len = ipv6_addr_and_mask(tvb, offset + 1, &addr, length);

        if (addr_len < 0) {
            ti_prefixlen = proto_tree_add_item(tree, hf_eigrp_ipv6_prefixlen,
                                               tvb, offset, 1, ENC_BIG_ENDIAN);
            expert_add_info_format(pinfo, ti_prefixlen, &ei_eigrp_prefixlen, "Invalid prefix length %u, must be <= 128", length);
            addr_len = 16; /* assure we can exit the loop */
        } else {
            proto_tree_add_item(tree, hf_eigrp_ipv6_prefixlen, tvb, offset, 1,
                                ENC_BIG_ENDIAN);
            offset += 1;

            if ((length < 128) && (length % 8 == 0)) {
                addr_len++;
            }

            ti_dst = proto_tree_add_text(tree, tvb, offset, addr_len,
                                         "Destination: %s", ip6_to_str(&addr));

            /* add it to the top level line */
            proto_item_append_text(ti,"  %c   %s/%u", first ? '=':',',
                                   ip6_to_str(&addr), length);

            if (unreachable) {
                expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
            }
        }
        first = FALSE;
    }
    return(offset);
}

/**
 *@fn int dissect_eigrp_ipx_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                packet_info *pinfo, int offset, int unreachable)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect all IPX address from offset though the end of the packet
 */
static int
dissect_eigrp_ipx_addr (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                        packet_info *pinfo, int offset, int unreachable)
{
    proto_item *ti_dst;

    ti_dst = proto_tree_add_item(tree, hf_eigrp_ipx_dest, tvb, offset, 4,
                                 ENC_NA);

    /* add it to the top level line */
    proto_item_append_text(ti,"  =   %s",
                           tvb_ipxnet_to_string(tvb, offset));

    if (unreachable) {
        expert_add_info(pinfo, ti_dst, &ei_eigrp_unreachable);
    }

    offset +=4;
    return(offset);
}

/**
 *@fn int dissect_eigrp_service (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                               packet_info *pinfo, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect all SAF Services from offset though the end of the packet. The
 * following represents the format of  a SAF Service:
 *
 *    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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |            Service            |         SubService            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                             GUID                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                             GUID(cont)                        |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                             GUID(cont)                        |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                             GUID(cont)                        |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |            Type               |           Length              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |        Reachability AFI       |    Reachability Port          |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |     Reachability Protocol     |    Reachability Addr          |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                      Reachability Addr(cont)                  |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                      Reachability Addr(cont)                  |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                      Reachability Addr(cont)                  |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |    Reachability Addr(cont)    |           Sequence            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |           Sequence(cont)      |\/\/\/    Service Data   \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 */
static int
dissect_eigrp_service (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                       packet_info *pinfo, int offset)
{
    int         afi, length, remaining;
    int         sub_offset;
    proto_item *sub_ti;
    proto_tree *sub_tree, *reach_tree;
    tvbuff_t   *sub_tvb, *reach_tvb;
    guint16     service, sub_service;

    remaining = tvb_length_remaining(tvb, offset);
    sub_tree = proto_tree_add_subtree(tree, tvb, offset, remaining, ett_eigrp_tlv_metric, &sub_ti, "SAF Service ");
    sub_tvb = tvb_new_subset(tvb, offset, remaining, -1);
    sub_offset = 0;

    for (; tvb_length_remaining(sub_tvb, sub_offset) > 0; ) {
        service = tvb_get_ntohs(sub_tvb, sub_offset);
        proto_item_append_text(sub_ti, "%c %s", (sub_offset == 0 ? '=':','),
                               val_to_str_const(service, eigrp_saf_srv2string, ""));

        sub_service = tvb_get_ntohs(sub_tvb, sub_offset+2);
        proto_item_append_text(ti, "%c %u:%u", (sub_offset == 0 ? '=':','),
                               service, sub_service);

        proto_tree_add_item(sub_tree, hf_eigrp_saf_service, sub_tvb,
                            sub_offset, 2, ENC_BIG_ENDIAN);
        sub_offset += 2;
        proto_tree_add_item(sub_tree, hf_eigrp_saf_subservice, sub_tvb,
                            sub_offset, 2, ENC_BIG_ENDIAN);
        sub_offset += 2;
        proto_tree_add_item(sub_tree, hf_eigrp_saf_guid, sub_tvb,
                            sub_offset, GUID_LEN, ENC_BIG_ENDIAN);
        sub_offset += GUID_LEN;

        proto_tree_add_item(sub_tree, hf_eigrp_saf_data_type, sub_tvb,
                            sub_offset, 2, ENC_BIG_ENDIAN);
        sub_offset += 2;
        length = tvb_get_ntohs(sub_tvb, sub_offset);
        proto_tree_add_item(sub_tree, hf_eigrp_saf_data_length, sub_tvb,
                            sub_offset, 2, ENC_BIG_ENDIAN);
        sub_offset += 2;

        /*
         * Reachability information
         */
        reach_tree = proto_tree_add_subtree(sub_tree, sub_tvb, sub_offset, 22,
                                       ett_eigrp_saf_reachability, NULL, "Reachability");
        reach_tvb = tvb_new_subset(sub_tvb, sub_offset, 22, -1);

        afi = tvb_get_ntohs(reach_tvb, 0);
        proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_afi,
                            reach_tvb, 0, 2, ENC_BIG_ENDIAN);
        proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_port,
                            reach_tvb, 2, 2, ENC_BIG_ENDIAN);
        proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_protocol,
                            reach_tvb, 4, 2, ENC_BIG_ENDIAN);

        switch (afi) {
        case EIGRP_AF_IPv4:
            proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_ipv4,
                                reach_tvb, 6, 4, ENC_BIG_ENDIAN);
            proto_tree_add_item(reach_tree, hf_eigrp_nullpad, reach_tvb, 10, 12,
                                ENC_NA);
            break;

        case EIGRP_AF_IPv6:
            proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_ipv6,
                                reach_tvb, 6, 16, ENC_NA);
            break;
        default:
            /* just print zeros... */
            proto_tree_add_item(reach_tree, hf_eigrp_saf_reachability_addr_hex,
                                reach_tvb, 6, 16, ENC_NA);
            break;
        }
        sub_offset += 22;

        proto_tree_add_item(sub_tree, hf_eigrp_saf_data_sequence, sub_tvb,
                            sub_offset, 4, ENC_BIG_ENDIAN);
        sub_offset += 4;

        if (length > 0) {
            tvbuff_t *xml_tvb;
            guint8 *test_string, *tok;

            /*
             * Service-Data is usually (but not always) plain text, specifically
             * XML. If it "looks like" XML (begins with optional white-space
             * followed by a '<'), try XML. Otherwise, try plain-text.
             */
            xml_tvb = tvb_new_subset_length(sub_tvb, sub_offset, length);
            test_string = tvb_get_string_enc(wmem_packet_scope(), xml_tvb, 0, (length < 32 ?
                                                                length : 32), ENC_ASCII);
            tok = strtok(test_string, " \t\r\n");

            if (tok && tok[0] == '<') {
                /* Looks like XML */
                dissector_try_string(media_type_table, "application/xml",
                                     xml_tvb, pinfo, sub_tree, NULL);
            } else {
                /* Try plain text */
                dissector_try_string(media_type_table, "text/plain",
                                     xml_tvb, pinfo, sub_tree, NULL);
            }
        }
        sub_offset += length;
    }

    offset += sub_offset;
    return(offset);
}

/**
 *@fn int dissect_eigrp_legacy_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the TLV Versions 1.2 (legacy) and 3.0 (deprecated) metric
 * sections. The following represents the 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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Scaled Delay                            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                    Scaled Bandwidth                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         MTU                                    |   Hopcount   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   | Reliability  |      Load     |  Internal Tag   |    Flag      |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 */
static int
dissect_eigrp_legacy_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;

    sub_tree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_eigrp_tlv_metric, NULL, "Legacy Metric");
    sub_tvb = tvb_new_subset(tvb, offset, 16, -1);

    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_delay, sub_tvb,
                        0, 4, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_bw, sub_tvb,
                        4, 4, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_mtu, sub_tvb,
                        8, 3, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_hopcount, sub_tvb,
                        11, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_rel, sub_tvb,
                        12, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_load, sub_tvb,
                        13, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_legacy_metric_intag, sub_tvb,
                        14, 1, ENC_BIG_ENDIAN);

    /* Decode the route flags field */
    dissect_eigrp_metric_flags(sub_tree, sub_tvb, 15, 1);

    offset += 16;
    return(offset);
}

/**
 *@fn int dissect_eigrp_ipx_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the IPX External data for the TLV versions 1.2 and 3.0.
 * The following represents the 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
 *                                   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *                                   |          Ext RouterID         |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Ext Router ID                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                Ext Autonomous System Number                   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                        Route Tag                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |  Ext Protocol  | Ext Flags    |     External Metric           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |      External Delay           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static int
dissect_eigrp_ipx_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;
    int         sub_offset = 0;

    sub_tree = proto_tree_add_subtree(tree, tvb, offset, 20, ett_eigrp_tlv_extdata, NULL, "External Data");
    sub_tvb = tvb_new_subset(tvb, offset, 20, -1);

    /* Decode the external route source info */
    proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_routerid, sub_tvb,
                        sub_offset, 6, ENC_NA);
    sub_offset += 6;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_as, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_tag, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_proto, sub_tvb,
                        sub_offset, 1, ENC_BIG_ENDIAN);
    sub_offset += 1;

    /* Decode the external route flags */
    dissect_eigrp_extdata_flags(sub_tree, sub_tvb, sub_offset);
    sub_offset += 1;

    /* and the rest of it... */
    proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_metric,
                        sub_tvb, sub_offset, 2, ENC_BIG_ENDIAN);
    sub_offset += 2;
    proto_tree_add_item(sub_tree, hf_eigrp_ipx_extdata_delay,
                        sub_tvb, sub_offset, 2, ENC_BIG_ENDIAN);
    sub_offset += 2;

    offset += sub_offset;
    return(offset);
}

/**
 *@fn int dissect_eigrp_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the external route data for TLV versions 1.2 and 3.0 for all
 * protocols except IPX. The following represents the 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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Ext Router ID                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                Ext Autonomous System Number                   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                        Route Tag                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                    External Metric                            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         Reserved             |   Ext Protocol  | Ext Flags    |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static int
dissect_eigrp_extdata (proto_tree *tree, tvbuff_t *tvb, int offset)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;
    int         sub_offset = 0;

    sub_tree = proto_tree_add_subtree(tree, tvb, offset, 20, ett_eigrp_tlv_extdata, NULL, "External Data");
    sub_tvb = tvb_new_subset(tvb, offset, 20, -1);

    /* Decode the external route source info */
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_origrid, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_as, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_tag, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_metric, sub_tvb,
                        sub_offset, 4, ENC_BIG_ENDIAN);
    sub_offset += 4;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_reserved, sub_tvb,
                        sub_offset, 2, ENC_BIG_ENDIAN);
    sub_offset += 2;
    proto_tree_add_item(sub_tree, hf_eigrp_extdata_proto, sub_tvb,
                        sub_offset, 1, ENC_BIG_ENDIAN);
    sub_offset += 1;

    /* Decode the external route flags */
    dissect_eigrp_extdata_flags(sub_tree, sub_tvb, sub_offset);
    sub_offset += 1;

    offset += sub_offset;
    return(offset);
}

/**
 *@fn int dissect_eigrp_nexthop (proto_tree *tree, tvbuff_t *tvb, guint16 afi, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] afi       IANA address family indicator
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the next hop field which is in the "route TLVs".  This function will
 * handle all the various protocol AFIs and return the appropriate number of
 * bytes processed
 */
static int
dissect_eigrp_nexthop (proto_tree *tree, tvbuff_t *tvb, guint16 afi, int offset)
{
    /* dissect dest information */
    switch (afi) {
    case EIGRP_SF_IPv4:
    case EIGRP_AF_IPv4:
        proto_tree_add_item(tree, hf_eigrp_ipv4_nexthop, tvb, offset, 4,
                            ENC_BIG_ENDIAN);
        offset += 4;
        break;

    case EIGRP_SF_IPv6:
    case EIGRP_AF_IPv6:
        proto_tree_add_item(tree, hf_eigrp_ipv6_nexthop, tvb, offset, 16,
                            ENC_NA);
        offset += 16;
        break;

    case EIGRP_AF_IPX:
        proto_tree_add_item(tree, hf_eigrp_ipx_nexthop_net, tvb, offset, 4,
                            ENC_NA);
        offset += 4;
        proto_tree_add_item(tree, hf_eigrp_ipx_nexthop_host, tvb, offset, 6,
                            ENC_NA);
        offset += 6;
        break;

    case EIGRP_SF_COMMON:
        break;

    default:
        break;
    }

    return(offset);
}

/**
 *@fn void dissect_eigrp_general_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                    packet_info *pinfo, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @par
 * General EIGRP parameters carry EIGRP management information and are not
 * specific to any one routed protocol.
 *
 */
static void
dissect_eigrp_general_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                           packet_info *pinfo, guint16 tlv)
{
    switch (tlv) {
    case EIGRP_TLV_PARAMETER:
        dissect_eigrp_parameter(tree, tvb, pinfo, ti);
        break;
    case EIGRP_TLV_AUTH:
        dissect_eigrp_auth_tlv(tree, tvb, pinfo, ti);
        break;
    case EIGRP_TLV_SEQ:
        dissect_eigrp_seq_tlv(tree, tvb, pinfo, ti);
        break;
    case EIGRP_TLV_SW_VERSION:
        dissect_eigrp_sw_version(tvb, tree, ti);
        break;
    case EIGRP_TLV_NEXT_MCAST_SEQ:
        dissect_eigrp_next_mcast_seq(tvb, tree, ti);
        break;
    case EIGRP_TLV_PEER_STUBINFO:
        dissect_eigrp_peer_stubinfo(tvb, tree);
        break;
    case EIGRP_TLV_PEER_TERMINATION:
        dissect_eigrp_peer_termination(pinfo, ti);
        break;
    case EIGRP_TLV_PEER_TIDLIST:
        dissect_eigrp_peer_tidlist(tree, tvb);
        break;
    default:
        expert_add_info_format(pinfo, ti, &ei_eigrp_tlv_type, "Unknown Generic TLV (0x%04x)", tlv);
        break;
    }
}

/**
 *@fn int dissect_eigrp_ipv4_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the Legacy IPv4 route TLV; handles both the internal and external
 * TLV types; This packet format is being deprecated and replaced with the
 * Multi-Protocol packet formats as of EIGRP Release-8.  This TLV format is used
 * to maintain backward compatibility between older version so EIGRP, "MTR"
 * EIGRP, and current shipping code.
 *
 *    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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                      IPv4 Nexthop                             |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Scaled Delay                            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                    Scaled Bandwidth                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         MTU                                    |   Hopcount   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   | Reliability  |      Load     |  Internal Tag   |   Flag       |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static int
dissect_eigrp_ipv4_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                        packet_info *pinfo, guint16 tlv)
{
    int offset      = 0;
    int unreachable = FALSE;

    proto_tree_add_item(tree, hf_eigrp_ipv4_nexthop, tvb, offset, 4,
                        ENC_BIG_ENDIAN);
    offset += 4;

    /* dissect external data if needed */
    if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
        offset = dissect_eigrp_extdata(tree, tvb, offset);
    }

    /* dissect the metric */
    offset = dissect_eigrp_legacy_metric(tree, tvb, offset);

    /* dissect addresses */
    offset = dissect_eigrp_ipv4_addr(ti, tree, tvb, pinfo, offset, unreachable);

    return offset;
}

/**
 *@fn void dissect_eigrp_atalk_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                  proto_item *ti, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @par
 * Dissect the legacy AppleTalk route TLV; handles both the internal and external
 * TLV type.  The following represents the format
 */
static void
dissect_eigrp_atalk_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                         guint16 tlv)
{
    int offset = 0;

    /* cable tlv? */
    if (EIGRP_TLV_AT_CBL == tlv) {
        proto_tree_add_text(tree, tvb, 0, 4, "AppleTalk Cable Range = %u-%u",
                            tvb_get_ntohs(tvb, 0), tvb_get_ntohs(tvb, 2));
        proto_tree_add_item(tree, hf_eigrp_atalk_routerid, tvb, 4, 4,
                            ENC_BIG_ENDIAN);
        proto_item_append_text(ti, ": Cable range= %u-%u, Router ID= %u",
                               tvb_get_ntohs(tvb, 0), tvb_get_ntohs(tvb, 2),
                               tvb_get_ntohl(tvb, 4));

    } else {
        proto_tree_add_text(tree, tvb, offset, 4, "NextHop Address = %u.%u",
                            tvb_get_ntohs(tvb, 0), tvb_get_ntohs(tvb, 2));
        offset += 4;

        /* dissect external data if needed */
        if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
            offset = dissect_eigrp_extdata(tree, tvb,offset);
        }

        /* dissect the metric */
        offset = dissect_eigrp_legacy_metric(tree, tvb, offset);

        /* dissect cable range */
        proto_tree_add_text(tree, tvb, offset, 4, "Cable range = %u-%u",
                            tvb_get_ntohs(tvb, 36), tvb_get_ntohs(tvb, 38));
        proto_item_append_text(ti, ": %u-%u",
                               tvb_get_ntohs(tvb, 36), tvb_get_ntohs(tvb, 38));
    }
    return;
}

/**
 *@fn void dissect_eigrp_ipv6_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @par
 * Dissect the Legacy IPv6 route TLV; handles both the internal and external
 * TLV types; This packet format is being deprecated and replaced with the
 * Multi-Protocol packet formats as of EIGRP Release-8.  This TLV format is used
 * to maintain backward compatibility between older version so EIGRP, "MTR"
 * EIGRP, and current shipping code.
 */
static void
dissect_eigrp_ipv6_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                        packet_info *pinfo, guint16 tlv)
{
    int offset      = 0;
    int unreachable = FALSE;

    proto_tree_add_item(tree, hf_eigrp_ipv6_nexthop, tvb, offset, 16,
                        ENC_NA);
    offset += 16;

    /* dissect external data if needed */
    if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
        offset = dissect_eigrp_extdata(tree, tvb, offset);
    }

    /* dissect the metric */
    offset = dissect_eigrp_legacy_metric(tree, tvb, offset);

    /* dissect addresses */
    dissect_eigrp_ipv6_addr(ti, tree, tvb, pinfo, offset, unreachable);
    return;
}

/**
 *@fn int dissect_eigrp_ipx_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                packet_info *pinfo, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the legacy IPX route TLV; handles both the internal and external
 * TLV type.  The following represents the 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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                         Nexthop Net                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                        Nexthop Host                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |  Nexthop Host(cont)           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 * Optional External Data:
 *                                   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *                                   |          Ext RouterID         |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Ext Router ID                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                Ext Autonomous System Number                   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                        Route Tag                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |  Ext Protocol  | Ext Flags    |    External Metric            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |     External Delay            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 *                                   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *                                   |           Scaled Delay        |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |           Scaled Delay        |      Scaled Bandwidth         |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         Scaled Bandwidth      |             MTU               |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |   MTU(cont)   |    Hopcount   | Reliability   |     Load      |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   | Internal Tag |      Flag      |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 *
 */
static int
dissect_eigrp_ipx_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                       packet_info *pinfo, guint16 tlv)
{
    int offset      = 0;
    int unreachable = FALSE;

    /* nexthop for route... */
    offset = dissect_eigrp_nexthop(tree, tvb, EIGRP_AF_IPX, offset);

    /* dissect external data if needed */
    if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
        offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
    }

    /* dissect the metric */
    offset = dissect_eigrp_legacy_metric(tree, tvb, offset);

    /* dissect addresses */
    offset = dissect_eigrp_ipx_addr(ti, tree, tvb, pinfo, offset, unreachable);

    return offset;
}

/**
 *@fn void dissect_eigrp_ipv4_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                 packet_info *pinfo, proto_item *ti, guint16 tlv)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in] ti        protocol item
 * @param[in] tlv       Specific TLV in to be dissected
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the Multi-Topology route TLV; This packet format has been deprecated
 * and replaced with the Multi-Protocol packet formats as of EIGRP Release-8. Of
 * course this means it will be around for a long long while. The following
 * represents the format
 *
 *    1       2                   3   0                   1         1
 *    6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
 *                                   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *                                   |           Reserved            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |   Topology Identifier         |       Family Identifier       |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Router ID                               |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Route Tag                               |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Scaled Delay                            |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                    Scaled Bandwidth                           |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         MTU                                    |   Hopcount   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   | Reliability  |      Load      |  Internal Tag   |    Flag     |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/         NextHop (Family Specific Length)          \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/          External Route Data (Optional)           \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/       Destination (Family Specific Length)        \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 */
static int
dissect_eigrp_multi_topology_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                                  packet_info *pinfo, guint16 tlv)
{
    guint16     afi;
    int         offset      = 2;
    int         unreachable = FALSE;

    /* tid for you */
    proto_tree_add_item(tree, hf_eigrp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    /* now it's all about the family */
    afi = tvb_get_ntohs(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    /* gota have an id... */
    proto_tree_add_item(tree, hf_eigrp_routerid, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

    /* tag.. your it! */
    proto_tree_add_item(tree, hf_eigrp_legacy_metric_tag, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

    /* dissect the metric */
    offset = dissect_eigrp_legacy_metric(tree, tvb, offset);

    /* dissect nexthop */
    offset = dissect_eigrp_nexthop(tree, tvb, afi, offset);

    /* dissect external data if needed */
    if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
        if (afi == EIGRP_AF_IPX) {
            offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
        } else {
            offset = dissect_eigrp_extdata(tree, tvb, offset);
        }
    }

    /* dissect dest information */
    switch (afi) {
    case EIGRP_AF_IPv4:
        offset = dissect_eigrp_ipv4_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;
    case EIGRP_AF_IPv6:
        offset = dissect_eigrp_ipv6_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;
    case EIGRP_AF_IPX:
        offset = dissect_eigrp_ipx_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;

    case EIGRP_SF_COMMON:
    case EIGRP_SF_IPv4:
    case EIGRP_SF_IPv6:
        offset = dissect_eigrp_service(ti, tree, tvb, pinfo, offset);
        break;

    default:
        proto_tree_add_expert(tree, pinfo, &ei_eigrp_afi, tvb, offset, -1);
    }

    return offset;
}

/**
 *@fn int dissect_eigrp_metric_comm (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 * @param[in] limit     maximum number of bytes which can be process
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect extended community attached to metric TLVs to support VPNv4
 * deployments, The following represents the 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
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *  |  Type high    |  Type low(*)  |                               |
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+          Value                |
 *  |                                                               |
 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static int
dissect_eigrp_metric_comm (proto_tree *tree, tvbuff_t *tvb, int offset, int limit)
{
    int comm_type;

    while (limit > 0) {
        comm_type = tvb_get_ntohs(tvb, offset);
        offset++;

        switch (comm_type) {
            /*
             * Tag for this route. It is present for all EIGRP VPNv4
             * routes, internal and external
             */
        case EIGRP_EXTCOMM_EIGRP:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_EIGRP): Flag(0x%02x) Tag(%u)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;
        case EIGRP_EXTCOMM_VRR:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_VRR)): RES(0x%02x) RID(0x%04x)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;

            /*
             * Vecmetric information for given EIGRP VPNv4 route,
             * applies to both internal and external
             */
        case EIGRP_EXTCOMM_DAD:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_DAD): AS(%u):SDLY(%u)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;
        case EIGRP_EXTCOMM_VRHB:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_VRHB): REL(%u) HOP(%u) SBW(%u)",
                                tvb_get_guint8(tvb, 0),
                                tvb_get_guint8(tvb, 1),
                                tvb_get_ntohl(tvb, 2));
            break;
        case EIGRP_EXTCOMM_SRLM:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_SRLM): RES(%u) LOAD(%u) MTU(%u)",
                                tvb_get_guint8(tvb, 0),
                                tvb_get_guint8(tvb, 1),
                                tvb_get_ntohl(tvb, 2));
            break;

            /*
             * External information for given EIGRP VPNv4 route,
             * applies to only to external routes
             */
        case EIGRP_EXTCOMM_SAR:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_SAR): xAS(%u) xRID(%u)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;
        case EIGRP_EXTCOMM_RPM:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_RPM): xProto(%u) xMETRIC(%u)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;

        case EIGRP_EXTCOMM_SOO_ASFMT:
        case EIGRP_EXTCOMM_SOO_ADRFMT:
            proto_tree_add_text(tree, tvb, offset, 8,
                                "Type(EIGRP_EXTCOMM_SOO): AS(%u) TAG(%u)",
                                tvb_get_ntohs(tvb, 0),
                                tvb_get_ntohl(tvb, 2));
            break;
        }

        /*on to the next */
        offset += 8;
        limit -= 8;

        if (0 != limit%8) {
            break;
        }

    }

    return(offset);
}

/**
 *@fn int dissect_eigrp_wide_metric_attr (proto_tree *tree, tvbuff_t *tvb,
 *                                        int offset, int limit)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 * @param[in] limit     maximum number of words which should be process
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the Metric Attributes which (optionally) are part of the wide-metric
 * route TLV.  Some of the attributes which effect the metric are controlled by
 * K6 which is now part of the Parameter TLV.  Also, eh extended community TLV is
 * no longer used, as it's now appended to the route
 */
static int
dissect_eigrp_wide_metric_attr (proto_tree *tree, tvbuff_t *tvb,
                                int offset, int limit)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;
    int         sub_offset;

    guint16 attr_offset = 0;
    guint8  attr_opcode = 0;

    limit *= 2;   /* words to bytes */

    sub_tree = proto_tree_add_subtree(tree, tvb, offset, limit, ett_eigrp_tlv_attr, NULL, "Attributes");
    sub_tvb    = tvb_new_subset(tvb, offset, limit, -1);
    sub_offset = 0;

    while (limit > 0) {
        attr_opcode = tvb_get_guint8(sub_tvb, sub_offset);
        proto_tree_add_item(sub_tree, hf_eigrp_attr_opcode, sub_tvb,
                            sub_offset, 1, ENC_BIG_ENDIAN);
        sub_offset += 1;

        attr_offset = tvb_get_guint8(sub_tvb, sub_offset) * 2;
        proto_tree_add_item(sub_tree, hf_eigrp_attr_offset, sub_tvb,
                            sub_offset, 1, ENC_BIG_ENDIAN);
        sub_offset += 1;

        switch (attr_opcode) {
        case EIGRP_ATTR_NOOP:
            break;

        case EIGRP_ATTR_SCALED:
            proto_tree_add_item(sub_tree, hf_eigrp_attr_scaled, sub_tvb,
                                sub_offset, 4, ENC_BIG_ENDIAN);
            break;

        case EIGRP_ATTR_TAG:
            proto_tree_add_item(sub_tree, hf_eigrp_attr_tag, sub_tvb,
                                sub_offset, 4, ENC_BIG_ENDIAN);
            break;

        case EIGRP_ATTR_COMM:
            dissect_eigrp_metric_comm(sub_tree,
                                      tvb_new_subset(sub_tvb, sub_offset, 8, -1),
                                      sub_offset, limit);
            break;

        case EIGRP_ATTR_JITTER:
            proto_tree_add_item(sub_tree, hf_eigrp_attr_jitter, sub_tvb,
                                sub_offset, 4, ENC_BIG_ENDIAN);
            break;

        case EIGRP_ATTR_QENERGY:
            proto_tree_add_item(sub_tree, hf_eigrp_attr_qenergy, sub_tvb,
                                sub_offset, 4, ENC_BIG_ENDIAN);
            break;

        case EIGRP_ATTR_ENERGY:
            proto_tree_add_item(sub_tree, hf_eigrp_attr_energy, sub_tvb,
                                sub_offset, 4, ENC_BIG_ENDIAN);
            break;

        default:
            break;
        }
        sub_offset += attr_offset;
        limit -= (EIGRP_ATTR_HDRLEN + attr_offset);
    }

    offset += sub_offset;
    return(offset);
}

/**
 *@fn int dissect_eigrp_wide_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] offset    current byte offset in packet being processed
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the latest-n-greatest "Wide"Metric" definition for EIGRP. This
 * definition was created to address the higher speed links and should handle
 * things until we break the speed of light *wink*
 *
 *    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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |    Offset    |   Priority     |  Reliability  |     Load      |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         MTU                                    |   Hopcount   |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                            Delay                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         Delay                 |         Bandwidth             |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                        Bandwidth                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |         Reserved              |           Flags               |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/        Extended Metrics (Variable Length)         \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 */
static int
dissect_eigrp_wide_metric (proto_tree *tree, tvbuff_t *tvb, int offset)
{
    proto_tree *sub_tree;
    tvbuff_t   *sub_tvb;
    gint8       attr_size = 0;
    guint64     big_num;

    sub_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_eigrp_tlv_metric, NULL, "Wide Metric");
    sub_tvb = tvb_new_subset(tvb, offset, 24, -1);

    attr_size = tvb_get_guint8(sub_tvb, 0);

    proto_tree_add_item(sub_tree, hf_eigrp_metric_offset,
                        sub_tvb, 0,  1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_priority,
                        sub_tvb, 1,  1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_rel,
                        sub_tvb, 2,  1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_load,
                        sub_tvb, 3,  1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_mtu,
                        sub_tvb, 4,  3, ENC_BIG_ENDIAN);
    proto_tree_add_item(sub_tree, hf_eigrp_metric_hopcount,
                        sub_tvb, 7,  1, ENC_BIG_ENDIAN);

    /* The one-way latency along an unloaded path to the destination
     * expressed in units of nanoseconds per kilobyte. This number is not
     * scaled, as is the case with scaled delay. A delay of 0xFFFFFFFFFFFF
     * indicates an unreachable route. */
    big_num = tvb_get_ntoh64(sub_tvb, 8);
    big_num >>= 16;
    if (big_num == G_GUINT64_CONSTANT(0x0000ffffffffffff)) {
        proto_tree_add_text(sub_tree, sub_tvb, 8, 6, "Delay: Infinity");
    } else {
        proto_tree_add_text(sub_tree, sub_tvb, 8, 6, "Delay: %" G_GINT64_MODIFIER "u", big_num);
    }

    /* The path bandwidth measured in kilobyte per second as presented by
     * the interface.  This number is not scaled, as is the case with scaled
     * bandwidth. A bandwidth of 0xFFFFFFFFFFFF indicates an unreachable
     * route.
     */
    big_num = tvb_get_ntoh64(sub_tvb, 14);
    big_num >>= 16;
    if (big_num == G_GUINT64_CONSTANT(0x0000ffffffffffff)) {
        proto_tree_add_text(sub_tree, sub_tvb, 14, 6, "Bandwidth: Infinity");
    } else {
        proto_tree_add_text(sub_tree, sub_tvb, 14, 6, "Bandwidth: %" G_GINT64_MODIFIER "u", big_num);
    }
    proto_tree_add_item(sub_tree, hf_eigrp_metric_reserved, sub_tvb, 20, 2,
                        ENC_BIG_ENDIAN);

    /* Decode the route flags field */
    dissect_eigrp_metric_flags(sub_tree, sub_tvb, 22, 2);
    offset += 24;

    /* any extended metric attributes? */
    if (attr_size > 0) {
        offset = dissect_eigrp_wide_metric_attr(tree, tvb, offset, attr_size);
    }

    return(offset);
}

/**
 *@fn int dissect_eigrp_multi_protocol_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
 *                                           packet_info *pinfo, guint16 tlv)

 *
 * @param[in,out] tree  detail dissection result
 * @param[in] tvb       packet data
 * @param[in] ti        protocol item
 * @param[in] pinfo     general data about the protocol
 *
 * @return int          number of bytes process
 *
 * @par
 * Dissect the Multi-Protocol (TLV Version 2.0) TLV format definition. The following
 * represents the 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
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |   Topology Identifier         |         Family Identifier     |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                       Router ID                               |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |                      Wide Metric                              |
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/        Extended Metrics (Variable Length)         \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/         NextHop (Family Specific Length)          \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/          External Route Data (Optional)           \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *   |\/\/\/       Destination (Family Specific Length)        \/\/\/|
 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 */
static int
dissect_eigrp_multi_protocol_tlv (proto_item *ti, proto_tree *tree, tvbuff_t *tvb,
                                  packet_info *pinfo, guint16 tlv)
{
    int         offset      = 0;
    guint16     afi;
    int         unreachable = FALSE;

    /* tid for you */
    proto_tree_add_item(tree, hf_eigrp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    /* now it's all about the family */
    afi = tvb_get_ntohs(tvb, offset);
    proto_tree_add_item(tree, hf_eigrp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    /* gota have an id... */
    proto_tree_add_item(tree, hf_eigrp_routerid, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;

    /* decode the wide metric */
    offset = dissect_eigrp_wide_metric(tree, tvb, offset);

    /* dissect nexthop */
    offset = dissect_eigrp_nexthop(tree, tvb, afi, offset);

    /* dissect external data if needed */
    if ((tlv & EIGRP_TLV_TYPEMASK) == EIGRP_TLV_EXTERNAL) {
        if (afi == EIGRP_AF_IPX) {
            offset = dissect_eigrp_ipx_extdata(tree, tvb, offset);
        } else {
            offset = dissect_eigrp_extdata(tree, tvb, offset);
        }
    }

    /* dissect dest information */
    switch (afi) {
    case EIGRP_AF_IPv4:
        offset = dissect_eigrp_ipv4_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;

    case EIGRP_AF_IPv6:
        offset = dissect_eigrp_ipv6_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;

    case EIGRP_AF_IPX:
        offset = dissect_eigrp_ipx_addr(ti, tree, tvb, pinfo, offset, unreachable);
        break;

    case EIGRP_SF_COMMON:
    case EIGRP_SF_IPv4:
    case EIGRP_SF_IPv6:
        offset = dissect_eigrp_service(ti, tree, tvb, pinfo, offset);
        break;

    default:
        proto_tree_add_expert(tree, pinfo, &ei_eigrp_afi, tvb, offset, -1);
    }

    return offset;
}

/**
 *@fn int dissect_eigrp (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, void *data)
 *
 * @param[in] tvb       packet data
 * @param[in] pinfo     general data about the protocol
 * @param[in,out] tree  detail dissection result
 *
 * @return int          0 if packet is not for this decoder
 *
 * @par
 * This function is called to dissect the packets presented to it. The packet
 * data is held in a special buffer referenced here as tvb. The packet info
 * structure contains general data about the protocol, and can update
 * information here. The tree parameter is where the detail dissection takes
 * place.
 */
#include <epan/in_cksum.h>

static int
dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    proto_item *ti;
    proto_tree *eigrp_tree        = NULL, *tlv_tree;
    guint       opcode, vrid;
    guint16     tlv, checksum, cacl_checksum;
    guint32     ack, size, offset = EIGRP_HEADER_LENGTH;

    /* Make entries in Protocol column and Info column on summary display */
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "EIGRP");

    /* This field shows up as the "Info" column in the display; you should use
     * it, if possible, to summarize what's in the packet, so that a user
     * looking at the list of packets can tell what type of packet it is. See
     * section 1.5 for more information.
     */
    col_clear(pinfo->cinfo, COL_INFO);

    opcode = tvb_get_guint8(tvb, 1);
    ack    = tvb_get_ntohl(tvb, 12);
    if ((opcode == EIGRP_OPC_HELLO) && (0 != ack)) {
        opcode = EIGRP_OPC_ACK;
    }

    col_add_str(pinfo->cinfo, COL_INFO,
                val_to_str(opcode, eigrp_opcode2string, "Unknown OpCode (0x%04x)"));

    /* A protocol dissector may be called in 2 different ways - with, or
     * without a non-null "tree" argument.
     * Note also that there is no guarantee, the first time the dissector is
     * called, whether "tree" will be null or not; your dissector must work
     * correctly, building or updating whatever state information is necessary,
     * in either case.
     */
    /* NOTE: The offset and length values in the call to
     * "proto_tree_add_item()" define what data bytes to highlight in the
     * hex display window when the line in the protocol tree display
     * corresponding to that item is selected.
     */

    /* create display subtree for the protocol */
    ti = proto_tree_add_protocol_format(tree, proto_eigrp, tvb, 0, -1,
                                        "Cisco EIGRP");
    eigrp_tree = proto_item_add_subtree(ti, ett_eigrp);
    proto_tree_add_item(eigrp_tree, hf_eigrp_version, tvb, 0, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(eigrp_tree, hf_eigrp_opcode, tvb, 1, 1,
                        ENC_BIG_ENDIAN);

    size          = tvb_length(tvb);
    checksum      = tvb_get_ntohs(tvb, 2);
    cacl_checksum = ip_checksum_tvb(tvb, 0, size);

    if (cacl_checksum == checksum) {
        proto_tree_add_text(eigrp_tree, tvb, 2, 2,
                            "Checksum: 0x%02x [incorrect]",
                            checksum);
        expert_add_info(pinfo, ti, &ei_eigrp_checksum_bad);
    } else {
        proto_tree_add_text(eigrp_tree, tvb, 2, 2,
                            "Checksum: 0x%02x [correct]", checksum);
    }

    /* Decode the EIGRP Flags Field */
    proto_tree_add_bitmask(eigrp_tree, tvb, 4, hf_eigrp_flags, ett_eigrp_flags,
                           eigrp_flag_fields, ENC_BIG_ENDIAN);

    proto_tree_add_item(eigrp_tree, hf_eigrp_sequence, tvb, 8, 4,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(eigrp_tree, hf_eigrp_acknowledge, tvb, 12, 4,
                        ENC_BIG_ENDIAN);

    /* print out what family we dealing with... */
    ti = proto_tree_add_item(eigrp_tree, hf_eigrp_vrid, tvb, 16, 2,
                             ENC_BIG_ENDIAN);
    vrid = (tvb_get_ntohs(tvb, 16) & EIGRP_VRID_MASK);
    proto_item_append_text(ti, " %s", val_to_str_const(vrid, eigrp_vrid2string, ""));

    /* print autonomous-system */
    proto_tree_add_item(eigrp_tree, hf_eigrp_as, tvb, 18, 2,
                        ENC_BIG_ENDIAN);

    switch (opcode) {
    case EIGRP_OPC_IPXSAP:
        call_dissector(ipxsap_handle,
                       tvb_new_subset_remaining(tvb, EIGRP_HEADER_LENGTH), pinfo,
                       eigrp_tree);
        break;

    default:
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
            tlv = tvb_get_ntohs(tvb, offset);

            /* it's a rose by the wrong name... */
            if (tlv == EIGRP_TLV_MTR_TIDLIST) {
                tlv = EIGRP_TLV_PEER_TIDLIST;
            }

            size =  tvb_get_ntohs(tvb, offset + 2);
            if (size == 0) {
                proto_tree_add_expert(eigrp_tree, pinfo, &ei_eigrp_tlv_len, tvb, offset, -1);
                return(tvb_length(tvb));
            }

            tlv_tree = proto_tree_add_subtree(eigrp_tree, tvb, offset, size, ett_eigrp_tlv, &ti,
                                     val_to_str(tlv, eigrp_tlv2string, "Unknown TLV (0x%04x)"));

            proto_tree_add_item(tlv_tree, hf_eigrp_tlv_type, tvb,
                                offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(tlv_tree, hf_eigrp_tlv_len, tvb,
                                (offset + 2), 2, ENC_BIG_ENDIAN);

            switch (tlv & EIGRP_TLV_RANGEMASK) {
            case EIGRP_TLV_GENERAL:
                dissect_eigrp_general_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
                break;

            case EIGRP_TLV_IPv4:
                dissect_eigrp_ipv4_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
                break;

            case EIGRP_TLV_ATALK:
                dissect_eigrp_atalk_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), tlv);
                break;

            case EIGRP_TLV_IPX:
                dissect_eigrp_ipx_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
                break;

            case EIGRP_TLV_IPv6:
                dissect_eigrp_ipv6_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)), pinfo, tlv);
                break;

            case EIGRP_TLV_MP:
                dissect_eigrp_multi_protocol_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)),
                                                 pinfo, tlv);
                break;

            case EIGRP_TLV_MTR:
                dissect_eigrp_multi_topology_tlv(ti, tlv_tree, tvb_new_subset_length(tvb, (offset + 4), (size - 4)),
                                                 pinfo, tlv);
                break;

            default:
                expert_add_info_format(pinfo, ti, &ei_eigrp_tlv_type, "Unknown TLV Group (0x%04x)", tlv);
            }

            offset += size;
        }
        break;
    }

    /* Return the amount of data this dissector was able to dissect */
    return(tvb_length(tvb));
}

/**
 *@fn void proto _ register _ eigrp (void)
 *
 * @usage
 *      you can not have the function name inside a comment or else Wireshark
 *      will fail with "duplicate protocol" error.  Don't you hate it when tools
 *      try to be to smart :(
 *
 * @par
 *      Register the protocol with Wireshark
 *      this format is require because a script is used to build the C function
 *      that calls all the protocol registration.
 */
void
proto_register_eigrp(void)
{
    /* Setup list of header fields  See Section 1.6.1 for details
     */
    static hf_register_info hf[] = {
        /*
         *
         * EIGRP Packet Header definitions
         *
         *    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
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         *   |Ver              |  Opcode       |          Checksum           |
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         *   |                          Flags                                |
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         *   |                      Sequence number                          |
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         *   |                    Acknowledgement number                     |
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         *   |  Virtual Router ID              | Autonomous system number    |
         *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         */
        { &hf_eigrp_version,
          { "Version", "eigrp.version",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Version - Version of EIGRP packet format", HFILL }
        },
        { &hf_eigrp_opcode,
          { "Opcode", "eigrp.opcode",
            FT_UINT8, BASE_DEC, VALS(eigrp_opcode2string), 0x0,
            "Opcode - Operation code indicating the message type", HFILL }
        },
        { &hf_eigrp_flags,
          { "Flags", "eigrp.flags",
            FT_UINT32, BASE_HEX, NULL, 0x0,
            "Flag - Initialization bit and is used in establishing "
            "a new neighbor relationship", HFILL }
        },
        { &hf_eigrp_sequence,
          { "Sequence", "eigrp.seq",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "Sequence number -- used to send messages reliably", HFILL }
        },
        { &hf_eigrp_acknowledge,
          { "Acknowledge", "eigrp.ack",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "Acknowledge number -- used to send messages reliably", HFILL }
        },
        { &hf_eigrp_vrid,
          { "Virtual Router ID", "eigrp.vrid",
            FT_UINT16, BASE_DEC, NULL, 0,
            "Virtual Router ID - For each Virtual Router, there is a separate topology "
            "table and routing/service table; even for matching AS. "
            "This field allows the gateway to select which set router to use.", HFILL }
        },
        { &hf_eigrp_as,
          { "Autonomous System", "eigrp.as",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Autonomous system number - Each AS has a separate topology table "
            "which for a give routing/service table. A gateway can participate "
            "in more than one AS. This field allows the gateway to"
            "select which set of topology tables to use.", HFILL }
        },

        /*
         * Define eigrp_flags bits here
         *
         * Init bit definition. First unicast transmitted Update has this
         * bit set in the flags field of the fixed header. It tells the neighbor
         * to send its full topology table.
         */
        { &hf_eigrp_flags_init,
          { "Init", "eigrp.flags.init",
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_INIT_FLAG,
            "Init - tells the neighbor to send its full topology table", HFILL }
        },

        /*
         * Conditionally Received - Any packet with the CR-bit set can
         * be accepted by an EIGRP speaker if and only if a previous Hello was
         * received with the SEQUENCE_TYPE TLV present.
         * This allows multicasts to be transmitted in order and reliably at the
         * same time as unicasts are transmitted.
         */
        { &hf_eigrp_flags_condrecv,
          { "Conditional Receive", "eigrp.flags.condrecv",
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_CR_FLAG,
            "Conditionally Received the next packet if address was in listed "
            "in the previous HELLO", HFILL }
        },

        /*
         * Restart flag is set in the hello and the init update
         * packets during the nsf signaling period.  A nsf-aware
         * router looks at the RS flag to detect if a peer is restarting
         * and maintain the adjacency. A restarting router looks at
         * this flag to determine if the peer is helping out with the restart.
         */
        { &hf_eigrp_flags_restart,
          { "Restart", "eigrp.flags.restart",
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_RS_FLAG,
            "Restart flag - Set in the HELLO and the initial "
            "UPDATE packets during the nsf signaling period.", HFILL },
        },

        /*
         * EOT bit.  The End-of-Table flag marks the end of the start-up updates
         * sent to a new peer.  A nsf restarting router looks at this flag to
         * determine if it has finished receiving the start-up updates from all
         * peers.  A nsf-aware router waits for this flag before cleaning up
         * the stale routes from the restarting peer.
         */
        { &hf_eigrp_flags_eot,
          { "End Of Table", "eigrp.flags.eot",
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), EIGRP_EOT_FLAG,
            "End-of-Table - Marks the end of the start-up UPDATES indicating the "
            "complete topology database has been sent to a new peer", HFILL }
        },

        /**
         * TLV type definitions.  Generic (protocol-independent) TLV types are
         * defined here.  Protocol-specific ones are defined later
         *
         *     +-----+------------------+
         *     |     |     |            |
         *     | Type| Len |    Vector  |
         *     |     |     |            |
         *     +-----+------------------+
         *
         * TLV type definitions.  Generic (protocol-independent) TLV types are
         * defined here.  Protocol-specific ones are defined elsewhere.
         *
         * EIGRP_PARAMETER              0x0001          parameter
         * EIGRP_AUTH                   0x0002          authentication
         * EIGRP_SEQUENCE               0x0003          sequenced packet
         * EIGRP_SW_VERSION             0x0004          software version
         * EIGRP_NEXT_MCAST_SEQ         0x0005          multicast sequence
         * EIGRP_PEER_STUBINFO          0x0006          stub information
         * EIGRP_PEER_TERMINATION       0x0007          peer termination
         */
        { &hf_eigrp_tlv_type,
          { "Type", "eigrp.tlv_type",
            FT_UINT16, BASE_HEX, VALS(eigrp_tlv2string), 0x0,
            "TLV Type", HFILL }
        },
        { &hf_eigrp_tlv_len,
          { "Length", "eigrp.tlv.len",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "TLV Length", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Parameters TLV
 */
        { &hf_eigrp_par_k1, { "K1", "eigrp.par.k1", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Bandwidth/Throughput Coefficient", HFILL }},
        { &hf_eigrp_par_k2, { "K2", "eigrp.par.k2", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Load Coefficient", HFILL }},
        { &hf_eigrp_par_k3, { "K3", "eigrp.par.k3", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Delay/Latency Coefficient", HFILL }},
        { &hf_eigrp_par_k4, { "K4", "eigrp.par.k4", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Reliability Coefficient", HFILL }},
        { &hf_eigrp_par_k5, { "K5", "eigrp.par.k5", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Reliability Coefficient", HFILL }},
        { &hf_eigrp_par_k6, { "K6", "eigrp.par.k6", FT_UINT8, BASE_DEC, NULL, 0x0,
                              "Extended Metric Coefficient", HFILL }},
        { &hf_eigrp_par_holdtime,
          { "Hold Time", "eigrp.par.holdtime", FT_UINT16, BASE_DEC, NULL, 0x0,
            "How long to ignore lost HELLO's", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Authentication TLV
 */
        { &hf_eigrp_auth_type,
          { "Type", "eigrp.auth.type",
            FT_UINT16, BASE_DEC, VALS(eigrp_auth2string), 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_auth_len,
          { "Length", "eigrp.auth.length",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_auth_keyid,
          { "Key ID", "eigrp.auth.keyid",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_auth_keyseq,
          { "Key Sequence", "eigrp.auth.keyseq",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_auth_digest,
          { "Digest", "eigrp.auth.digest",
            FT_BYTES, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Sequence TLV
 */
        { &hf_eigrp_seq_addrlen,
          { "Address length", "eigrp.seq.addrlen",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_seq_ipv4addr,
          { "IP Address", "eigrp.seq.ipv4addr",
            FT_IPv4, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_seq_ipv6addr,
          { "IPv6 Address", "eigrp.seq.ipv6addr",
            FT_IPv6, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Next Multicast Sequence
 */
        /*
         * This was added to the hello containing the sequence TLV so that the
         * hello packet could be more tightly bound to the multicast packet bearing
         * the CR bit that follows it.  The sequence number of the impending multicast
         * is carried herein.
         */
        { &hf_eigrp_next_mcast_seq,
          { "Multicast Sequence", "eigrp.next_mcast_seq",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Peer Stub Information TLV
 */
        { &hf_eigrp_stub_flags,
          { "Stub Options", "eigrp.stub_options",
            FT_UINT16, BASE_HEX, NULL, 0x0,
            NULL, HFILL }
        },

        /*
         * Define eigrp_stub_flags bits here
         */
        { &hf_eigrp_stub_flags_connected,
          { "Connected", "eigrp.stub_options.connected",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_CONNECTED,
            NULL, HFILL }
        },
        { &hf_eigrp_stub_flags_static,
          { "Static", "eigrp.stub_options.static",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_STATIC,
            NULL, HFILL }
        },
        { &hf_eigrp_stub_flags_summary,
          { "Summary", "eigrp.stub_options.summary",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_SUMMARY,
            NULL, HFILL }
        },
        { &hf_eigrp_stub_flags_redist,
          { "Redistributed", "eigrp.stub_options.redist",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_REDIST,
            NULL, HFILL }
        },
        { &hf_eigrp_stub_flags_leakmap,
          { "Leak-Map", "eigrp.stub_options.leakmap",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_LEAKING,
            NULL, HFILL }
        },
        { &hf_eigrp_stub_flags_recvonly,
          { "Receive-Only", "eigrp.stub_options.recvonly",
            FT_BOOLEAN, 16, TFS(&tfs_set_notset), EIGRP_PEER_ALLOWS_RCVONLY,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Peer Termination TLV
 */
        /* Place holder - this TLV has no options */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP 3.0 Vector Header  (deprecated)
 */
        /*
         * common header for all version 3 tlvs
         */
        { &hf_eigrp_tid,
          { "Topology", "eigrp.tid",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_afi,
          { "AFI", "eigrp.afi",
            FT_UINT16, BASE_DEC, VALS(eigrp_afi2string), 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP TLV 1.2 (legacy) and TLV 3.0 Metric (deprecated) definition
 */
        { &hf_eigrp_legacy_metric_delay,
          { "Scaled Delay", "eigrp.old_metric.delay",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "delay, in 39.1 nanosec interments", HFILL }
        },
        { &hf_eigrp_legacy_metric_bw,
          { "Scaled BW", "eigrp.old_metric.bw",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "bandwidth, in units of 1 Kbit/sec", HFILL }
        },
        { &hf_eigrp_legacy_metric_mtu,
          { "MTU", "eigrp.old_metric.mtu",
            FT_UINT24, BASE_DEC, NULL, 0x0,
            "MTU, in octets", HFILL }
        },
        { &hf_eigrp_legacy_metric_hopcount,
          { "Hop Count", "eigrp.old_metric.hopcount",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Number of hops to destination", HFILL }
        },
        { &hf_eigrp_legacy_metric_rel,
          { "Reliability", "eigrp.old_metric.rel",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "percent packets successfully tx/rx", HFILL }
        },
        { &hf_eigrp_legacy_metric_load,
          { "Load", "eigrp.old_metric.load",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "percent of channel occupied", HFILL }
        },
        { &hf_eigrp_legacy_metric_intag,
          { "Route Tag", "eigrp.old_metric.intag",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Internal Route Tag", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP 3.0 TIDLIST TLV  (only survivor in MTR)
 */
        { &hf_eigrp_tidlist_tid,
          { "TID List", "eigrp.tidlist",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_tidlist_flags,
          { "TID List Flags", "eigrp.tidlist.flags",
            FT_UINT16, BASE_HEX, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_tidlist_len,
          { "TID List Size", "eigrp.tidlist.len",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_routerid,
          { "RouterID", "eigrp.routerid",
            FT_IPv4, BASE_NONE, NULL, 0x0,
            "Router ID of injecting router", HFILL }
        },
        { &hf_eigrp_legacy_metric_tag,
          { "Tag", "eigrp.old_metric.tag",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "route tag", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * PDM opaque flag field definitions
 */
        { &hf_eigrp_metric_flags_srcwd,
          { "Source Withdraw", "eigrp.metric.flags.srcwd",
            FT_BOOLEAN, 8, TFS(&tfs_true_false), EIGRP_OPAQUE_SRCWD,
            "Route Source Withdraw", HFILL }
        },
        { &hf_eigrp_metric_flags_active,
          { "Route is Active", "eigrp.metric.flags.active",
            FT_BOOLEAN, 8, TFS(&tfs_true_false), EIGRP_OPAQUE_ACTIVE,
            "Route is currently in active state", HFILL }
        },
        { &hf_eigrp_metric_flags_repl,
          { "Route is Replicated", "eigrp.metric.flags.repl",
            FT_BOOLEAN, 8, TFS(&tfs_true_false), EIGRP_OPAQUE_REPL,
            "Route is replicated from different tableid", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP TLV 1.2/3.0 ExtData Definitions
 */
        { &hf_eigrp_extdata_origrid,
          { "Originating RouterID", "eigrp.extdata.origrid",
            FT_IPv4, BASE_NONE, NULL, 0x0,
            "Router ID of redistributing router", HFILL }
        },

        { &hf_eigrp_extdata_as,
          { "Originating A.S.", "eigrp.extdata.as",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "Autonomous System of redistributing protocol", HFILL }
        },

        { &hf_eigrp_extdata_tag,
          { "Administrative Tag", "eigrp.extdata.tag",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "Administrative Route Tag", HFILL }
        },
        { &hf_eigrp_extdata_metric,
          { "External Metric", "eigrp.extdata.metric",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            "Metric reported by redistributing protocol", HFILL }
        },
        { &hf_eigrp_extdata_reserved,
          { "Reserved", "eigrp.extdata.reserved",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },

        /* IPX ExtData Definitions */
        { &hf_eigrp_ipx_extdata_delay,
          { "External Delay", "eigrp.extdata.ipx_delay",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Delay reported by redistributing protocol", HFILL }
        },
        { &hf_eigrp_ipx_extdata_metric,
          { "External Metric", "eigrp.extdata.ipx_metric",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Delay reported by redistributing protocol", HFILL }
        },

        { &hf_eigrp_extdata_proto,
          { "External Protocol ID", "eigrp.extdata.proto",
            FT_UINT8, BASE_DEC, VALS(eigrp_proto2string), 0x0,
            NULL, HFILL }
        },

        { &hf_eigrp_extdata_flag_ext,
          { "Route is External", "eigrp.opaque.flag.ext",
            FT_BOOLEAN, 8, TFS(&tfs_true_false), EIGRP_OPAQUE_EXT,
            "External route", HFILL }
        },
        { &hf_eigrp_extdata_flag_cd,
          { "Route is Candidate Default", "eigrp.opaque.flag.cd",
            FT_BOOLEAN, 8, TFS(&tfs_true_false), EIGRP_OPAQUE_CD,
            "Candidate-Default route", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP TLV 2.0 "Wide" Metric format definition
 */
        /* Number of 16bit words in the metric section, used to determine the
         * start of the destination/attribute information.
         */
        { &hf_eigrp_metric_offset,
          { "Offset", "eigrp.metric.offset",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Number of 16bit words to reach the start of the"
            "destination/attribute information", HFILL }
        },

        /* Priority of the prefix when transmitting a group of destination
         * addresses to neighboring routers. A priority of zero indicates no
         * priority is set.
         */
        { &hf_eigrp_metric_priority,
          { "Priority", "eigrp.metric.priority",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Priority of the prefix for ordering transmission", HFILL }
        },

        /** The current error rate for the path. Measured as an error
         * percentage. A value of 255 indicates 100% reliability
         */
        { &hf_eigrp_metric_rel,
          { "Reliability", "eigrp.metric.reliability",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "percent packets successfully tx/rx", HFILL }
        },

        /** The load utilization of the path to the destination. Measured as a
         * percentage of load. A value of 255 indicates 100% load.
         */
        { &hf_eigrp_metric_load,
          { "Load", "eigrp.metric.load",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "percent of channel occupied", HFILL }
        },

        /** The minimum maximum transmission unit size for the path to the
         * destination. Not used in metric calculation, but available to
         * underlying protocols
         */
        { &hf_eigrp_metric_mtu,
          { "MTU", "eigrp.metric.mtu",
            FT_UINT24, BASE_DEC, NULL, 0x0,
            "MTU, in octets", HFILL }
        },

        /** number of router traversals to the destination */
        { &hf_eigrp_metric_hopcount,
          { "Hop Count", "eigrp.metric.hopcount",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Number of hops to destination", HFILL }
        },

        /* Reserved - Transmitted as 0x0000 */
        { &hf_eigrp_metric_reserved,
          { "Reserved", "eigrp.metric.reserved",
            FT_UINT16, BASE_HEX, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * EIGRP TLV 2.0 Extended Metric Attributes
 */
        { &hf_eigrp_attr_opcode,
          { "Opcode", "eigrp.attr.opcode",
            FT_UINT8, BASE_DEC, VALS(eigrp_attr_opcode2string), 0x0,
            "Opcode - Operation code indicating the attribute type", HFILL }
        },
        { &hf_eigrp_attr_offset,
          { "Offset", "eigrp.attr.offset",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            "Number of 2 byte words of data", HFILL }
        },
        { &hf_eigrp_attr_scaled,
          { "Legacy Metric", "eigrp.attr.scaled",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Metric calculated from legacy TLVs", HFILL }
        },
        { &hf_eigrp_attr_tag,
          { "Tag", "eigrp.attr.tag",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Tag assigned by admin for dest", HFILL }
        },
        { &hf_eigrp_attr_jitter,
          { "Jitter", "eigrp.attr.jitter",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Variation in path delay", HFILL }
        },
        { &hf_eigrp_attr_qenergy,
          { "Q-Energy", "eigrp.attr.qenergy",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Non-Active energy usage along path", HFILL }
        },
        { &hf_eigrp_attr_energy,
          { "Energy", "eigrp.attr.energy",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            "Active energy usage along path", HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * IPv4 specific address definitions
 */
        { &hf_eigrp_ipv4_nexthop,
          { "NextHop", "eigrp.ipv4.nexthop",
            FT_IPv4, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_ipv4_prefixlen,
          { "Prefix Length", "eigrp.ipv4.prefixlen",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * IPv6 specific address definitions
 */
        { &hf_eigrp_ipv6_nexthop,
          { "NextHop", "eigrp.ipv6.nexthop",
            FT_IPv6, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },

        { &hf_eigrp_ipv6_prefixlen,
          { "Prefix Length", "eigrp.ipv6.prefixlen",
            FT_UINT8, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * IPX specific address definitions
 */
        { &hf_eigrp_ipx_nexthop_net,
          { "NextHop Net", "eigrp.ipx.nexthop_net",
            FT_IPXNET, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_ipx_nexthop_host,
          { "NextHop Host", "eigrp.ipx.nexthop_host",
            FT_ETHER, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_ipx_extdata_routerid,
          { "External RouterID", "eigrp.ipx.routerid",
            FT_ETHER, BASE_NONE, NULL, 0x0,
            "Router ID of redistributing router", HFILL }
        },
        { &hf_eigrp_ipx_dest,
          { "Destination", "eigrp.ipx.dest",
            FT_IPXNET, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 * AppleTalk specific address definitions
 */
        { &hf_eigrp_atalk_routerid,
          { "AppleTalk Router ID", "eigrp.atalk.routerid",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Service Advertisement Framework definitions
 */
        { &hf_eigrp_saf_service,
          { "Service", "eigrp.saf.service",
            FT_UINT16, BASE_DEC, VALS(eigrp_saf_srv2string), 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_subservice,
          { "Sub-Service", "eigrp.saf.subservice",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_guid,
          { "GUID", "eigrp.saf.guid",
            FT_GUID, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_data_type,
          { "Type", "eigrp.saf.data.type",
            FT_UINT16, BASE_HEX, VALS(eigrp_saf_type2string), 0x0,
            "SAF Message Data Type", HFILL }
        },
        { &hf_eigrp_saf_data_length,
          { "Length", "eigrp.saf.data.length",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_data_sequence,
          { "Sequence", "eigrp.saf.data.sequence",
            FT_UINT32, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_afi,
          { "AFI", "eigrp.saf.data.reachability.afi",
            FT_UINT16, BASE_DEC, VALS(eigrp_afi2string), 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_port,
          { "Port", "eigrp.saf.data.reachability.port",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_protocol,
          { "Protocol", "eigrp.saf.data.reachability.protocol",
            FT_UINT16, BASE_DEC, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_addr_ipv4,
          { "IPv4 Addr", "eigrp.saf.data.reachability.addr_ipv4",
            FT_IPv4, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_addr_ipv6,
          { "IPv6 Addr", "eigrp.saf.data.reachability.addr_ipv6",
            FT_IPv6, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_eigrp_saf_reachability_addr_hex,
          { "Addr", "eigrp.saf.data.reachability.addr_hex",
            FT_BYTES, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },

        /* misc field used in a couple places */
        { &hf_eigrp_nullpad,
          { "Nullpad", "eigrp.nullpad",
            FT_BYTES, BASE_NONE, NULL, 0x0,
            NULL, HFILL }
        },
    };

    /* Setup protocol subtree array */
    static gint *ett[] = {
        /* header flag */
        &ett_eigrp,
        &ett_eigrp_flags,

        /* tlv specific */
        &ett_eigrp_tlv,
        &ett_eigrp_tlv_metric,
        &ett_eigrp_tlv_attr,
        &ett_eigrp_tlv_extdata,

        &ett_eigrp_tidlist,
        &ett_eigrp_stub_flags,
        &ett_eigrp_saf_reachability,

        /* metric tlv specific */
        &ett_eigrp_metric_flags,
        &ett_eigrp_extdata_flags,
    };

    static ei_register_info ei[] = {
        { &ei_eigrp_peer_termination, { "eigrp.peer_termination", PI_RESPONSE_CODE, PI_NOTE, "Peer Termination", EXPFILL }},
        { &ei_eigrp_auth_len, { "eigrp.auth.length.invalid", PI_MALFORMED, PI_WARN, "Invalid auth len", EXPFILL }},
        { &ei_eigrp_auth_type, { "eigrp.auth.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid auth type", EXPFILL }},
        { &ei_eigrp_seq_addrlen, { "eigrp.seq.addrlen.invalid", PI_MALFORMED, PI_ERROR, "Invalid address length", EXPFILL }},
        { &ei_eigrp_peer_termination_graceful, { "eigrp.peer_termination_graceful", PI_RESPONSE_CODE, PI_NOTE, "Peer Termination (Graceful Shutdown)", EXPFILL }},
        { &ei_eigrp_prefixlen, { "eigrp.prefixlen.invalid", PI_MALFORMED, PI_WARN, "Invalid prefix length", EXPFILL }},
        { &ei_eigrp_unreachable, { "eigrp.unreachable", PI_RESPONSE_CODE, PI_NOTE, "Unreachable", EXPFILL }},
        { &ei_eigrp_tlv_type, { "eigrp.tlv_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown TLV", EXPFILL }},
        { &ei_eigrp_afi, { "eigrp.afi.unknown", PI_PROTOCOL, PI_WARN, "Unknown AFI", EXPFILL }},
        { &ei_eigrp_checksum_bad, { "eigrp.checksum.bad", PI_CHECKSUM, PI_WARN, "Bad Checksum", EXPFILL }},
        { &ei_eigrp_tlv_len, { "eigrp.tlv.len.invalid", PI_MALFORMED, PI_ERROR, "Corrupt TLV (Length field set to 0)", EXPFILL }},
        { &ei_eigrp_tlv_trunc, { "eigrp.tlv.truncated", PI_MALFORMED, PI_ERROR, "Corrupt TLV (Truncated prematurely)", EXPFILL }},
    };

    expert_module_t* expert_eigrp;

    /* Register the protocol name and description */
    proto_eigrp = proto_register_protocol(
        "Enhanced Interior Gateway Routing Protocol",   /* name         */
        "EIGRP",                                        /* short name   */
        "eigrp"                                         /* abbrev       */
        );

    /* Required function calls to register the header fields and subtrees used */
    proto_register_field_array(proto_eigrp, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));
    expert_eigrp = expert_register_protocol(proto_eigrp);
    expert_register_field_array(expert_eigrp, ei, array_length(ei));
}

/**
 *@fn void proto_reg_handoff_eigrp(void)
 *
 * @usage
 * This exact format is required because a script is used to find these
 * routines and create the code that calls these routines.
 *
 * @par
 * If this dissector uses sub-dissector registration add a registration routine.
 *
 * This form of the reg_handoff function is used if if you perform registration
 * functions which are dependent upon prefs.  If this function is registered as
 * a prefs callback (see prefs_register_protocol above) this function is also
 * called by preferences whenever "Apply" is pressed;
 *
 * In that case, it should accommodate being called more than once.
 */
void
proto_reg_handoff_eigrp(void)
{
    dissector_handle_t eigrp_handle;

    ipxsap_handle = find_dissector("ipxsap");
    media_type_table = find_dissector_table("media_type");

    eigrp_handle = new_create_dissector_handle(dissect_eigrp, proto_eigrp);

    dissector_add_uint("ip.proto", IP_PROTO_EIGRP, eigrp_handle);
    dissector_add_uint("ddp.type", DDP_EIGRP, eigrp_handle);
    dissector_add_uint("ipx.socket", IPX_SOCKET_EIGRP, eigrp_handle);
}

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */