summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mip6.c
blob: 9b57220716e68b74506701f1a9c9c6be35c364db (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
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
/* packet-mip6.c
 *
 * Definitions and Routines for Mobile IPv6 dissection (RFC 3775)
 * Copyright 2003 Oy L M Ericsson Ab <teemu.rinta-aho@ericsson.fi>
 *
 * FMIPv6 (RFC 4068) support added by Martin Andre <andre@clarinet.u-strasbg.fr>
 * Copyright 2006, Nicolas DICHTEL - 6WIND - <nicolas.dichtel@6wind.com>
 *
 * Modifications for NEMO packets (RFC 3963): Bruno Deniaud
 * (bdeniaud@irisa.fr, nono@chez.com) 12 Oct 2005
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * References:
 * RFC 3775, Mobility Support in IPv6
 * RFC 4285, Authentication Protocol for Mobile IPv6
 * RFC 4866, Enhanced Route Optimization for Mobile IPv6
 * RFC 5026, Mobile IPv6 Bootstrapping in Split Scenario
 * RFC 5094, Mobile IPv6 Vendor Specific Option
 * RFC 5096, Mobile IPv6 Experimental Messages
 * RFC 5213, Proxy Mobile IPv6
 * RFC 5555, Mobile IPv6 Support for Dual Stack Hosts and Routers (Errata)
 * RFC 5568. Mobile IPv6 Fast Handovers
 * RFC 5648, Multiple Care-of Addresses Registration
 * RFC 5844, IPv4 Support for Proxy Mobile IPv6
 * RFC 5949, Fast Handovers for Proxy Mobile IPv6
 * RFC 6275, Mobility Support in IPv6 (Obsoletes RFC 3775).
 * RFC 6602, Bulk Binding Update Support for Proxy Mobile IPv6
 * RFC 6705, Localized Routing for Proxy Mobile IPv6
 * RFC 6757, Access Network Identifier (ANI) Option for Proxy Mobile IPv6
 * RFC 7148, Prefix Delegation Support for Proxy Mobile IPv6
 *
 */

#include "config.h"

#include <epan/packet.h>
#include <epan/to_str.h>

#include <epan/ipproto.h>
#include <epan/expert.h>
#include <epan/ip_opts.h>
#include <epan/sminmpec.h>
#include <epan/addr_resolv.h>

#include <wsutil/str_util.h>

#include "packet-ntp.h"
#include "packet-gtpv2.h"
#include "packet-e164.h"
#include "packet-e212.h"
#include "packet-gsm_a_common.h"
#include "packet-ip.h"

void proto_register_mip6(void);
void proto_reg_handoff_mip6(void);

static dissector_handle_t mip6_handle;

#define UDP_PORT_PMIP6_CNTL 5436

static dissector_table_t mip6_vsm_dissector_table;

/* Mobility Header types */
typedef enum {
    MIP6_BRR    =  0,
    MIP6_HOTI   =  1,
    MIP6_MHCOTI =  2,
    MIP6_HOT    =  3,
    MIP6_MHCOT  =  4,
    MIP6_BU     =  5,
    MIP6_BA     =  6,
    MIP6_BE     =  7,
    MIP6_FBU    =  8,
    MIP6_FBACK  =  9,
    MIP6_FNA    = 10,
    MIP6_EMH    = 11,
    MIP6_HAS    = 12,
    MIP6_HB     = 13,
    MIP6_HI     = 14,
    MIP6_HAck   = 15,
    MIP6_BR     = 16,
    MIP6_LRI    = 17,
    MIP6_LRA    = 18
} mhTypes;

/* http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml */
static const value_string mip6_mh_types[] = {
    {MIP6_BRR,    "Binding Refresh Request"},           /* [RFC3775] */
    {MIP6_HOTI,   "Home Test Init"},                    /* [RFC3775] */
    {MIP6_MHCOTI, "Care-of Test Init"},                 /* [RFC3775] */
    {MIP6_HOT,    "Home Test"},                         /* [RFC3775] */
    {MIP6_MHCOT,  "Care-of Test"},                      /* [RFC3775] */
    {MIP6_BU,     "Binding Update"},                    /* [RFC3775] */
    {MIP6_BA,     "Binding Acknowledgement"},           /* [RFC3775] */
    {MIP6_BE,     "Binding Error"},                     /* [RFC3775] */
    {MIP6_FBU,    "Fast Binding Update"},               /* [RFC5568] */
    {MIP6_FBACK,  "Fast Binding Acknowledgment"},       /* [RFC5568] */
    {MIP6_FNA,    "Fast Neighbor Advertisement"},       /* [RFC5568] */
    {MIP6_EMH,    "Experimental Mobility Header"},      /* [RFC5096] */
    {MIP6_HAS,    "Home Agent Switch"},                 /* [RFC5142] */
    {MIP6_HB,     "Heartbeat"},                         /* [RFC5847] */
    {MIP6_HI,     "Handover Initiate"},                 /* [RFC5568] */
    {MIP6_HAck,   "Handover Acknowledge"},              /* [RFC5568] */
    {MIP6_BR,     "Binding Revocation"},                /* [RFC5846] */
    {MIP6_LRI,    "Localized Routing Initiation"},      /* [RFC6705] */
    {MIP6_LRA,    "Localized Routing Acknowledgment"},  /* [RFC6705] */

    {0,      NULL}
};
static value_string_ext mip6_mh_types_ext = VALUE_STRING_EXT_INIT(mip6_mh_types);

/* Mobility Option types
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
 */
typedef enum {
    MIP6_PAD1      =  0,        /*  0 Pad1 [RFC3775] */
    MIP6_PADN      =  1,        /*  1 PadN [RFC3775] */
    MIP6_BRA       =  2,        /*  2 Binding Refresh Advice */
    MIP6_ACOA      =  3,        /*  3 Alternate Care-of Address */
    MIP6_NI        =  4,        /*  4 Nonce Indices */
    MIP6_AUTD      =  5,        /*  5 Authorization Data */
    MIP6_MNP       =  6,        /*  6 Mobile Network Prefix Option */
    MIP6_MHLLA     =  7,        /*  7 Mobility Header Link-Layer Address option [RFC5568] */
    MIP6_MNID      =  8,        /*  8 MN-ID-OPTION-TYPE */
    MIP6_AUTH      =  9,        /*  9 AUTH-OPTION-TYPE */
    MIP6_MESGID    = 10,        /* 10 MESG-ID-OPTION-TYPE [RFC4285]  */
    MIP6_CGAPR     = 11,        /* 11 CGA Parameters Request [RFC4866]  */
    MIP6_CGAR      = 12,        /* 12 CGA Parameters [RFC4866]  */
    MIP6_SIGN      = 13,        /* 13 Signature [RFC4866]  */
    MIP6_PHKT      = 14,        /* 14 Permanent Home Keygen Token [RFC4866]  */
    MIP6_MOCOTI    = 15,        /* 15 Care-of Test Init [RFC4866]  */
    MIP6_MOCOT     = 16,        /* 16 Care-of Test [RFC4866]  */
    MIP6_DNSU      = 17,        /* 17 DNS-UPDATE-TYPE [RFC5026]  */
    MIP6_EM        = 18,        /* 18 Experimental Mobility Option [RFC5096]  */
    MIP6_VSM       = 19,        /* 19 Vendor Specific Mobility Option [RFC5094]  */
    MIP6_SSM       = 20,        /* 20 Service Selection Mobility Option [RFC5149]  */
    MIP6_BADFF     = 21,        /* 21 Binding Authorization Data for FMIPv6 (BADF) [RFC5568]  */
    MIP6_HNP       = 22,        /* 22 Home Network Prefix Option [RFC5213]   */
    MIP6_MOHI      = 23,        /* 23 Handoff Indicator Option [RFC5213]   */
    MIP6_ATT       = 24,        /* 24 Access Technology Type Option [RFC5213]  */
    MIP6_MNLLI     = 25,        /* 25 Mobile Node Link-layer Identifier Option [RFC5213]  */
    MIP6_LLA       = 26,        /* 26 Link-local Address Option [RFC5213   */
    MIP6_TS        = 27,        /* 27 Timestamp */
    MIP6_RC        = 28,        /* 28 Restart Counter [RFC5847] */
    MIP6_IPV4HA    = 29,        /* 29 IPv4 Home Address [RFC5555]  */
    MIP6_IPV4AA    = 30,        /* 30 IPv4 Address Acknowledgement [RFC5555] */
    MIP6_NATD      = 31,        /* 31 NAT Detection [RFC5555]  */
    MIP6_IPV4COA   = 32,        /* 32 IPv4 Care-of Address [RFC5555]  */
    MIP6_GREK      = 33,        /* 33 GRE Key Option [RFC5845]  */
    MIP6_MHIPV6AP  = 34,        /* 34 Mobility Header IPv6 Address/Prefix [RFC5568]  */
    MIP6_BI        = 35,        /* 35 Binding Identifier [RFC5648]  */
    MIP6_IPV4HAREQ = 36,        /* 36 IPv4 Home Address Request [RFC5844] */
    MIP6_IPV4HAREP = 37,        /* 37 IPv4 Home Address Reply [RFC5844] */
    MIP6_IPV4DRA   = 38,        /* 38 IPv4 Default-Router Address [RFC5844] */
    MIP6_IPV4DSM   = 39,        /* 39 IPv4 DHCP Support Mode [RFC5844] */
    MIP6_CR        = 40,        /* 40 Context Request Option [RFC5949] */
    MIP6_LMAA      = 41,        /* 41 Local Mobility Anchor Address Option [RFC5949] */
    MIP6_MNLLAII   = 42,        /* 42 Mobile Node Link-local Address Interface Identifier Option [RFC5949] */
    MIP6_TB        = 43,        /* 43 Transient Binding [RFC-ietf-mipshop-transient-bce-pmipv6-07] */
    MIP6_FS        = 44,        /* 44 Flow Summary Mobility Option [RFC-ietf-mext-flow-binding-11] */
    MIP6_FI        = 45,        /* 45 Flow Identification Mobility Option [RFC-ietf-mext-flow-binding-11]] */
    MIP6_RECAP     = 46,        /* 46 Redirect-Capability Mobility Option [RFC6463] */
    MIP6_REDIR     = 47,        /* 47 Redirect Mobility Option [RFC6463] */
    MIP6_LOAD_INF  = 48,        /* 48 Load Information Mobility Option [RFC6463] */
    MIP6_ALT_IP4_CO= 49,        /* 49 Alternate IPv4 Care-of Address [RFC6463] */
    MIP6_MNG       = 50,        /* 50 Mobile Node Group Identifier [RFC6602] */
    MIP6_MAG_IPv6  = 51,        /* 51 MAG IPv6 Address [RFC6705] */
    MIP6_ACC_NET_ID= 52,        /* 52 Access Network Identifier [RFC6757] */
    MIP6_DMNP      = 55         /* 55 Delegated Mobile Network Prefix Option [RFC7148] */

} optTypes;

/* Mobility Option types
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
 */

static const value_string mip6_mobility_options[] = {
    { MIP6_PAD1,       "Pad1"},                                         /* RFC3775 */
    { MIP6_PADN,       "PadN"},                                         /* RFC3775 */
    { MIP6_BRA,        "Binding Refresh Advice"},                       /* RFC3775 */
    { MIP6_ACOA,       "Alternate Care-of Address"},                    /* RFC3775 */
    { MIP6_NI,         "Nonce Indices"},                                /* RFC3775 */
    { MIP6_AUTD,       "Authorization Data"},                           /* RFC3775 */
    { MIP6_MNP,        "Mobile Network Prefix"},                        /* RFC3963 */
    { MIP6_MHLLA,      "Mobility Header Link-Layer Address"},           /* RFC5568 */
    { MIP6_MNID,       "Mobile Node Identifier"},                       /* RFC4283 MN-ID*/
    { MIP6_AUTH,       "AUTH"},                                         /* RFC4285 */
    { MIP6_MESGID,     "MESG-ID"},                                      /* RFC4285 */
    { MIP6_CGAPR,      "CGA Parameters Request"},                       /* RFC4866 */
    { MIP6_CGAR,       "CGA Parameters"},                               /* RFC4866 */
    { MIP6_SIGN,       "Signature"},                                    /* RFC4866 */
    { MIP6_PHKT,       "Permanent Home Keygen Token"},                  /* RFC4866 */
    { MIP6_MOCOTI,     "Care-of Test Init"},                            /* RFC4866 */
    { MIP6_MOCOT,      "Care-of Test"},                                 /* RFC4866 */
    { MIP6_DNSU,       "DNS-UPDATE-TYPE"},                              /* RFC5026 */
    { MIP6_EM,         "Experimental"},                                 /* RFC5096 */
    { MIP6_VSM,        "Vendor Specific"},                              /* RFC5094 */
    { MIP6_SSM,        "Service Selection"},                            /* RFC5149 */
    { MIP6_BADFF,      "Binding Authorization Data for FMIPv6 (BADF)"}, /* RFC5568 */
    { MIP6_HNP,        "Home Network Prefix"},                          /* RFC5213 */
    { MIP6_MOHI,       "Handoff Indicator"},                            /* RFC5213 */
    { MIP6_ATT,        "Access Technology Type"},                       /* RFC5213 */
    { MIP6_MNLLI,      "Mobile Node Link-layer Identifier"},            /* RFC5213 */
    { MIP6_LLA,        "Link-local Address"},                           /* RFC5213 */
    { MIP6_TS,         "Timestamp"},                                    /* RFC5213 */
    { MIP6_RC,         "Restart Counter"},                              /* RFC5847 */
    { MIP6_IPV4HA,     "IPv4 Home Address"},                            /* RFC5555 */
    { MIP6_IPV4AA,     "IPv4 Address Acknowledgement"},                 /* RFC5555 */
    { MIP6_NATD,       "NAT Detection"},                                /* RFC5555 */
    { MIP6_IPV4COA,    "IPv4 Care-of Address"},                         /* RFC5555 */
    { MIP6_GREK,       "GRE Key"},                                      /* RFC5845 */
    { MIP6_MHIPV6AP,   "Mobility Header IPv6 Address/Prefix"},          /* RFC5568 */
    { MIP6_BI,         "Binding Identifier"},                           /* RFC5648 */
    { MIP6_IPV4HAREQ,  "IPv4 Home Address Request"},                    /* RFC5844 */
    { MIP6_IPV4HAREP,  "IPv4 Home Address Reply"},                      /* RFC5844 */
    { MIP6_IPV4DRA,    "IPv4 Default-Router Address"},                  /* RFC5844 */
    { MIP6_IPV4DSM,    "IPv4 DHCP Support Mode"},                       /* RFC5844 */
    { MIP6_CR,         "Context Request"},                              /* RFC5949 */
    { MIP6_LMAA,       "Local Mobility Anchor Address"},                /* RFC5949 */
    { MIP6_MNLLAII,    "Mobile Node Link-local Address Interface Identifier"}, /* RFC5949 */
    { MIP6_TB,         "Transient Binding"},                            /* RFC6058 */
    { MIP6_FS,         "Flow Summary"},                                 /* RFC6089 */
    { MIP6_FI,         "Flow Identification"},                          /* RFC6089 */
    { MIP6_RECAP,      "Redirect-Capability"},                          /* RFC6463 */
    { MIP6_REDIR,      "Redirect"},                                     /* RFC6463 */
    { MIP6_LOAD_INF,   "Load Information"},                             /* RFC6463 */
    { MIP6_ALT_IP4_CO, "Alternate IPv4 Care-of Address"},               /* RFC6463 */
    { MIP6_MNG,        "Mobile Node Group Identifier"},                 /* RFC6602 */
    { MIP6_MAG_IPv6,   "MAG IPv6 Address"},                             /* RFC6705 */
    { MIP6_ACC_NET_ID, "Access Network Identifier"},                    /* RFC6757 */
    { MIP6_DMNP,       "Delegated Mobile Network Prefix"},              /* RFC7148 */

    { 0, NULL }
};
static value_string_ext mip6_mobility_options_ext = VALUE_STRING_EXT_INIT(mip6_mobility_options);

/*
 * Status Codes (DNS Update Mobility Option)
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-3
 */

static const value_string mip6_dnsu_status_values[] = {
    { 0, "DNS update performed"},                    /* [RFC5026] */
    /* 1-127 Unassigned   */
    { 128, "Reason unspecified"},                    /* [RFC5026] */
    { 129, "Administratively prohibited"},           /* [RFC5026] */
    { 130, "DNS Update Failed"},                     /* [RFC5026] */
    /* 131-255 Unassigned  */

    {   0, NULL }
};

static const true_false_string mip6_dnsu_r_flag_value = {
    "Mobile Node is requesting the HA to remove the DNS entry",
    "Mobile Node is requesting the HA to create or update a DNS entry"
};


/* Binding Update flag description */
static const true_false_string mip6_bu_a_flag_value = {
    "Binding Acknowledgement requested",
    "Binding Acknowledgement not requested"
};

static const true_false_string mip6_bu_h_flag_value = {
    "Home Registration",
    "No Home Registration"
};

static const true_false_string mip6_bu_l_flag_value = {
    "Link-Local Address Compatibility",
    "No Link-Local Address Compatibility"
};

static const true_false_string mip6_bu_k_flag_value = {
    "Key Management Mobility Compatibility",
    "No Key Management Mobility Compatibility"
};

static const true_false_string mip6_bu_m_flag_value = {
    "MAP Registration Compatibility",
    "No MAP Registration Compatibility",
};

static const true_false_string mip6_nemo_bu_r_flag_value = {
    "Mobile Router Compatibility",
    "No Mobile Router Compatibility"
};

static const true_false_string pmip6_bu_p_flag_value = {
    "Proxy Registration",
    "No Proxy Registration"
};

static const true_false_string mip6_bu_f_flag_value = {
    "Forcing UDP encapsulation used",
    "No Forcing UDP encapsulation"
};

static const true_false_string pmip6_bu_t_flag_value = {
    "TLV-header format used",
    "No TLV-header format"
};

static const true_false_string pmip6_bu_b_flag_value = {
    "Enable bulk binding update support",
    "Disable bulk binding update support"
};

static const true_false_string pmip6_ba_b_flag_value = {
    "Enabled bulk binding update support",
    "Disabled bulk binding update support"
};

/* Binding Acknowledgement status values
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
 */
static const value_string mip6_ba_status_value[] = {
    {   0, "Binding Update accepted" },
    {   1, "Accepted but prefix discovery necessary" },
    {   2, "GRE_KEY_OPTION_NOT_REQUIRED" },                 /* [RFC5845] */
    {   3, "GRE_TUNNELING_BUT_TLV_HEADER_NOT_SUPPORTED" },  /* [RFC5845] */
    {   4, "MCOA NOTCOMPLETE" },                            /* [RFC5648] */
    {   5, "MCOA RETURNHOME WO/NDP" },                      /* [RFC5648] */
    {   6, "PBU_ACCEPTED_TB_IGNORED_SETTINGSMISMATCH" },    /* [RFC-ietf-mipshop-transient-bce-pmipv6-07] */
    /* 7-127 Unassigned */

    { 128, "Reason unspecified" },
    { 129, "Administratively prohibited" },
    { 130, "Insufficient resources" },
    { 131, "Home registration not supported" },
    { 132, "Not home subnet" },
    { 133, "Not home agent for this mobile node" },
    { 134, "Duplicate Address Detection failed" },
    { 135, "Sequence number out of window" },
    { 136, "Expired home nonce index" },
    { 137, "Expired care-of nonce index" },
    { 138, "Expired nonces" },
    { 139, "Registration type change disallowed" },
    { 140, "Mobile Router Operation not permitted" },
    { 141, "Invalid Prefix" },
    { 142, "Not Authorized for Prefix" },
    { 143, "Mobile Network Prefix information unavailable" },
    { 145, "Proxy Registration not supported by the LMA" },
    { 146, "Proxy Registrations from this MAG not allowed" },
    { 147, "No home address for this NAI" },
    { 148, "Invalid Time Stamp Option" },
    { 149, "Permanent home keygen token exists" },                  /* [RFC4866] */
    { 150, "Non-null home nonce index expected" },                  /* [RFC4866] */
    { 151, "SERVICE_AUTHORIZATION_FAILED" },                        /* [RFC5149] */
    { 152, "PROXY_REG_NOT_ENABLED" },                               /* [RFC5213] */
    { 153, "NOT_LMA_FOR_THIS_MOBILE_NODE" },                        /* [RFC5213] */
    { 154, "MAG_NOT_AUTHORIZED_FOR_PROXY_REG" },                    /* [RFC5213] */
    { 155, "NOT_AUTHORIZED_FOR_HOME_NETWORK_PREFIX" },              /* [RFC5213] */
    { 156, "TIMESTAMP_MISMATCH" },                                  /* [RFC5213] */
    { 157, "TIMESTAMP_LOWER_THAN_PREV_ACCEPTED" },                  /* [RFC5213] */
    { 158, "MISSING_HOME_NETWORK_PREFIX_OPTION" },                  /* [RFC5213] */
    { 159, "BCE_PBU_PREFIX_SET_DO_NOT_MATCH" },                     /* [RFC5213] */
    { 160, "MISSING_MN_IDENTIFIER_OPTION" },                        /* [RFC5213] */
    { 161, "MISSING_HANDOFF_INDICATOR_OPTION" },                    /* [RFC5213] */
    { 162, "MISSING_ACCESS_TECH_TYPE_OPTION" },                     /* [RFC5213] */
    { 163, "GRE_KEY_OPTION_REQUIRED" },                             /* [RFC5845] */
    { 164, "MCOA MALFORMED" },                                      /* [RFC5648] */
    { 165, "MCOA NON-MCOA BINDING EXISTS" },                        /* [RFC5648] */
    { 166, "MCOA PROHIBITED" },                                     /* [RFC5648] */
    { 167, "MCOA UNKNOWN COA" },                                    /* [RFC5648] */
    { 168, "MCOA BULK REGISTRATION PROHIBITED" },                   /* [RFC5648] */
    { 169, "MCOA SIMULTANEOUS HOME AND FOREIGN PROHIBITED" },       /* [RFC5648] */
    { 170, "NOT_AUTHORIZED_FOR_IPV4_MOBILITY_SERVICE" },            /* [RFC5844] */
    { 171, "NOT_AUTHORIZED_FOR_IPV4_HOME_ADDRESS" },                /* [RFC5844] */
    { 172, "NOT_AUTHORIZED_FOR_IPV6_MOBILITY_SERVICE" },            /* [RFC5844] */
    { 173, "MULTIPLE_IPV4_HOME_ADDRESS_ASSIGNMENT_NOT_SUPPORTED" }, /* [RFC5844] */
    { 174, "Invalid Care-of Address" },                             /* [RFC6275] */
    { 175, "INVALID_MOBILE_NODE_GROUP_IDENTIFIER" },                /* [RFC6602] */
    { 176, "REINIT_SA_WITH_HAC" },                                  /* [RFC6618] */
    { 177, "NOT_AUTHORIZED_FOR_DELEGATED_MNP" },                    /* [RFC7148] */
    { 178, "REQUESTED_DMNP_IN_USE" },                               /* [RFC7148] */


    {   0, NULL }
};
static value_string_ext mip6_ba_status_value_ext = VALUE_STRING_EXT_INIT(mip6_ba_status_value);

/* Binding Error status values */
static const value_string mip6_be_status_value[] = {
    { 1, "Unknown binding for Home Address destination option" },
    { 2, "Unrecognized MH type value" },
    { 0, NULL }
};

/* Fast Binding Update flag description */
static const true_false_string fmip6_fbu_a_flag_value = {
    "Fast Binding Acknowledgement requested",
    "Fast Binding Acknowledgement not requested"
};

static const true_false_string fmip6_fbu_h_flag_value = {
    "Home Registration",
    "No Home Registration"
};

static const true_false_string fmip6_fbu_l_flag_value = {
    "Link-Local Address Compatibility",
    "No Link-Local Address Compatibility"
};

static const true_false_string fmip6_fbu_k_flag_value = {
    "Key Management Mobility Compatibility",
    "No Key Management Mobility Compatibility"
};

/* Fast Binding Acknowledgement status values */
static const value_string fmip6_fback_status_value[] = {
    {   0, "Fast Binding Update accepted" },
    {   1, "Accepted but use supplied NCoA" },
    { 128, "Reason unspecified" },
    { 129, "Administratively prohibited" },
    { 130, "Insufficient resources" },
    { 131, "Incorrect interface identifier length" },
    {   0, NULL }
};

/* Heartbeat flag description */
static const true_false_string mip6_hb_u_flag_value = {
    "Unsolicited Heartbeat Response",
    "Otherwise"
};

static const true_false_string mip6_hb_r_flag_value = {
    "Heartbeat Response",
    "Heartbeat Request"
};

/* MH LLA Option code */
static const value_string fmip6_lla_optcode_value[] = {
    {   2, "Link Layer Address of the MN" },
    {   0, NULL }
};

/* Mobile Node Identifier Option code */
static const value_string mip6_mnid_subtype_value[] = {
    {   1, "Network Access Identifier (NAI)" },
    {   0, NULL }
};


/* Enumerating Algorithms */
static const value_string mip6_auth_subtype_value[] = {
    {   0, "Reserved (not available for assignment)" },
    {   3, "HMAC_SHA1_SPI" },
    {   5, "Reserved for use by 3GPP2" },
    {   0, NULL }
};

/* mobile network prefix flag description */
static const true_false_string mip6_ipv4ha_p_flag_value = {
    "mobile network prefix requested",
    "mobile network prefix not requested"
};

/* NAT Detection Option F flag values */
static const true_false_string mip6_natd_f_flag_value = {
    "MUST use UDP encapsulation",
    "Do not use UDP encapsulation"
};


/* NAT Detection Option F flag values */
static const true_false_string mip6_ipv4dsm_s_flag_value = {
    "DHCP Server",
    "DHCP Relay"
};

/* Vendor-Specific Mobility Option */
static const value_string mip6_vsm_subtype_value[] = {
    {   0, NULL }
};

/* Vendor-Specific Mobility Option (3GPP TS29.282) */
static const value_string mip6_vsm_subtype_3gpp_value[] = {
    {   1, "Protocol Configuration Options" },
    {   2, "3GPP Specific PMIPv6 Error Code" },
    {   3, "PMIPv6 PDN GW IP Address" },
    {   4, "PMIPv6 DHCPv4 Address Allocation Procedure Indication" },
    {   5, "PMIPv6 Fully Qualified PDN Connection Set Identifier" },
    {   6, "PMIPv6 PDN type indication" },
    {   7, "Charging ID" },
    {   8, "Selection Mode" },
    {   9, "I-WLAN Mobility Access Point Name (APN)" },
    {  10, "Charging Characteristics" },
    {  11, "Mobile Equipment Identity (MEI)" },
    {  12, "MSISDN" },
    {  13, "Serving Network" },
    {  14, "APN Restriction" },
    {  15, "Maximum APN Restriction" },
    {  16, "Unauthenticated IMSI" },
    {  17, "PDN Connection ID" },
    {  18, "PGW Back-Off Time" },                          /* 3GPP TS 29.275 [7] */
    {  19, "Signalling Priority Indication" },             /* 3GPP TS 29.275 [7] */
    {  20, "Additional Protocol Configuration Options" },  /* 3GPP TS 29.275 [7] */
    {  21, "Static IP Address Allocation Indications" },   /* 3GPP TS 29.275 [7] */
    {  22, "MME / SGSN Identifier" },                      /* 3GPP TS 29.275 [7] */
    {  23, "End Marker Notification" },                    /* 3GPP TS 29.275 [7] */
    {  24, "Trusted WLAN Mode Indication" },               /* 3GPP TS 29.275 [7] */
    {  25, "UE Time Zone" },                               /* 3GPP TS 29.275 [7] */
    {  26, "Access Network Identifier Timestamp" },        /* 3GPP TS 29.275 [7] */
    {  27, "Logical Access ID" },                          /* 3GPP TS 29.275 [7] */
    {  28, "Origination Time Stamp" },                     /* 3GPP TS 29.275 [7] */
    {  29, "Maximum Wait Time" },                          /* 3GPP TS 29.275 [7] */
    {  30, "TWAN Capabilities" },                          /* 3GPP TS 29.275 [7] */

    {   0, NULL }
};
static value_string_ext mip6_vsm_subtype_3gpp_value_ext = VALUE_STRING_EXT_INIT(mip6_vsm_subtype_3gpp_value);


/* Handoff Indicator Option type
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-9
 */
static const value_string pmip6_hi_opttype_value[] = {
    {   0, "Reserved" },
    {   1, "Attachment over a new interface" },
    {   2, "Handoff between two different interfaces of the mobile node" },
    {   3, "Handoff between mobile access gateways for the same interface" },
    {   4, "Handoff state unknown" },
    {   5, "Handoff state not changed (Re-registration)" },
    {   0, NULL }
};

/* Access Technology Type Option type
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-10
 */
static const value_string pmip6_att_att_value[] = {
    {   0, "Reserved" },
    {   1, "Virtual" },
    {   2, "PPP" },
    {   3, "IEEE 802.3" },
    {   4, "IEEE 802.11a/b/g" },
    {   5, "IEEE 802.16e" },
    {   6, "3GPP GERAN" },
    {   7, "3GPP UTRAN" },
    {   8, "3GPP E-UTRAN" },
    {   9, "3GPP2 eHRPD" },
    {  10, "3GPP2 HRPD" },
    {  11, "3GPP2 1xRTT" },
    {  12, "3GPP2 UMB" },
    {   0, NULL }
};
static value_string_ext pmip6_att_att_value_ext = VALUE_STRING_EXT_INIT(pmip6_att_att_value);

/* IPv4 Home Address Reply Status Codes [RFC5844]
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#home-address-reply
 */

static const value_string pmip6_ipv4aa_status_values[] = {
    {   0, "Success" },
    /* 1-127 Unassigned */
    {   128, "Virtual" },
    {   129, "PPP" },
    {   130, "IEEE 802.3" },
    {   131, "IEEE 802.11a/b/g" },
    {   132, "IEEE 802.16e" },
    /* 133-255 Unassigned  */
    {   0, NULL }
};

/* PMIP6 BRI R. Trigger values */
static const value_string pmip6_bri_rtrigger[] = {
    { 0,     "Unspecified"},
    { 1,     "Administrative Reason"},
    { 2,     "Inter-MAG Handover - same Access Type"},
    { 3,     "Inter-MAG Handover - different Access Type"},
    { 4,     "Inter-MAG Handover - Unknown"},
    { 5,     "User Initiated Session(s) Termination"},
    { 6,     "Access Network Session(s) Termination"},
    { 7,     "Possible Out-of Sync BCE State"},
    /* 8-127 Unassigned  */
    { 128,   "Per-Peer Policy"},
    { 129,   "Revoking Mobility Node Local Policy"},
    /* 130-249 Unassigned  */
    /* 250-255 Reserved for Testing Purposes Only */
    { 0,        NULL},
};

/* PMIP6 BRI Status values */
static const value_string pmip6_bri_status[] = {
    { 0x00,     "Success"},
    { 0x01,     "Partial Success"},
    { 0x02,     "Binding Does NOT Exist"},
    { 0x03,     "IPv4 HoA Binding Does NOT Exist"},
    { 0x04,     "Global Revocation NOT Authorized"},
    { 0x05,     "CAN NOT Identify Binding"},
    { 0x06,     "Revocation Failed, MN is Attached"},
    { 0,        NULL},
};

#if 0
/* Handoff Indicator values */
static const range_string handoff_indicator[] = {
    { 0x00, 0x00,   "Reserved"                              },
    { 0x01, 0x01,   "Attachment over a new interface"       },
    { 0x02, 0x02,   "Handoff between two different interfaces of the mobile node"   },
    { 0x03, 0x03,   "Handoff between mobile access gateways for the same interface" },
    { 0x04, 0x04,   "Handoff state unknown"                                         },
    { 0x05, 0x05,   "Handoff state not changed (Re-registration)"                   },
    { 0x06, 0xff,   "Unassigned"                                                    },
    { 0,    0,      NULL                                                            }
};
#endif

/* Mobile Node Group Identifier Type
 * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobile-node-group-id-type
 */

static const value_string mip6_mng_id_type_vals[] = {
    { 0x00,     "Reserved"},
    { 0x01,     "Bulk Binding Update Group"},
    { 0,        NULL},
};

static const value_string pmip6_lra_status_vals[] = {
    { 0,     "Success"},
    { 128,   "Localized Routing Not Allowed"},
    { 129,   "MN Not Attached"},
    { 0,        NULL},
};

/* Delegated Mobile Network Prefix V Flag Values */
static const true_false_string mip6_dmnp_v_flag_value = {
    "IPv4 Prefix",
    "IPv6 Prefix"
};

/* Message lengths */
#define MIP6_BRR_LEN          2
#define MIP6_HOTI_LEN        10
#define MIP6_COTI_LEN        10
#define MIP6_HOT_LEN         18
#define MIP6_COT_LEN         18
#define MIP6_BU_LEN           6
#define MIP6_BA_LEN           6
#define MIP6_BE_LEN          18
#define FMIP6_FBU_LEN         6
#define FMIP6_FBACK_LEN       6
#define FMIP6_FNA_LEN         2
#define MIP6_EMH_LEN          0
#define MIP6_HB_LEN           6
#define MIP6_HI_LEN           4
#define MIP6_HAck_LEN         4
#define MIP6_BR_LEN           6
/* PMIP BRI */
#define PMIP6_BRI_LEN         6

/* Field offsets & lengths for mobility headers */
#define MIP6_PROTO_OFF        0
#define MIP6_HLEN_OFF         1
#define MIP6_TYPE_OFF         2
#define MIP6_RES_OFF          3
#define MIP6_CSUM_OFF         4
#define MIP6_DATA_OFF         6
#define MIP6_PROTO_LEN        1
#define MIP6_HLEN_LEN         1
#define MIP6_TYPE_LEN         1
#define MIP6_RES_LEN          1
#define MIP6_CSUM_LEN         2

#define MIP6_BRR_RES_OFF      6
#define MIP6_BRR_OPTS_OFF     8
#define MIP6_BRR_RES_LEN      2

#define MIP6_HOTI_RES_OFF     6
#define MIP6_HOTI_COOKIE_OFF  8
#define MIP6_HOTI_OPTS_OFF   16
#define MIP6_HOTI_RES_LEN     2
#define MIP6_HOTI_COOKIE_LEN  8

#define MIP6_COTI_RES_OFF     6
#define MIP6_COTI_COOKIE_OFF  8
#define MIP6_COTI_OPTS_OFF   16
#define MIP6_COTI_RES_LEN     2
#define MIP6_COTI_COOKIE_LEN  8

#define MIP6_HOT_INDEX_OFF    6
#define MIP6_HOT_COOKIE_OFF   8
#define MIP6_HOT_TOKEN_OFF   16
#define MIP6_HOT_OPTS_OFF    24
#define MIP6_HOT_INDEX_LEN    2
#define MIP6_HOT_COOKIE_LEN   8
#define MIP6_HOT_TOKEN_LEN    8

#define MIP6_COT_INDEX_OFF    6
#define MIP6_COT_COOKIE_OFF   8
#define MIP6_COT_TOKEN_OFF   16
#define MIP6_COT_OPTS_OFF    24
#define MIP6_COT_INDEX_LEN    2
#define MIP6_COT_COOKIE_LEN   8
#define MIP6_COT_TOKEN_LEN    8

#define MIP6_BU_SEQNR_OFF     6
#define MIP6_BU_FLAGS_OFF     8
#define MIP6_BU_RES_OFF       9
#define MIP6_BU_LIFETIME_OFF 10
#define MIP6_BU_OPTS_OFF     12
#define MIP6_BU_SEQNR_LEN     2
#define MIP6_BU_FLAGS_LEN     2
#define MIP6_BU_RES_LEN       0
#define MIP6_BU_LIFETIME_LEN  2

#define MIP6_BA_STATUS_OFF    6
#define MIP6_BA_FLAGS_OFF     7
#define MIP6_BA_SEQNR_OFF     8
#define MIP6_BA_LIFETIME_OFF 10
#define MIP6_BA_OPTS_OFF     12
#define MIP6_BA_STATUS_LEN    1
#define MIP6_BA_FLAGS_LEN     1
#define MIP6_BA_SEQNR_LEN     2
#define MIP6_BA_LIFETIME_LEN  2

#define MIP6_BE_STATUS_OFF    6
#define MIP6_BE_RES_OFF       7
#define MIP6_BE_HOA_OFF       8
#define MIP6_BE_OPTS_OFF     24
#define MIP6_BE_STATUS_LEN    1
#define MIP6_BE_RES_LEN       1
#define MIP6_BE_HOA_LEN      16

#define FMIP6_FBU_SEQNR_OFF     6
#define FMIP6_FBU_FLAGS_OFF     8
#define FMIP6_FBU_RES_OFF       9
#define FMIP6_FBU_LIFETIME_OFF 10
#define FMIP6_FBU_OPTS_OFF     12
#define FMIP6_FBU_SEQNR_LEN     2
#define FMIP6_FBU_FLAGS_LEN     1
#define FMIP6_FBU_RES_LEN       1
#define FMIP6_FBU_LIFETIME_LEN  2

#define FMIP6_FBACK_STATUS_OFF    6
#define FMIP6_FBACK_FLAGS_OFF     7
#define FMIP6_FBACK_SEQNR_OFF     8
#define FMIP6_FBACK_LIFETIME_OFF 10
#define FMIP6_FBACK_OPTS_OFF     12
#define FMIP6_FBACK_STATUS_LEN    1
#define FMIP6_FBACK_FLAGS_LEN     1
#define FMIP6_FBACK_SEQNR_LEN     2
#define FMIP6_FBACK_LIFETIME_LEN  2

#define FMIP6_FNA_RES_OFF     6
#define FMIP6_FNA_OPTS_OFF    8
#define FMIP6_FNA_RES_LEN     2

#define MIP6_HB_RES_OFF       6
#define MIP6_HB_FLAGS_OFF     7
#define MIP6_HB_SEQNR_OFF     8
#define MIP6_HB_OPTS_OFF     12
#define MIP6_HB_RES_LEN       1
#define MIP6_HB_FLAGS_LEN     1
#define MIP6_HB_SEQNR_LEN     4

#define MIP6_HI_SEQNR_OFF     6
#define MIP6_HI_FLAGS_OFF     8
#define MIP6_HI_CODE_OFF      9
#define MIP6_HI_OPTS_OFF     10
#define MIP6_HI_SEQNR_LEN     2
#define MIP6_HI_FLAGS_LEN     1
#define MIP6_HI_CODE_LEN      1

#define MIP6_HAck_SEQNR_OFF   6
#define MIP6_HAck_RES_OFF     8
#define MIP6_HAck_CODE_OFF    9
#define MIP6_HAck_OPTS_OFF   10
#define MIP6_HAck_SEQNR_LEN   2
#define MIP6_HAck_RES_LEN     1
#define MIP6_HAck_CODE_LEN    1

#define MIP6_BR_TYPE_OFF      6
#define MIP6_BR_TRGR_OFF      7
#define MIP6_BR_SEQNR_OFF     8
#define MIP6_BR_FLAGS_OFF    10
#define MIP6_BR_RES_OFF      11
#define MIP6_BR_OPTS_OFF     12
#define MIP6_BR_TYPE_LEN      1
#define MIP6_BR_TRGR_LEN      1
#define MIP6_BR_SEQNR_LEN     2
#define MIP6_BR_FLAGS_LEN     1
#define MIP6_BR_RES_LEN       1

/* PMIP BRI */
#define PMIP6_BRI_BRTYPE_OFF     6
#define PMIP6_BRI_RTRIGGER_OFF   7
#define PMIP6_BRI_STATUS_OFF     7
#define PMIP6_BRI_SEQNR_OFF      8
#define PMIP6_BRI_FLAGS_OFF     10
#define PMIP6_BRI_RES_OFF       11
#define PMIP6_BRI_BRTYPE_LEN     1
#define PMIP6_BRI_RTRIGGER_LEN   1
#define PMIP6_BRI_STATUS_LEN     1
#define PMIP6_BRI_SEQNR_LEN      2
#define PMIP6_BRI_FLAGS_LEN      2

/* Field offsets & field and option lengths for mobility options.
 * The option length does *not* include the option type and length
 * fields.  The field offsets, however, do include the type and
 * length fields. */
#define MIP6_BRA_LEN          2
#define MIP6_BRA_RI_LEN       2

#define MIP6_ACOA_LEN        16
#define MIP6_ACOA_ACOA_LEN   16

#define MIP6_NEMO_MNP_LEN         18
#define MIP6_NEMO_MNP_MNP_LEN     16

#define MIP6_NI_LEN           4
#define MIP6_NI_HNI_LEN       2
#define MIP6_NI_CNI_LEN       2

#define FMIP6_LLA_MINLEN      1
#define FMIP6_LLA_OPTCODE_LEN 1

#define MIP6_MNID_MINLEN      2
#define MIP6_MNID_SUBTYPE_LEN 1

#define MIP6_AUTH_MINLEN      6
#define MIP6_CGAPR_MINLEN     0
#define MIP6_CGAR_MINLEN      1
#define MIP6_SIGN_MINLEN      1
#define MIP6_PHKT_MINLEN      1
#define MIP6_MOCOTI_MINLEN    0
#define MIP6_MOCOT_MINLEN     8
#define MIP6_DNSU_MINLEN      5
#define MIP6_EM_MINLEN        1
#define MIP6_MESG_ID_LEN      8

#define MIP6_VSM_MINLEN       2
#define MIP6_VSM_VID_LEN      4
#define MIP6_VSM_SUBTYPE_LEN  1

#define MIP6_SSM_MINLEN       1

#define MIP6_BADFF_MINLEN     4

#define PMIP6_HI_LEN          2
#define PMIP6_HI_HI_LEN       1

#define PMIP6_ATT_LEN         2
#define PMIP6_ATT_ATT_LEN     1

#define PMIP6_MNLLI_MIN_LEN   1

#define PMIP6_LLA_LEN         16

#define PMIP6_TS_LEN          8

#define PMIP6_RC_LEN          4
#define PMIP6_RC_RC_LEN       4

#define MIP6_IPV4HA_LEN         6
#define MIP6_IPV4HA_PREFIXL_LEN 1
#define MIP6_IPV4HA_HA_LEN      4

#define MIP6_IPV4AA_LEN         6
#define MIP6_IPV4AA_STATUS_LEN  1
#define MIP6_IPV4AA_PREFIXL_LEN 1
#define MIP6_IPV4AA_HA_LEN      4

#define MIP6_NATD_LEN              6

#define MIP6_IPV4COA_LEN           6

#define PMIP6_GREK_MIN_LEN         2
#define PMIP6_GREK_ID_LEN          4

#define MIP6_MHIPV6AP_LEN      18

#define MIP6_BI_MIN_LEN            4

#define MIP6_IPV4HAREQ_LEN         6
#define MIP6_IPV4HAREQ_PREFIXL_LEN 1
#define MIP6_IPV4HAREQ_HA_LEN      4

#define MIP6_IPV4HAREP_LEN         6
#define MIP6_IPV4HAREP_STATUS_LEN  1
#define MIP6_IPV4HAREP_PREFIXL_LEN 1
#define MIP6_IPV4HAREP_HA_LEN      4

#define MIP6_IPV4DRA_LEN      6
#define MIP6_IPV4DRA_RES_LEN  2
#define MIP6_IPV4DRA_DRA_LEN  4

#define MIP6_IPV4DSM_LEN      2

#define MIP6_CR_MIN_LEN       4

#define MIP6_LMAA_MIN_LEN     6

#define MIP6_RECAP_LEN        2
#define MIP6_REDIR_MIN_LEN    6
#define MIP6_REDIR_FLAG_K     0x8000
#define MIP6_REDIR_FLAG_N     0x4000
#define MIP6_REDIR_FLAG_RSV   0x3FFF

#define MIP6_LOAD_INF_LEN     18
#define MIP6_ALT_IP4_LEN      4

#define MIP6_MNG_LEN          6

#define MIP6_MAG_IPv6_LEN    16

#define MIP6_ACC_NET_ID_MIN_LEN    3

#define MIP6_DMNP_MIN_LEN     6

static dissector_table_t ip_dissector_table;

/* Initialize the protocol and registered header fields */
static int proto_mip6 = -1;
static int proto_nemo = -1;
static int proto_mip6_option_pad1 = -1;
static int proto_mip6_option_padn = -1;
static int proto_mip6_option_bra = -1;
static int proto_mip6_option_acoa = -1;
static int proto_mip6_option_ni = -1;
static int proto_mip6_option_bad_auth = -1;
static int proto_mip6_option_mnp = -1;
static int proto_mip6_option_mhlla = -1;
static int proto_mip6_option_mnid = -1;
static int proto_mip6_option_auth = -1;
static int proto_mip6_option_mseg_id = -1;
static int proto_mip6_option_cgapr = -1;
static int proto_mip6_option_cgar = -1;
static int proto_mip6_option_sign = -1;
static int proto_mip6_option_phkt = -1;
static int proto_mip6_option_coti = -1;
static int proto_mip6_option_cot = -1;
static int proto_mip6_option_dnsu = -1;
static int proto_mip6_option_em = -1;
static int proto_mip6_option_vsm = -1;
static int proto_mip6_option_ssm = -1;
static int proto_mip6_option_badff = -1;
static int proto_mip6_option_hnp = -1;
static int proto_mip6_option_hi = -1;
static int proto_mip6_option_att = -1;
static int proto_mip6_option_mnlli = -1;
static int proto_mip6_option_lla = -1;
static int proto_mip6_option_ts = -1;
static int proto_mip6_option_rc = -1;
static int proto_mip6_option_ipv4ha = -1;
static int proto_mip6_option_ipv4aa = -1;
static int proto_mip6_option_natd = -1;
static int proto_mip6_option_ipv4coa = -1;
static int proto_mip6_option_grek = -1;
static int proto_mip6_option_mhipv6ap = -1;
static int proto_mip6_option_bi = -1;
static int proto_mip6_option_ipv4hareq = -1;
static int proto_mip6_option_ipv4harep = -1;
static int proto_mip6_option_ipv4dra = -1;
static int proto_mip6_option_ipv4dsm = -1;
static int proto_mip6_option_cr = -1;
static int proto_mip6_option_lmaa = -1;
static int proto_mip6_option_recap = -1;
static int proto_mip6_option_redir = -1;
static int proto_mip6_option_load_inf = -1;
static int proto_mip6_option_alt_ip4 = -1;
static int proto_mip6_option_mng = -1;
static int proto_mip6_option_mag_ipv6 = -1;
static int proto_mip6_option_acc_net_id = -1;
static int proto_mip6_option_dmnp = -1;

static int hf_mip6_proto = -1;
static int hf_mip6_hlen = -1;
static int hf_mip6_mhtype = -1;
static int hf_mip6_reserved = -1;
static int hf_mip6_csum = -1;

static int hf_mip6_hoti_cookie = -1;

static int hf_mip6_coti_cookie = -1;

static int hf_mip6_hot_nindex = -1;
static int hf_mip6_hot_cookie = -1;
static int hf_mip6_hot_token = -1;

static int hf_mip6_cot_nindex = -1;
static int hf_mip6_cot_cookie = -1;
/* static int hf_mip6_cot_token = -1; */

static int hf_mip6_bu_seqnr = -1;
static int hf_mip6_bu_a_flag = -1;
static int hf_mip6_bu_h_flag = -1;
static int hf_mip6_bu_l_flag = -1;
static int hf_mip6_bu_k_flag = -1;
static int hf_mip6_bu_m_flag = -1;
static int hf_mip6_nemo_bu_r_flag = -1;
static int hf_pmip6_bu_p_flag = -1;
static int hf_mip6_bu_f_flag = -1;
static int hf_pmip6_bu_t_flag = -1;
static int hf_pmip6_bu_b_flag = -1;
static int hf_mip6_bu_lifetime = -1;

static int hf_mip6_ba_status = -1;
static int hf_mip6_ba_k_flag = -1;
static int hf_mip6_nemo_ba_r_flag = -1;
static int hf_pmip6_ba_p_flag = -1;
static int hf_pmip6_ba_t_flag = -1;
static int hf_pmip6_ba_b_flag = -1;
static int hf_mip6_ba_seqnr = -1;
static int hf_mip6_ba_lifetime = -1;

static int hf_mip6_be_status = -1;
static int hf_mip6_be_haddr = -1;

static int hf_fmip6_fbu_seqnr = -1;
static int hf_fmip6_fbu_a_flag = -1;
static int hf_fmip6_fbu_h_flag = -1;
static int hf_fmip6_fbu_l_flag = -1;
static int hf_fmip6_fbu_k_flag = -1;
static int hf_fmip6_fbu_lifetime = -1;

static int hf_fmip6_fback_status = -1;
static int hf_fmip6_fback_k_flag = -1;
static int hf_fmip6_fback_seqnr = -1;
static int hf_fmip6_fback_lifetime = -1;

static int hf_mip6_has_num_addrs = -1;
static int hf_mip6_has_reserved = -1;
static int hf_mip6_has_address = -1;

static int hf_mip6_hb_u_flag = -1;
static int hf_mip6_hb_r_flag = -1;
static int hf_mip6_hb_seqnr = -1;

static int hf_mip6_hi_seqnr = -1;
static int hf_mip6_hi_s_flag = -1;
static int hf_mip6_hi_u_flag = -1;
static int hf_mip6_hi_code = -1;

static int hf_mip6_hack_seqnr = -1;
static int hf_mip6_hack_code = -1;

static int hf_mip6_opt_3gpp_reserved = -1;
static int hf_mip6_opt_3gpp_flag_m = -1;
static int hf_mip6_opt_3gpp_spec_pmipv6_err_code = -1;
static int hf_mip6_opt_3gpp_pdn_gw_ipv4_addr = -1;
static int hf_mip6_opt_3gpp_pdn_gw_ipv6_addr = -1;
static int hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind = -1;
static int hf_mip6_opt_3gpp_pdn_type = -1;
static int hf_mip6_opt_3gpp_pdn_ind_cause = -1;
static int hf_mip6_opt_3gpp_chg_id = -1;
static int hf_mip6_opt_3gpp_charging_characteristic = -1;
static int hf_mip6_opt_3gpp_mei = -1;
static int hf_mip6_opt_3gpp_msisdn = -1;
static int hf_mip6_opt_3gpp_apn_rest = -1;
static int hf_mip6_opt_3gpp_max_apn_rest = -1;
static int hf_mip6_opt_3gpp_imsi = -1;
static int hf_mip6_opt_3gpp_pdn_conn_id = -1;
static int hf_hf_mip6_opt_3gpp_lapi = -1;

static int hf_mip6_bra_interval = -1;

static int hf_mip6_acoa_acoa = -1;
static int hf_mip6_nemo_mnp_mnp = -1;
static int hf_mip6_nemo_mnp_pfl = -1;

static int hf_mip6_ni_hni = -1;
static int hf_mip6_ni_cni = -1;

static int hf_mip6_bad_auth = -1;

static int hf_fmip6_lla = -1;
static int hf_fmip6_lla_optcode = -1;

static int hf_mip6_mnid_subtype = -1;
static int hf_mip6_mnid_identifier = -1;
static int hf_mip6_vsm_vid = -1;
static int hf_mip6_vsm_subtype = -1;
static int hf_mip6_vsm_subtype_3gpp = -1;

static int hf_mip6_opt_ss_identifier = -1;

static int hf_mip6_opt_badff_spi = -1;
static int hf_mip6_opt_badff_auth = -1;

static int hf_mip6_opt_auth_sub_type = -1;
static int hf_mip6_opt_auth_mobility_spi = -1;
static int hf_mip6_opt_auth_auth_data = -1;
static int hf_mip6_opt_mseg_id_timestamp = -1;

static int hf_mip6_opt_cgar_cga_par = -1;
static int hf_mip6_opt_sign_sign = -1;
static int hf_mip6_opt_phkt_phkt = -1;
static int hf_mip6_opt_mocot_co_keygen_tok = -1;

static int hf_mip6_opt_dnsu_status = -1;
static int hf_mip6_opt_dnsu_flag_r = -1;
static int hf_mip6_opt_dnsu_mn_id = -1;

static int hf_mip6_opt_em_data = -1;

static int hf_pmip6_hi_hi = -1;
static int hf_pmip6_hi_reserved = -1;

static int hf_pmip6_att_reserved = -1;
static int hf_pmip6_att_att = -1;

static int hf_mip6_opt_mnlli_reserved = -1;
static int hf_mip6_opt_mnlli_lli = -1;

static int hf_pmip6_timestamp = -1;
static int hf_pmip6_rc = -1;
static int hf_mip6_ipv4ha_preflen = -1;
static int hf_mip6_ipv4ha_p_flag = -1;
static int hf_mip6_ipv4ha_ha = -1;
static int hf_mip6_ipv4ha_reserved = -1;
static int hf_mip6_ipv4aa_status = -1;

static int hf_mip6_opt_natd_f_flag = -1;
static int hf_mip6_opt_natd_reserved = -1;
static int hf_mip6_opt_natd_refresh_t = -1;

static int hf_mip6_opt_ipv4coa_reserved = -1;
static int hf_mip6_opt_ipv4coa_addr = -1;

static int hf_pmip6_gre_key = -1;
static int hf_mip6_opt_mhipv6ap_opt_code = -1;
static int hf_mip6_opt_mhipv6ap_prefix_l = -1;
static int hf_mip6_opt_mhipv6ap_ipv6_address = -1;
static int hf_mip6_opt_mhipv6ap_ipv6_address_prefix = -1;
static int hf_mip6_ipv4dra_reserved = -1;
static int hf_mip6_ipv4dra_dra = -1;

static int hf_mip6_ipv4dsm_reserved = -1;
static int hf_mip6_ipv4dsm_s_flag = -1;
static int hf_mip6_cr_reserved = -1;
static int hf_mip6_cr_req_type = -1;
static int hf_mip6_cr_req_length = -1;

static int hf_mip6_lmaa_opt_code = -1;
static int hf_mip6_lmaa_reserved = -1;
static int hf_mip6_lmaa_ipv4 = -1;
static int hf_mip6_lmaa_ipv6 = -1;

static int hf_mip6_mobility_opt = -1;
static int hf_mip6_opt_len = -1;

static int hf_mip6_opt_bi_bid = -1;
static int hf_mip6_opt_bi_status = -1;
static int hf_mip6_bi_h_flag = -1;
static int hf_mip6_bi_coa_ipv4 = -1;
static int hf_mip6_bi_coa_ipv6 = -1;

static int hf_mip6_binding_refresh_request = -1;
static int hf_mip6_unknown_type_data = -1;
static int hf_mip6_fast_neighbor_advertisement = -1;
static int hf_mip6_vsm_data = -1;
static int hf_mip6_vsm_req_data = -1;
static int hf_mip6_opt_padn = -1;

/* PMIP BRI */
static int hf_pmip6_bri_brtype = -1;
static int hf_pmip6_bri_rtrigger = -1;
static int hf_pmip6_bri_status = -1;
static int hf_pmip6_bri_seqnr = -1;
static int hf_pmip6_bri_ip_flag = -1;
static int hf_pmip6_bri_ap_flag = -1;
static int hf_pmip6_bri_iv_flag = -1;
static int hf_pmip6_bri_av_flag = -1;
static int hf_pmip6_bri_ig_flag = -1;
static int hf_pmip6_bri_ag_flag = -1;
static int hf_pmip6_bri_res = -1;

static int hf_pmip6_lri_sequence = -1;
static int hf_pmip6_lri_reserved = -1;
static int hf_pmip6_lri_lifetime = -1;

static int hf_pmip6_lra_sequence = -1;
static int hf_pmip6_lra_u = -1;
static int hf_pmip6_lra_reserved = -1;
static int hf_pmip6_lra_status = -1;
static int hf_pmip6_lra_lifetime = -1;

static int hf_mip6_opt_recap_reserved = -1;
static int hf_mip6_opt_redir_k = -1;
static int hf_mip6_opt_redir_n = -1;
static int hf_mip6_opt_redir_reserved = -1;
static int hf_mip6_opt_redir_addr_r2LMA_ipv6 = -1;
static int hf_mip6_opt_redir_addr_r2LMA_ipv4 = -1;
static int hf_mip6_opt_load_inf_priority = -1;
static int hf_mip6_opt_load_inf_sessions_in_use = -1;
static int hf_mip6_opt_load_inf_maximum_sessions = -1;
static int hf_mip6_opt_load_inf_used_capacity = -1;
static int hf_mip6_opt_load_inf_maximum_capacity = -1;
static int hf_mip6_opt_alt_ip4 = -1;

/* Mobile Node Group Identifier Optionm */
static int hf_mip6_opt_mng_sub_type = -1;
static int hf_mip6_opt_mng_reserved = -1;
static int hf_mip6_opt_mng_mng_id = -1;

static int hf_mip6_opt_mag_ipv6_reserved = -1;
static int hf_mip6_opt_mag_ipv6_address_length = -1;
static int hf_mip6_opt_mag_ipv6_address = -1;

static int hf_mip6_opt_acc_net_id_sub = -1;
static int hf_mip6_opt_acc_net_id_sub_opt = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_len = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_e_bit = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_net_name_len = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_net_name = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_net_name_data = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_ap_name_len = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_ap_name = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_op_id_type = -1;
static int hf_mip6_opt_acc_net_id_sub_opt_op_id = -1;

static int hf_pmip6_opt_lila_lla = -1;

/* Delegated Mobile Network Prefix Option */
static int hf_mip6_opt_dmnp_v_flag = -1;
static int hf_mip6_opt_dmnp_reserved = -1;
static int hf_mip6_opt_dmnp_prefix_len = -1;
static int hf_mip6_opt_dmnp_dmnp_ipv4 = -1;
static int hf_mip6_opt_dmnp_dmnp_ipv6 = -1;

/* Initialize the subtree pointers */
static gint ett_mip6 = -1;
static gint ett_mip6_opt_pad1 = -1;
static gint ett_mip6_opt_padn = -1;
static gint ett_mip6_opts = -1;
static gint ett_mip6_opt_bra = -1;
static gint ett_mip6_opt_acoa = -1;
static gint ett_mip6_opt_ni = -1;
static gint ett_mip6_opt_bad = -1;
static gint ett_mip6_nemo_opt_mnp = -1;
static gint ett_fmip6_opt_lla = -1;
static gint ett_mip6_opt_mnid = -1;
static gint ett_mip6_opt_auth = -1;
static gint ett_mip6_opt_mesgid = -1;
static gint ett_mip6_opt_cgapr = -1;
static gint ett_mip6_opt_cgar = -1;
static gint ett_mip6_opt_sign = -1;
static gint ett_mip6_opt_phkt = -1;
static gint ett_mip6_opt_mocoti = -1;
static gint ett_mip6_opt_mocot = -1;
static gint ett_mip6_opt_dnsu = -1;
static gint ett_mip6_opt_em = -1;
static gint ett_mip6_opt_vsm = -1;
static gint ett_mip6_opt_ssm = -1;
static gint ett_mip6_opt_badff = -1;
static gint ett_mip6_opt_unknown = -1;
static gint ett_pmip6_opt_hnp = -1;
static gint ett_pmip6_opt_hi = -1;
static gint ett_pmip6_opt_att = -1;
static gint ett_pmip6_opt_mnlli = -1;
static gint ett_pmip6_opt_lla = -1;
static gint ett_pmip6_opt_ts = -1;
static gint ett_pmip6_opt_rc = -1;
static gint ett_mip6_opt_ipv4ha = -1;
static gint ett_mip6_opt_ipv4aa = -1;
static gint ett_mip6_opt_natd = -1;
static gint ett_mip6_opt_ipv4coa = -1;
static gint ett_pmip6_opt_grek = -1;
static gint ett_pmip6_opt_mhipv6ap = -1;
static gint ett_pmip6_opt_bi = -1;
static gint ett_mip6_opt_ipv4hareq = -1;
static gint ett_mip6_opt_ipv4harep = -1;
static gint ett_mip6_opt_ipv4dra = -1;
static gint ett_mip6_opt_ipv4dsm = -1;
static gint ett_mip6_opt_cr = -1;
static gint ett_mip6_opt_lmaa = -1;
static gint ett_mip6_opt_recap = -1;
static gint ett_mip6_opt_redir = -1;
static gint ett_mip6_opt_load_inf = -1;
static gint ett_mip6_opt_alt_ip4 = -1;
static gint ett_mip6_opt_mng = -1;
static gint ett_mip6_opt_mag_ipv6 = -1;
static gint ett_mip6_opt_acc_net_id = -1;
static gint ett_mip6_sub_opt_acc_net_id = -1;
static gint ett_mip6_opt_dmnp = -1;

static expert_field ei_mip6_ie_not_dissected = EI_INIT;
static expert_field ei_mip6_ani_type_not_dissected = EI_INIT;
static expert_field ei_mip6_opt_len_invalid = EI_INIT;
static expert_field ei_mip6_vsm_data_not_dissected = EI_INIT;
static expert_field ei_mip6_bogus_header_length = EI_INIT;

static dissector_table_t mip6_option_table;

/* Functions to dissect the mobility headers */
static int
dissect_mip6_brr(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    proto_tree_add_item(mip6_tree, hf_mip6_binding_refresh_request, tvb, MIP6_DATA_OFF, MIP6_BRR_LEN, ENC_NA);

    return MIP6_DATA_OFF + MIP6_BRR_LEN;
}

static int
dissect_mip6_hoti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_HOTI_LEN, ett_mip6, NULL, "Home Test Init");

        proto_tree_add_item(data_tree, hf_mip6_hoti_cookie, tvb,
                MIP6_HOTI_COOKIE_OFF, MIP6_HOTI_COOKIE_LEN, ENC_BIG_ENDIAN);
    }

    return MIP6_DATA_OFF + MIP6_HOTI_LEN;
}

static int
dissect_mip6_coti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_COTI_LEN, ett_mip6, NULL, "Care-of Test Init");

        proto_tree_add_item(data_tree, hf_mip6_coti_cookie, tvb,
                MIP6_COTI_COOKIE_OFF, MIP6_COTI_COOKIE_LEN, ENC_BIG_ENDIAN);
    }

    return MIP6_DATA_OFF + MIP6_COTI_LEN;
}

static int
dissect_mip6_hot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_HOT_LEN, ett_mip6, NULL, "Home Test");

        proto_tree_add_item(data_tree, hf_mip6_hot_nindex, tvb,
                MIP6_HOT_INDEX_OFF, MIP6_HOT_INDEX_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_hot_cookie, tvb,
                MIP6_HOT_COOKIE_OFF, MIP6_HOT_COOKIE_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_hot_token, tvb,
                MIP6_HOT_TOKEN_OFF, MIP6_HOT_TOKEN_LEN, ENC_BIG_ENDIAN);
    }

    return MIP6_DATA_OFF + MIP6_HOT_LEN;
}

static int
dissect_mip6_cot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_COT_LEN, ett_mip6, NULL, "Care-of Test");

        proto_tree_add_item(data_tree, hf_mip6_cot_nindex, tvb,
                MIP6_COT_INDEX_OFF, MIP6_COT_INDEX_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_cot_cookie, tvb,
                MIP6_COT_COOKIE_OFF, MIP6_COT_COOKIE_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_hot_token, tvb,
                MIP6_COT_TOKEN_OFF, MIP6_COT_TOKEN_LEN, ENC_BIG_ENDIAN);
    }

    return MIP6_DATA_OFF + MIP6_COT_LEN;
}

/* RFC3775 */

/*
http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-11
A 0x8000 [RFC6275]
H 0x4000 [RFC6275]
L 0x2000 [RFC6275]
K 0x1000 [RFC6275]
M 0x0800 [RFC4140]
R 0x0400 [RFC3963]
P 0x0200 [RFC5213]
F 0x0100 [RFC5555]
T 0x0080 [RFC5845]
B 0x0040 [RFC6602]
*/
static int
dissect_mip6_bu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;
        int         lifetime;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_BU_LEN, ett_mip6, NULL, "Binding Update");

        proto_tree_add_item(data_tree, hf_mip6_bu_seqnr, tvb,
                MIP6_BU_SEQNR_OFF, MIP6_BU_SEQNR_LEN, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_mip6_bu_a_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_bu_h_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_bu_l_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_bu_k_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_bu_m_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_nemo_bu_r_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_bu_p_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_bu_f_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_bu_t_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_bu_b_flag, tvb,
                MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);

        if ((tvb_get_guint8(tvb, MIP6_BU_FLAGS_OFF) & 0x0004 ) == 0x0004)
            proto_nemo = 1;

        lifetime = tvb_get_ntohs(tvb, MIP6_BU_LIFETIME_OFF);
        proto_tree_add_uint_format_value(data_tree, hf_mip6_bu_lifetime, tvb,
                MIP6_BU_LIFETIME_OFF,
                MIP6_BU_LIFETIME_LEN, lifetime,
                "%d (%ld seconds)",
                lifetime, (long)lifetime * 4);
    }

    return MIP6_DATA_OFF + MIP6_BU_LEN;
}

static int
dissect_mip6_ba(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;
        int         lifetime;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_BA_LEN, ett_mip6, NULL, "Binding Acknowledgement");

        proto_tree_add_item(data_tree, hf_mip6_ba_status, tvb,
                MIP6_BA_STATUS_OFF, MIP6_BA_STATUS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_ba_k_flag, tvb,
                MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_nemo_ba_r_flag, tvb,
                MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_ba_p_flag, tvb,
                MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_ba_t_flag, tvb,
                MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_pmip6_ba_b_flag, tvb,
                MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
        if ((tvb_get_guint8(tvb, MIP6_BA_FLAGS_OFF) & 0x0040 ) == 0x0040)
            proto_nemo = 1;

        proto_tree_add_item(data_tree, hf_mip6_ba_seqnr, tvb,
                MIP6_BA_SEQNR_OFF, MIP6_BA_SEQNR_LEN, ENC_BIG_ENDIAN);

        lifetime = tvb_get_ntohs(tvb, MIP6_BA_LIFETIME_OFF);
        proto_tree_add_uint_format_value(data_tree, hf_mip6_ba_lifetime, tvb,
                MIP6_BA_LIFETIME_OFF,
                MIP6_BA_LIFETIME_LEN, lifetime,
                "%d (%ld seconds)",
                lifetime, (long)lifetime * 4);
    }

    return MIP6_DATA_OFF + MIP6_BA_LEN;
}

static int
dissect_mip6_be(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_BE_LEN, ett_mip6, NULL, "Binding Error");

        proto_tree_add_item(data_tree, hf_mip6_be_status, tvb,
                MIP6_BE_STATUS_OFF, MIP6_BE_STATUS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_be_haddr, tvb,
                MIP6_BE_HOA_OFF, MIP6_BE_HOA_LEN, ENC_NA);
    }

    return MIP6_DATA_OFF + MIP6_BE_LEN;
}

/* Home Agent Switch Message */
/*
       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
                                      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                      |# of Addresses |   Reserved    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      +                                                               +
      .                                                               .
      .                      Home Agent Addresses                     .
      .                                                               .
      +                                                               +
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      +                                                               +
      .                                                               .
      .                        Mobility Options                       .
      .                                                               .
      +                                                               +
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/

static int
dissect_mip6_has(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    guint num_addrs, len;

    num_addrs = tvb_get_guint8(tvb, MIP6_DATA_OFF);
    len = 2 + num_addrs * 16;

    if (mip6_tree) {
        proto_tree *data_tree;
        gint off;
        guint i;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                len, ett_mip6, NULL, "Home Agent Switch");

        proto_tree_add_item(data_tree, hf_mip6_has_num_addrs, tvb,
                MIP6_DATA_OFF, 1, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_mip6_has_reserved, tvb,
                MIP6_DATA_OFF + 1, 1, ENC_BIG_ENDIAN);

        for (i = 0, off = MIP6_DATA_OFF + 2; i < num_addrs; i++, off += 16) {
            proto_tree_add_item(data_tree, hf_mip6_has_address, tvb, off, 16, ENC_NA);
        }
    }

    return len;
}

static int
dissect_mip6_hb(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_HB_LEN, ett_mip6, NULL, "Heartbeat");

        proto_tree_add_item(data_tree, hf_mip6_hb_u_flag, tvb,
                MIP6_HB_FLAGS_OFF, MIP6_HB_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_hb_r_flag, tvb,
                MIP6_HB_FLAGS_OFF, MIP6_HB_FLAGS_LEN, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_mip6_hb_seqnr, tvb,
                MIP6_HB_SEQNR_OFF, MIP6_HB_SEQNR_LEN, ENC_BIG_ENDIAN);

    }

    return MIP6_DATA_OFF + MIP6_HB_LEN;
}
/*
      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
                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                     |           Sequence #          |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |S|U|  Reserved |      Code     |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               .
     |                                                               |
     .                                                               .
     .                          Mobility options                     .
     .                                                               .
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                 Figure 6: Handover Initiate (HI) Message

*/
static int
dissect_mip6_hi(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF, 4, ett_mip6, NULL, "Handover Initiate");

        proto_tree_add_item(data_tree, hf_mip6_hi_seqnr, tvb,
                MIP6_DATA_OFF, 2, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_mip6_hi_s_flag, tvb,
                MIP6_DATA_OFF+2, 1, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_mip6_hi_u_flag, tvb,
                MIP6_DATA_OFF+2, 1, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_mip6_hi_code, tvb,
                MIP6_DATA_OFF+3, 1, ENC_BIG_ENDIAN);

    }

    return MIP6_DATA_OFF + 4;
}

/*
      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
                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                     |           Sequence #          |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |    Reserved   |      Code     |                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               .
     |                                                               |
     .                                                               .
     .                          Mobility options                     .
     .                                                               .
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

               Figure 7: Handover Acknowledge (HAck) Message

*/

static int
dissect_mip6_hack(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF, 4, ett_mip6, NULL, "Handover Acknowledge ");

        proto_tree_add_item(data_tree, hf_mip6_hack_seqnr, tvb,
                MIP6_DATA_OFF, 2, ENC_BIG_ENDIAN);


        proto_tree_add_item(data_tree, hf_mip6_hack_code, tvb,
                MIP6_DATA_OFF+3, 1, ENC_BIG_ENDIAN);

    }

    return MIP6_DATA_OFF + 4;
}

static int
dissect_mip6_unknown(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    guint hdr_len, data_len;

    hdr_len = (tvb_get_guint8(tvb, MIP6_HLEN_OFF) + 1) * 8;
    data_len = hdr_len - MIP6_DATA_OFF;

    proto_tree_add_item(mip6_tree, hf_mip6_unknown_type_data, tvb, MIP6_DATA_OFF, data_len, ENC_NA);

    return hdr_len;
}

static int
dissect_fmip6_fbu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;
        int lifetime;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                MIP6_BU_LEN, ett_mip6, NULL, "Fast Binding Update");

        proto_tree_add_item(data_tree, hf_fmip6_fbu_seqnr, tvb,
                FMIP6_FBU_SEQNR_OFF, FMIP6_FBU_SEQNR_LEN, ENC_BIG_ENDIAN);

        proto_tree_add_item(data_tree, hf_fmip6_fbu_a_flag, tvb,
                FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_fmip6_fbu_h_flag, tvb,
                FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_fmip6_fbu_l_flag, tvb,
                FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_fmip6_fbu_k_flag, tvb,
                FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);

        lifetime = tvb_get_ntohs(tvb, FMIP6_FBU_LIFETIME_OFF);
        proto_tree_add_uint_format_value(data_tree, hf_fmip6_fbu_lifetime, tvb,
                FMIP6_FBU_LIFETIME_OFF,
                FMIP6_FBU_LIFETIME_LEN, lifetime,
                "%d (%ld seconds)",
                lifetime, (long)lifetime * 4);
    }

    return MIP6_DATA_OFF + FMIP6_FBU_LEN;
}

static int
dissect_fmip6_fback(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    if (mip6_tree) {
        proto_tree *data_tree;
        int         lifetime;

        data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                FMIP6_FBACK_LEN, ett_mip6, NULL, "Fast Binding Acknowledgement");

        proto_tree_add_item(data_tree, hf_fmip6_fback_status, tvb,
                FMIP6_FBACK_STATUS_OFF, FMIP6_FBACK_STATUS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_fmip6_fback_k_flag, tvb,
                FMIP6_FBACK_FLAGS_OFF, FMIP6_FBACK_FLAGS_LEN, ENC_BIG_ENDIAN);
        proto_tree_add_item(data_tree, hf_fmip6_fback_seqnr, tvb,
                FMIP6_FBACK_SEQNR_OFF, FMIP6_FBACK_SEQNR_LEN, ENC_BIG_ENDIAN);
        lifetime = tvb_get_ntohs(tvb, FMIP6_FBACK_LIFETIME_OFF);
        proto_tree_add_uint_format_value(data_tree, hf_fmip6_fback_lifetime, tvb,
                FMIP6_FBACK_LIFETIME_OFF,
                FMIP6_FBACK_LIFETIME_LEN, lifetime,
                "%d (%ld seconds)",
                lifetime, (long)lifetime * 4);
    }

    return MIP6_DATA_OFF + FMIP6_FBACK_LEN;
}

static int
dissect_fmip6_fna(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
    proto_tree_add_item(mip6_tree, hf_mip6_fast_neighbor_advertisement, tvb, MIP6_DATA_OFF, FMIP6_FNA_LEN, ENC_NA);

    return MIP6_DATA_OFF + FMIP6_FNA_LEN;
}

/* PMIP Binding Revocation Indication / Acknowledge */
static int
dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
{
#define INDICATION  1
#define ACKNOWLEDGE 2

    proto_tree *field_tree;
    guint8      br_type;

    br_type = tvb_get_guint8(tvb, PMIP6_BRI_BRTYPE_OFF);

    /* Branch between BR Indication and BR Acknowledge */
    if ( br_type == INDICATION )
    {
        col_append_str(pinfo->cinfo, COL_INFO, " Indication");

        if (mip6_tree)
        {
            field_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                PMIP6_BRI_LEN, ett_mip6, NULL, "Binding Revocation Indication");

            proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb,
                PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_rtrigger, tvb,
                PMIP6_BRI_RTRIGGER_OFF, PMIP6_BRI_RTRIGGER_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb,
                PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_ip_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_iv_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_ig_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
        }
    } else if ( br_type == ACKNOWLEDGE ) {

        col_append_str(pinfo->cinfo, COL_INFO, " Acknowledge");

        if (mip6_tree)
        {
            field_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
                PMIP6_BRI_LEN, ett_mip6, NULL, "Binding Revocation Acknowledge");

            proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb,
                PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_status, tvb,
                PMIP6_BRI_STATUS_OFF, PMIP6_BRI_STATUS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb,
                PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_ap_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_av_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_ag_flag, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);

            proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb,
                PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
        }
    }

    return MIP6_DATA_OFF + PMIP6_BRI_LEN;
}

/*

    10.1. Localized Routing Initiation (LRI)

     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
                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                    |           Sequence #          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         Reserved              |           Lifetime            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    .                                                               .
    .                        Mobility options                       .
    .                                                               .
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/

static int
dissect_pmip6_lri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_, gint offset)
{
    proto_tree_add_item(mip6_tree, hf_pmip6_lri_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(mip6_tree, hf_pmip6_lri_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(mip6_tree, hf_pmip6_lri_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    return offset;
}

/*

    10.2. Localized Routing Acknowledgment (LRA)

     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
                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                    |           Sequence #          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |U|  Reserved   |   Status      |           Lifetime            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    .                                                               .
    .                        Mobility options                       .
    .                                                               .
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/

static int
dissect_pmip6_lra(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_, gint offset)
{
    proto_tree_add_item(mip6_tree, hf_pmip6_lra_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(mip6_tree, hf_pmip6_lra_u, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(mip6_tree, hf_pmip6_lra_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

    proto_tree_add_item(mip6_tree, hf_pmip6_lra_status, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

    proto_tree_add_item(mip6_tree, hf_pmip6_lra_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    return offset;
}
/* Functions to dissect the mobility options */
/*Dissect vendor option 3GPP
 * Ref  Mobile IPv6 vendor specific option format and usage within 3GPP
 * (3GPP TS 29.282 version 10.2.0 Release 10)
 */

/*

     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      |   Length      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                         Vendor ID                             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |   Sub-Type    |  Reserved   |M| 3GPP Specific IE Data Fragment
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/

static int
dissect_mip6_opt_vsm_3gpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    proto_item *hdr_item = tree;
    int    len = tvb_reported_length(tvb);
    int offset = 0;
    guint8 sub_type, m_flag;
    tvbuff_t *next_tvb;
    gchar *mei_str;
    char *digit_str;
    gchar *mcc_mnc_str;
    gchar *imsi_str;

    /* offset points to the sub type */
    sub_type = tvb_get_guint8(tvb,offset);
    proto_tree_add_item(tree, hf_mip6_vsm_subtype_3gpp, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_item_append_text(hdr_item, " %s", val_to_str_ext_const(sub_type, &mip6_vsm_subtype_3gpp_value_ext, "<unknown>"));
    offset++;
    m_flag = tvb_get_guint8(tvb,offset) & 0x01;
    proto_tree_add_item(tree, hf_mip6_opt_3gpp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(tree, hf_mip6_opt_3gpp_flag_m, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    /* set len to the length of the data section */
    len = len - 2;

    if(m_flag){
        proto_tree_add_expert_format(tree, pinfo, &ei_mip6_vsm_data_not_dissected, tvb, offset, len, "Data fragment, handling not implemented yet");
        return len;
    }

    /* see 3GPP TS 29.275 version 10.5.0 Release 10 */
    switch (sub_type) {
    /*  1, Protocol Configuration Options
     *     3GPP PCO data, in the format from 3GPP TS 24.008 [16] subclause 10.5.6.3, starting with octet 3
     *     de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
     *     Note needs pinfo->link_dir ?
     */
    case 1:
        pinfo->link_dir = P2P_DIR_DL;
        de_sm_pco(tvb, tree, pinfo, offset, len, NULL, 0);
        break;
    /*  2, 3GPP Specific PMIPv6 Error Code */
    case 2:
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_spec_pmipv6_err_code, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;
    /*  3, PMIPv6 PDN GW IP Address
     *     PDN GW IP address, as specified in subclause 12.1.1.4
     */
    case 3:
        if(len == 4){
            /* Ipv4 address */
            proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_gw_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
        }else if(len == 16){
            /* IPv6 address */
            proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_gw_ipv6_addr, tvb, offset, 16, ENC_NA);
        }
        break;
    /*  4, PMIPv6 DHCPv4 Address Allocation Procedure Indication
     *     DHCPv4 Address Allocation Procedure Indication, as specified in subclause 12.1.1.5
     */
    case 4:
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;
    /*  5, PMIPv6 Fully Qualified PDN Connection Set Identifier
     * FQ-CSID as specified in subclause 12.1.1.2
     */
    case 5:
        next_tvb = tvb_new_subset_length(tvb, offset, len);
        dissect_gtpv2_fq_csid(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
        break;
    /*  6, PMIPv6 PDN type indication */
    case 6:
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_type, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_ind_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;
    /*  7, Charging ID
     *     Charging ID as specified in subclause 12.1.1.6
     */
    case 7:
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_chg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
        proto_item_append_text(hdr_item, " %u", tvb_get_ntohl(tvb, offset));
        break;
    /*  8, Selection Mode */
    case 8:
        next_tvb = tvb_new_subset_length(tvb, offset, len);
        dissect_gtpv2_selec_mode(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
        break;
    /*  9, I-WLAN Mobility Access Point Name (APN) */
    /* 10, Charging Characteristics */
    case 10:
        proto_tree_add_item(tree, hf_mip6_opt_3gpp_charging_characteristic, tvb, offset, 2, ENC_BIG_ENDIAN);
        break;
    /* 11, Mobile Equipment Identity (MEI) */
    case 11:
        proto_tree_add_item_ret_display_string(tree, hf_mip6_opt_3gpp_mei, tvb, offset, len, ENC_BCD_DIGITS_0_9, pinfo->pool, &mei_str);
        proto_item_append_text(hdr_item, " %s", mei_str);
        break;
    /* 12, MSISDN */
    case 12:
        dissect_e164_cc(tvb, tree, offset, E164_ENC_BCD);
        proto_tree_add_item_ret_display_string(tree, hf_mip6_opt_3gpp_msisdn, tvb, offset, len, ENC_BCD_DIGITS_0_9, pinfo->pool, &digit_str);
        proto_item_append_text(hdr_item, " %s", digit_str);
        break;
    /* 13, Serving Network */
    case 13:
        mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE);
        proto_item_append_text(hdr_item," %s", mcc_mnc_str);
        break;
    /* 14, APN Restriction */
    case 14:
         proto_tree_add_item(tree, hf_mip6_opt_3gpp_apn_rest, tvb, offset, 1, ENC_BIG_ENDIAN);
         break;
    /* 15, Maximum APN Restriction */
    case 15:
         proto_tree_add_item(tree, hf_mip6_opt_3gpp_max_apn_rest, tvb, offset, 1, ENC_BIG_ENDIAN);
         break;
    /* 16, Unauthenticated IMSI */
    case 16:
        proto_tree_add_item_ret_display_string(tree, hf_mip6_opt_3gpp_imsi, tvb, offset, len, ENC_BCD_DIGITS_0_9, pinfo->pool, &imsi_str);
        proto_item_append_text(hdr_item," %s", imsi_str);
        break;
    /* 17, PDN Connection ID */
    case 17:
         proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_conn_id, tvb, offset, 1, ENC_BIG_ENDIAN);
         break;
    /* 18, PGW Back-Off Time */
    case 18:
        next_tvb = tvb_new_subset_length(tvb, offset, len);
        dissect_gtpv2_epc_timer(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
        break;
    /* 19, Signalling Priority Indication */
    case 19:
         proto_tree_add_item(tree, hf_hf_mip6_opt_3gpp_lapi, tvb, offset, 1, ENC_BIG_ENDIAN);
         break;
    /* 20, Additional Protocol Configuration Options
     *     12.1.1.19 Additional Protocol Configuration Options
     *     The Additional Protocol Configuration Options IE contains additional 3GPP protocol configuration options
     *     information. The IE is in the same format as the PCO IE specified in 3GPP TS 24.008 [16] subclause 10.5.6.3, starting
     *     with octet 3.
     */
    default:
        proto_tree_add_expert(tree, pinfo, &ei_mip6_vsm_data_not_dissected, tvb, offset, len);
        break;
    }

    return len;
}

static proto_tree*
mip6_fixed_option_header(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, int proto, int ett, proto_item** ti, guint len, guint optlen)
{
    proto_tree *field_tree;
    proto_item *tf;

    *ti = proto_tree_add_item(tree, proto, tvb, 0, -1, ENC_NA);
    field_tree = proto_item_add_subtree(*ti, ett);

    tf = proto_tree_add_item(field_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);

    if (len != optlen) {
        /* Bogus - option length isn't what it's supposed to be for this option. */
        expert_add_info_format(pinfo, tf, &ei_mip6_opt_len_invalid,
                            "%s (with option length = %u byte%s; should be %u)",
                            proto_get_protocol_short_name(find_protocol_by_id(proto)),
                            len, plurality(len, "", "s"), optlen);
    }

    return field_tree;
}

static proto_tree*
mip6_var_option_header(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, int proto, int ett, proto_item** ti, guint len, guint optlen)
{
    proto_tree *field_tree;
    proto_item *tf;

    *ti = proto_tree_add_item(tree, proto, tvb, 0, -1, ENC_NA);
    field_tree = proto_item_add_subtree(*ti, ett);

    tf = proto_tree_add_item(field_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);
    if (len < optlen)
        expert_add_info_format(pinfo, tf, &ei_mip6_opt_len_invalid,
            "%s (with option length = %u byte%s; should be >= %u)", proto_get_protocol_short_name(find_protocol_by_id(proto)),
            len, plurality(len, "", "s"), optlen);

    return field_tree;
}



/* 1 PadN [RFC3775] */
static int
dissect_mip6_opt_padn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_padn, ett_mip6_opt_padn, &ti, option_len, 0);

    if (option_len > 0) {
        proto_tree_add_item(opt_tree, hf_mip6_opt_padn, tvb, offset, option_len, ENC_NA);
    }

    return tvb_captured_length(tvb);
}

/* 2 Binding Refresh Advice */
static int
dissect_mip6_opt_bra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    int ri;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_bra, ett_mip6_opt_bra, &ti, option_len, MIP6_BRA_LEN);

    ri = tvb_get_ntohs(tvb, offset);
    proto_tree_add_uint_format_value(opt_tree, hf_mip6_bra_interval, tvb,
            offset, 2,
            ri, "%d (%ld seconds)",
            ri, (long)ri * 4);

    return tvb_captured_length(tvb);
}

/*3  Alternate Care-of Address */
static int
dissect_mip6_opt_acoa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_acoa, ett_mip6_opt_acoa, &ti, option_len, MIP6_ACOA_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_acoa_acoa, tvb,
        offset, MIP6_ACOA_ACOA_LEN, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 4 Nonce Indices */
static int
dissect_mip6_opt_ni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ni, ett_mip6_opt_ni, &ti, option_len, MIP6_NI_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_ni_hni, tvb, offset, MIP6_NI_HNI_LEN, ENC_BIG_ENDIAN);
    offset += MIP6_NI_HNI_LEN;
    proto_tree_add_item(opt_tree, hf_mip6_ni_cni, tvb, offset, MIP6_NI_CNI_LEN, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 5 Authorization Data */
static int
dissect_mip6_opt_bad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_bad_auth, ett_mip6_opt_bad, &ti, option_len, 0);

    proto_tree_add_item(opt_tree, hf_mip6_bad_auth, tvb, offset, option_len, ENC_NA);

    return tvb_captured_length(tvb);
}

static int
dissect_mip6_network_prefix_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int proto, int ett, int optlen)
{
    proto_tree* field_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 3;
    guint32 prefix_len;

    field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto, ett, &ti, option_len, optlen);

    proto_tree_add_item_ret_uint(field_tree, hf_mip6_nemo_mnp_pfl, tvb,
            offset, 1, ENC_BIG_ENDIAN, &prefix_len);

    offset++;
    proto_tree_add_item(field_tree, hf_mip6_nemo_mnp_mnp, tvb, offset, MIP6_NEMO_MNP_MNP_LEN, ENC_NA);
    proto_item_append_text(ti, ": %s/%u", tvb_ip6_to_str(pinfo->pool, tvb, offset), prefix_len);

    return tvb_captured_length(tvb);
}

/* 6 Mobile Network Prefix Option */
static int
dissect_mip6_nemo_opt_mnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    return dissect_mip6_network_prefix_option(tvb, pinfo, tree, proto_mip6_option_mnp, ett_mip6_nemo_opt_mnp, MIP6_NEMO_MNP_LEN);
}

/* 7 Mobility Header Link-Layer Address option [RFC5568] */
static int
dissect_fmip6_opt_lla(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mhlla, ett_fmip6_opt_lla, &ti, option_len, FMIP6_LLA_MINLEN);

    proto_tree_add_item(opt_tree, hf_fmip6_lla_optcode, tvb,
            offset, FMIP6_LLA_OPTCODE_LEN, ENC_BIG_ENDIAN);
    offset += FMIP6_LLA_OPTCODE_LEN;

    if (option_len > FMIP6_LLA_OPTCODE_LEN) {
        proto_tree_add_item(opt_tree, hf_fmip6_lla, tvb, offset, option_len-FMIP6_LLA_OPTCODE_LEN, ENC_NA);
    }

    return tvb_captured_length(tvb);
}

/* 8 MN-ID-OPTION-TYPE RFC4283 MN-ID
   https://tools.ietf.org/html/rfc4283

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                    |  Option Type  | Option Length |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Subtype      |          Identifier ...
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    :
    Option Length:

    8-bit unsigned integer, representing the length in octets of
    the Subtype and Identifier fields.

*/
static int
dissect_mip6_opt_mnid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    const guint8 *str;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mnid, ett_mip6_opt_mnid, &ti, option_len, MIP6_MNID_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_mnid_subtype, tvb,
            offset, 1, ENC_BIG_ENDIAN);
    offset++;

    if (option_len - offset > 0) {
        proto_tree_add_item_ret_string(opt_tree, hf_mip6_mnid_identifier, tvb, offset, option_len - 1, ENC_UTF_8|ENC_NA, pinfo->pool, &str);
        proto_item_append_text(ti, ": %s", str);
    }

    return tvb_captured_length(tvb);
}

/*  9 AUTH-OPTION-TYPE
    https://tools.ietf.org/html/rfc4285

    0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                    |  Option Type  | Option Length |  Subtype      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                  Mobility SPI                                 |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                  Authentication Data ....
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       Figure 2: Mobility Message Authentication Option
 */
static int
dissect_mip6_opt_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_auth, ett_mip6_opt_auth, &ti, option_len, MIP6_AUTH_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_auth_sub_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;
    proto_tree_add_item(opt_tree, hf_mip6_opt_auth_mobility_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(opt_tree, hf_mip6_opt_auth_auth_data, tvb, offset, option_len-offset, ENC_NA);

    return tvb_captured_length(tvb);
}

/*  10 MESG-ID-OPTION-TYPE [RFC4285] */

static int
dissect_mip6_opt_mseg_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mseg_id, ett_mip6_opt_mesgid, &ti, option_len, MIP6_MESG_ID_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mseg_id_timestamp, tvb, offset, 8, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}


/* 11 CGA Parameters Request [RFC4866]  */
/* Carries no data */
static int
dissect_mip6_opt_cgapr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    int option_len = tvb_reported_length(tvb)-2;
    proto_item* ti;

    mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_cgapr, ett_mip6_opt_cgapr, &ti, option_len, MIP6_CGAPR_MINLEN);

    return tvb_captured_length(tvb);
}

/* 12 CGA Parameters [RFC4866]  */
static int
dissect_mip6_opt_cgar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_cgar, ett_mip6_opt_cgar, &ti, option_len, MIP6_CGAR_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_cgar_cga_par, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 13 Signature [RFC4866]  */
static int
dissect_mip6_opt_sign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_sign, ett_mip6_opt_sign, &ti, option_len, MIP6_SIGN_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_sign_sign, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 14 Permanent Home Keygen Token [RFC4866]  */
static int
dissect_mip6_opt_phkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_phkt, ett_mip6_opt_phkt, &ti, option_len, MIP6_PHKT_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_phkt_phkt, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 15 Care-of Test Init [RFC4866]
 * No data in this option.
 */
static int
dissect_mip6_opt_coti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    int option_len = tvb_reported_length(tvb)-2;
    proto_item* ti;

    mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_coti, ett_mip6_opt_mocoti, &ti, option_len, MIP6_MOCOTI_MINLEN);

    return tvb_captured_length(tvb);
}

/* 16 Care-of Test [RFC4866]  */
static int
dissect_mip6_opt_mocot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_cot, ett_mip6_opt_mocot, &ti, option_len, MIP6_MOCOT_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mocot_co_keygen_tok, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 17 DNS-UPDATE-TYPE [RFC5026]

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                    |  Option Type  | Option Length |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |   Status      |R|  Reserved   |     MN identity (FQDN) ...
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

    Option Type

      DNS-UPDATE-TYPE (17)

*/
static int
dissect_mip6_opt_dnsu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_dnsu, ett_mip6_opt_dnsu, &ti, option_len, MIP6_DNSU_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_status, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_flag_r, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_mn_id, tvb, offset, option_len-2-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 18 Experimental Mobility Option [RFC5096] */
static int
dissect_mip6_opt_em(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_em, ett_mip6_opt_em, &ti, option_len, MIP6_EM_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_em_data, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 19 Vendor Specific Mobility Option [RFC5094]  */
/*

     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      |   Length      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                         Vendor ID                             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |   Sub-Type    |             Data.......
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_mip6_opt_vsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    tvbuff_t *next_tvb;
    guint32 vendorid;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_vsm, ett_mip6_opt_vsm, &ti, option_len, MIP6_VSM_MINLEN);

    proto_tree_add_item_ret_uint(opt_tree, hf_mip6_vsm_vid, tvb,
            offset, MIP6_VSM_VID_LEN, ENC_BIG_ENDIAN, &vendorid);
    proto_item_append_text(ti, ": %s", enterprises_lookup(vendorid, "<unknown>"));
    offset += 4;

    next_tvb = tvb_new_subset_remaining(tvb, offset);
    if (!dissector_try_uint(mip6_vsm_dissector_table, vendorid, next_tvb, pinfo, opt_tree)){
        proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype, tvb,
                offset, MIP6_VSM_SUBTYPE_LEN, ENC_BIG_ENDIAN);
        offset++;

        if (option_len-offset > 0){
            proto_tree_add_item(opt_tree, hf_mip6_vsm_data, tvb, offset, option_len-offset, ENC_NA);
        }
    }

    return tvb_captured_length(tvb);
}

/* 20 Service Selection Mobility Option [RFC5149]  */

static int
dissect_mip6_opt_ssm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint8 *apn = NULL;
    int     name_len;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_ssm, ett_mip6_opt_ssm, &ti, option_len, MIP6_SSM_MINLEN);
    /* RFC 5149 3. Service Selection Mobility Option
     * Identifier: A variable-length encoded service identifier string
     * used to identify the requested service.  The identifier string
     * length is between 1 and 255 octets.  This specification allows
     * international identifier strings that are based on the use of
     * Unicode characters, encoded as UTF-8, and formatted using
     * Normalization Form KC (NFKC).
     */

    /* 3GPP TS 29.275 version 10.5.0 Release 10, Table 5.1.1.1-2
     * Set to the EPS Access Point Name to which the UE
     * attaches the new PDN connection.
     * The encoding the APN field follows 3GPP TS 23.003
     * [12] subclause 9.1 but excluding the trailing zero byte.
     * The content of the APN field shall be the full APN with
     * both the APN Network Identifier and default APN
     * Operator Identifier being present as specified in 3GPP
     * TS 23.003 [12] subclauses 9.1.1 and 9.1.2
     * NOTE 4.
     * NOTE 4: The APN field is not encoded as a dotted string as commonly used in documentation
     */

    if (option_len > 0) {
        name_len = tvb_get_guint8(tvb, offset);

        /* As can be seen above, RFC 5149 "allows" the use of UTF-8 encoded
         * strings, but the 3GPP chose to encode as other APN fields,
         * similar to RFC 1035 DNS labels (but without pointer compression).
         * As a heuristic, if the first byte is less than 0x20, interpret
         * it as a length (rather than a control code) and use APN encoding,
         * otherwise interpret as a string.
         */
        if (name_len < 0x20) {
            apn = tvb_get_string_enc(pinfo->pool, tvb, offset, option_len, ENC_APN_STR);
        }
        else {
            apn = tvb_get_string_enc(pinfo->pool, tvb, offset, option_len, ENC_UTF_8);
        }
        proto_tree_add_string(opt_tree, hf_mip6_opt_ss_identifier, tvb, offset, option_len, apn);
    }
    if(apn){
        proto_item_append_text(ti, ": %s", apn);
    }
    return tvb_captured_length(tvb);
}

/* 21 Binding Authorization Data for FMIPv6 (BADF) [RFC5568]  */

static int
dissect_mip6_opt_badff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_badff, ett_mip6_opt_badff, &ti, option_len, MIP6_BADFF_MINLEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_badff_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(opt_tree, hf_mip6_opt_badff_auth, tvb, offset, option_len-offset, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 22 Home Network Prefix Option [RFC5213]   */
static int
dissect_mip6_opt_hnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    return dissect_mip6_network_prefix_option(tvb, pinfo, tree, proto_mip6_option_hnp, ett_pmip6_opt_hnp, MIP6_NEMO_MNP_LEN);
}

/* 23 Handoff Indicator Option [RFC5213]   */
/*
     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     |   Length      |  Reserved (R) |       HI      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_hi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint32 hi;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_hi, ett_pmip6_opt_hi, &ti, option_len, PMIP6_HI_LEN);

    proto_tree_add_item(opt_tree, hf_pmip6_hi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_hi_hi, tvb,
            offset, PMIP6_HI_HI_LEN, ENC_BIG_ENDIAN, &hi);

    proto_item_append_text(ti, ": %s", val_to_str_const(hi, pmip6_hi_opttype_value, "<unknown>"));

    return tvb_captured_length(tvb);
}

/* 24 Access Technology Type Option [RFC5213]  */
/*
     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     |   Length      |  Reserved (R) |      ATT      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_att(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint32 att;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_att, ett_pmip6_opt_att, &ti, option_len, PMIP6_ATT_LEN);

    proto_tree_add_item(opt_tree, hf_pmip6_att_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    att = tvb_get_guint8(tvb,offset);
    proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_att_att, tvb,
            offset, PMIP6_ATT_ATT_LEN, ENC_BIG_ENDIAN, &att);
    proto_item_append_text(ti, ": %s", val_to_str_ext_const(att, &pmip6_att_att_value_ext, "<unknown>"));

    return tvb_captured_length(tvb);
}

/* 25 Mobile Node Link-layer Identifier Option [RFC5213]  */
/*
     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        |    Length     |          Reserved             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                        Link-layer Identifier                  +
    .                              ...                              .
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_mnlli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mnlli, ett_pmip6_opt_mnlli, &ti, option_len, PMIP6_MNLLI_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mnlli_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    proto_tree_add_item(opt_tree, hf_mip6_opt_mnlli_lli, tvb, offset, option_len-2, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 26 Link-local Address Option [RFC5213   */
/*
     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        |    Length     |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                  Link-local Address                           +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_lla(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* field_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_lla, ett_pmip6_opt_lla, &ti, option_len, PMIP6_LLA_LEN);

    proto_tree_add_item(field_tree, hf_pmip6_opt_lila_lla, tvb, offset, 16, ENC_NA);

    return tvb_captured_length(tvb);
}

/* 27 Timestamp */
/*
     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     |   Length      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                          Timestamp                            +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     Timestamp

         A 64-bit unsigned integer field containing a timestamp.  The
         value indicates the number of seconds since January 1, 1970,
         00:00 UTC, by using a fixed point format.  In this format, the
         integer number of seconds is contained in the first 48 bits of
         the field, and the remaining 16 bits indicate the number of
         1/65536 fractions of a second.

*/
static int
dissect_pmip6_opt_ts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    char *str;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ts, ett_pmip6_opt_ts, &ti, option_len, PMIP6_TS_LEN);

    proto_tree_add_item_ret_time_string(opt_tree, hf_pmip6_timestamp, tvb, offset, 8, ENC_TIME_MIP6|ENC_BIG_ENDIAN, pinfo->pool, &str);
    proto_item_append_text(ti, ": %s", str);

    return tvb_captured_length(tvb);
}

 /* 28 Restart Counter [RFC5847] */
static int
dissect_pmip6_opt_rc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_rc, ett_pmip6_opt_rc, &ti, option_len, PMIP6_RC_LEN);

    proto_tree_add_item(opt_tree, hf_pmip6_rc, tvb,
            offset, PMIP6_RC_RC_LEN, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 29 IPv4 Home Address [RFC5555]  */
static int
dissect_pmip6_opt_ipv4ha(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* field_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4ha, ett_mip6_opt_ipv4ha, &ti, option_len, MIP6_IPV4HA_LEN);

    proto_tree_add_item(field_tree, hf_mip6_ipv4ha_preflen, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(field_tree, hf_mip6_ipv4ha_p_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(field_tree, hf_mip6_ipv4ha_ha, tvb,
            offset, MIP6_IPV4HA_HA_LEN, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 30 IPv4 Address Acknowledgement [RFC5555] */
static int
dissect_pmip6_opt_ipv4aa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* field_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4aa, ett_mip6_opt_ipv4aa, &ti, option_len, MIP6_IPV4AA_LEN);

    proto_tree_add_item(field_tree, hf_mip6_ipv4aa_status, tvb,
            offset, MIP6_IPV4AA_STATUS_LEN, ENC_BIG_ENDIAN);
    offset += MIP6_IPV4AA_STATUS_LEN;

    proto_tree_add_item(field_tree, hf_mip6_ipv4ha_preflen, tvb,
            offset, MIP6_IPV4AA_PREFIXL_LEN, ENC_BIG_ENDIAN);
    offset += MIP6_IPV4AA_PREFIXL_LEN;

    proto_tree_add_item(field_tree, hf_mip6_ipv4ha_ha, tvb,
            offset, MIP6_IPV4AA_HA_LEN, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 31 NAT Detection [RFC5555]  */
/*
     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      |    Length     |F|          Reserved           |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                      Refresh time                             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_natd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    proto_item *item;
    guint32     refresh_time;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_natd, ett_mip6_opt_natd, &ti, option_len, MIP6_NATD_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_natd_f_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
    proto_tree_add_item(opt_tree, hf_mip6_opt_natd_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    item = proto_tree_add_item_ret_uint(opt_tree, hf_mip6_opt_natd_refresh_t, tvb, offset, 4, ENC_BIG_ENDIAN, &refresh_time);
    if (refresh_time == 0) {
        proto_item_append_text(item, " (Ignore)");
    }
    if (refresh_time == 0xffffffff) {
        proto_item_append_text(item, " (keepalives are not needed, no NAT detected)");
    }

    return tvb_captured_length(tvb);
}

/* 32 IPv4 Care-of Address [RFC5555]  */
/*
     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        |   Length      |         Reserved              |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                     IPv4 Care-of address                      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/

static int
dissect_pmip6_opt_ipv4coa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4coa, ett_mip6_opt_ipv4coa, &ti, option_len, MIP6_IPV4COA_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_ipv4coa_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    proto_tree_add_item(opt_tree, hf_mip6_opt_ipv4coa_addr, tvb, offset, 4, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 33 GRE Key Option [RFC5845]  */
/*
     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     |   Length      |           Reserved            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                      GRE Key Identifier                       |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_grek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint32 key;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_grek, ett_pmip6_opt_grek, &ti, option_len, PMIP6_GREK_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_reserved, tvb,
            offset, 2, ENC_BIG_ENDIAN);

    if (option_len == 6) {
        offset += 2;
        proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_gre_key, tvb,
                            offset, PMIP6_GREK_ID_LEN, ENC_BIG_ENDIAN, &key);
        proto_item_append_text(ti, ": %u", key);
    }

    return tvb_captured_length(tvb);
}

/* 34 Mobility Header IPv6 Address/Prefix [RFC5568]
     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      |   Length      | Option-Code   | Prefix Length |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                    IPv6 Address/Prefix                        +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 */

static int
dissect_pmip6_opt_mhipv6ap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint8 prefix_l;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mhipv6ap, ett_pmip6_opt_mhipv6ap, &ti, option_len, MIP6_MHIPV6AP_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_opt_code, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    prefix_l = tvb_get_guint8(tvb,offset);
    proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_prefix_l, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_ipv6_address, tvb, offset, 16, ENC_NA);
    ti = proto_tree_add_string(opt_tree, hf_mip6_opt_mhipv6ap_ipv6_address_prefix, tvb, offset -1, 16+1, tvb_ip6_to_str(pinfo->pool, tvb, offset));
    proto_item_append_text(ti, "/%u", prefix_l);
    proto_item_set_generated(ti);

    return tvb_captured_length(tvb);
}
/* 35 Binding Identifier [RFC5648]  */
/*
     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 = 35   |     Length    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |       Binding ID (BID)        |     Status    |H|   Reserved  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------------------------+
    +                                                               +
    :                 IPv4 or IPv6 care-of address (CoA)            :
    +                                                               +
    +---------------------------------------------------------------+

*/
static int
dissect_pmip6_opt_bi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_bi, ett_pmip6_opt_bi, &ti, option_len, MIP6_BI_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_bi_bid, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(opt_tree, hf_mip6_opt_bi_status, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_bi_h_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    if (option_len == 8) {
        /* IPv4 addr */
        proto_tree_add_item(opt_tree, hf_mip6_bi_coa_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
    } else if (option_len == 20) {
        /* Ipv6 Addr */
        proto_tree_add_item(opt_tree, hf_mip6_bi_coa_ipv6, tvb, offset, 16, ENC_NA);
    }

    return tvb_captured_length(tvb);
}


/* 36 IPv4 Home Address Request [RFC5844] */
/*
     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      |   Length      |Prefix-len |      Reserved     |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                     IPv4 home address                         |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_ipv4hareq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    proto_item *item;
    guint32     dword;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4hareq, ett_mip6_opt_ipv4hareq, &ti, option_len, MIP6_IPV4HAREQ_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_preflen, tvb,
            offset, 1, ENC_BIG_ENDIAN);
    offset++;

    /* Reserved */
    proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    /* Field is an IPv4 address, so can't be retrieved by proto_tree_add_item_ret_uint */
    dword = tvb_get_ntohl(tvb,offset);
    item = proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_ha, tvb,
            offset, MIP6_IPV4HAREQ_HA_LEN, ENC_BIG_ENDIAN);
    if (dword == 0) {
        proto_item_append_text(item, " - Request that the local mobility anchor perform the address allocation");
    }
    proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));

    return tvb_captured_length(tvb);
}

/* 37 IPv4 Home Address Reply [RFC5844] */
/*
     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      |    Length     |   Status      |Pref-len   |Res|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                      IPv4 home address                        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_ipv4harep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint32 status;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4harep, ett_mip6_opt_ipv4harep, &ti, option_len, MIP6_IPV4HAREP_LEN);

    proto_tree_add_item_ret_uint(opt_tree, hf_mip6_ipv4aa_status, tvb,
            offset, MIP6_IPV4HAREP_STATUS_LEN, ENC_BIG_ENDIAN, &status);
    proto_item_append_text(ti, ": %s ", val_to_str_const(status, pmip6_ipv4aa_status_values, "<unknown>"));
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_preflen, tvb,
            offset, MIP6_IPV4HAREP_PREFIXL_LEN, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_ha, tvb,
            offset, MIP6_IPV4HAREP_HA_LEN, ENC_BIG_ENDIAN);

    proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));

    return tvb_captured_length(tvb);
}

/* 38 IPv4 Default-Router Address [RFC5844] */
/*
     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     |   Length      |         Reserved (R)          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                  IPv4 Default-Router Address                  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/
static int
dissect_pmip6_opt_ipv4dra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4dra, ett_mip6_opt_ipv4dra, &ti, option_len, MIP6_IPV4DRA_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_reserved, tvb,
            offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_dra, tvb,
            offset, MIP6_IPV4DRA_DRA_LEN, ENC_BIG_ENDIAN);

    proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));

    return tvb_captured_length(tvb);
}

/* 39 IPv4 DHCP Support Mode [RFC5844] */
/*
     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     |   Length      |    Reserved (R)             |S|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

*/

static int
dissect_pmip6_opt_ipv4dsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4dsm, ett_mip6_opt_ipv4dsm, &ti, option_len, MIP6_IPV4DSM_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_ipv4dsm_reserved, tvb,
            offset, 2, ENC_BIG_ENDIAN);
    proto_tree_add_item(opt_tree, hf_mip6_ipv4dsm_s_flag, tvb, offset, 2, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

/* 40 Context Request Option [RFC5949] */
/*
     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +---------------+---------------+---------------+---------------+
    |  Option-Type  | Option-Length |           Reserved            |
    +---------------+---------------+-------------------------------+
    |  Req-type-1   | Req-length-1  |  Req-type-2   | Req-length-2  |
    +---------------------------------------------------------------+
    |  Req-type-3   | Req-length-3  |          Req-option-3         |
    +---------------------------------------------------------------+
    |                              ...                              |

*/

static int
dissect_pmip6_opt_cr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint8  req_type, req_length;
    guint32 vendorid;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_cr, ett_mip6_opt_cr, &ti, option_len, MIP6_CR_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_cr_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    while (offset-2 < option_len) {
        req_type = tvb_get_guint8(tvb,offset);
        proto_tree_add_item(opt_tree, hf_mip6_cr_req_type, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;

        req_length = tvb_get_guint8(tvb,offset);
        proto_tree_add_item(opt_tree, hf_mip6_cr_req_length, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;

        if (req_length == 0)
            continue;

        if (req_type == MIP6_VSM) {
            /* vendor specific option */
            proto_tree_add_item_ret_uint(opt_tree, hf_mip6_vsm_vid, tvb, offset, 4, ENC_BIG_ENDIAN, &vendorid);
            if (vendorid == VENDOR_THE3GPP) {
                proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype_3gpp, tvb, offset+4, 1, ENC_BIG_ENDIAN);
            }
            else {
                proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype, tvb, offset+4, 1, ENC_BIG_ENDIAN);
            }
        }
        else {
            proto_tree_add_item(opt_tree, hf_mip6_vsm_req_data, tvb, offset, req_length, ENC_NA);
        }
        offset += req_length;
    }

    return tvb_captured_length(tvb);
}

/* 41 Local Mobility Anchor Address Option [RFC5949] */
/*
     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Option-Type  | Option-Length |  Option-Code  |   Reserved    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |              Local Mobility Anchor Address ...                |

*/
static int
dissect_pmip6_opt_lmaa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint8 opt_code;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_lmaa, ett_mip6_opt_lmaa, &ti, option_len, MIP6_LMAA_MIN_LEN);

    opt_code = tvb_get_guint8(tvb,offset);
    proto_tree_add_item(opt_tree, hf_mip6_lmaa_opt_code, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

    proto_tree_add_item(opt_tree, hf_mip6_lmaa_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;

    if (opt_code == 1) {
        /* Ipv6 Addr */
        proto_tree_add_item(opt_tree, hf_mip6_lmaa_ipv6, tvb, offset, 16, ENC_NA);
        proto_item_append_text(ti, ": %s", tvb_ip6_to_str(pinfo->pool, tvb,offset));
    }else if (opt_code == 2) {
        /* IPv4 addr */
        proto_tree_add_item(opt_tree, hf_mip6_lmaa_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
        proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));

    }

    return tvb_captured_length(tvb);
}

static int
dissect_pmip6_opt_recap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_recap, ett_mip6_opt_recap, &ti, option_len, MIP6_RECAP_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_recap_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

static int
dissect_pmip6_opt_redir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint16 flag;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_redir, ett_mip6_opt_redir, &ti, option_len, MIP6_REDIR_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_redir_k, tvb, offset, 2, ENC_BIG_ENDIAN);
    proto_tree_add_item(opt_tree, hf_mip6_opt_redir_n, tvb, offset, 2, ENC_BIG_ENDIAN);
    proto_tree_add_item(opt_tree, hf_mip6_opt_redir_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
    flag = tvb_get_ntohs(tvb ,offset);
    offset += 2;

    if (flag & MIP6_REDIR_FLAG_K) {
        proto_tree_add_item(opt_tree, hf_mip6_opt_redir_addr_r2LMA_ipv6, tvb, offset, 16, ENC_NA);
        offset += 16;
    }

    if (flag & MIP6_REDIR_FLAG_N) {
        proto_tree_add_item(opt_tree, hf_mip6_opt_redir_addr_r2LMA_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
        /*offset += 4;*/
    }

    return tvb_captured_length(tvb);
}

static int
dissect_pmip6_opt_load_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_load_inf, ett_mip6_opt_load_inf, &ti, option_len, MIP6_LOAD_INF_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_sessions_in_use, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_maximum_sessions, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_used_capacity, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_maximum_capacity, tvb, offset, 4, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}

static int
dissect_pmip6_opt_alt_ip4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_alt_ip4, ett_mip6_opt_alt_ip4, &ti, option_len, MIP6_ALT_IP4_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_alt_ip4, tvb, offset, 4, ENC_BIG_ENDIAN);

    return tvb_captured_length(tvb);
}
/* RFC 6602
    The type value for this option is 50.

     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     |   Length      |  Sub-type   |    Reserved     |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                  Mobile Node Group Identifier                 |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 */

static int
dissect_pmip6_opt_mng(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    proto_item *item;
    guint32     mng_id;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mng, ett_mip6_opt_mng, &ti, option_len, MIP6_MNG_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mng_sub_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;
    proto_tree_add_item(opt_tree, hf_mip6_opt_mng_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;
    item = proto_tree_add_item_ret_uint(opt_tree, hf_mip6_opt_mng_mng_id, tvb, offset, 4, ENC_BIG_ENDIAN, &mng_id);
    if (mng_id == 1) {
        proto_item_append_text(item, " - ALL-SESSIONS");
    }

    return tvb_captured_length(tvb);
}

/*
11.1.  MAG IPv6 Address

   The MAG IPv6 address mobility option contains the IPv6 address of a
   MAG involved in localized routing.  The MAG IPv6 address option has
   an alignment requirement of 8n+4.

     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     |   Length      |   Reserved    | Address Length|
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                       MAG IPv6 Address                        +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
static int
dissect_pmip6_opt_mag_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;

    opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mag_ipv6, ett_mip6_opt_mag_ipv6, &ti, option_len, MIP6_MAG_IPv6_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;
    proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;
    proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address, tvb, offset, 16, ENC_NA);

    return tvb_captured_length(tvb);
}

/*
    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     |   Length      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                  ...      ANI Sub-option(s) ...                   ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.1.  Format of the Access Network Identifier Sub-Option

   The Access Network Identifier sub-options are used for carrying
   information elements related to the access network to which the
   mobile node is attached.  These sub-options can be included in the
   Access Network Identifier option defined in Section 3.  The format of
   this sub-option is as follows:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |    ANI Type   | ANI Length    |         Option Data           ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   ANI Type:  8-bit unsigned integer indicating the type of the Access
      Network Identifier sub-option.  This specification defines the
      following types:

      0 -  Reserved

      1 -  Network-Identifier sub-option

      2 -  Geo-Location sub-option

      3 -  Operator-Identifier sub-option

*/

static const value_string mmip6_opt_acc_net_id_sub_opt_vals[] = {
    {  0,    "Reserved"},
    {  1,    "Network-Identifier"},
    {  2,    "Geo-Location"},
    {  3,    "Operator-Identifier"},
    {  0,    NULL}
};

static const true_false_string mip6_opt_acc_net_id_sub_opt_e_bit_value = {
    "UTF-8",
    "Encoding is undefined"
};

static const value_string mip6_opt_acc_net_id_sub_opt_op_id_type[] = {
    {  0,    "Reserved"},
    {  1,    "Private Enterprise Number (PEN)"},
    {  2,    "Realm of the operator"},
    {  0,    NULL}
};

static float
degrees_convert_fixed_to_float(guint value)
{
    if (!value)
        return 0;

    /*
     * RFC 6757 section 3.1.2:
     *
     * "A 24-bit {latitude,longitude} degree value encoded as a two's
     * complement, fixed point number with 9 whole bits."
     *
     * "9 whole bits" presumably includes the sign bit; 1 sign bit
     * plus 8 more bits supports values between -256 and 255, which
     * is sufficient to cover -180 to 180.  9 bits plus a sign bit
     * would waste a bit.
     *
     * So we have 1 sign bit plus 8 bits of integral value, followed
     * by a binary point, followed by 15 bits of fractional value.
     * That means that to get the value, we treat the fixed-point
     * number as an integer and divide it by 2^15 = 32768.
     */

    /* Sign-extend to 32 bits */
    if (value & 0x800000) {
        value |= 0xFF000000;
    }

    /* Cast to a signed value, and divide by 32768; do a floating-point divide */
    return ((float)(gint)value) / 32768.0f;
}

static void
degrees_base_custom(gchar *str, guint degrees)
{
    snprintf(str, ITEM_LABEL_LENGTH, "%f", degrees_convert_fixed_to_float(degrees) );
}

static int
dissect_pmip6_opt_acc_net_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item *ti;
    proto_tree *subopt_tree;
    gint16 sub_opt_len;
    guint8 sub_opt, e_bit, net_name_len, ap_name_len;
    const guint8 *ap_name;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    gint offset_end = tvb_reported_length(tvb);

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_acc_net_id, ett_mip6_opt_acc_net_id, &ti, option_len, MIP6_ACC_NET_ID_MIN_LEN);

    while(offset < offset_end) {
        ti = proto_tree_add_item(opt_tree, hf_mip6_opt_acc_net_id_sub, tvb, offset, 2, ENC_NA);
        subopt_tree = proto_item_add_subtree(ti, ett_mip6_sub_opt_acc_net_id);

        proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt, tvb, offset, 1, ENC_BIG_ENDIAN);
        sub_opt = tvb_get_guint8(tvb,offset);
        offset++;

        proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN);
        sub_opt_len = tvb_get_guint8(tvb,offset);
        offset++;

        proto_item_append_text(ti, ": %s (t=%d,l=%d)", val_to_str(sub_opt, mmip6_opt_acc_net_id_sub_opt_vals, "Unknown ANI Type (%02d)"), sub_opt, sub_opt_len);
        proto_item_set_len(ti, sub_opt_len+2);

        switch(sub_opt){
        case 1: /* Network-Identifier */
            /*
                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
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               | ANI Type=1    |  ANI Length   |E|   Reserved  | Net-Name Len  |
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               |                     Network Name (e.g., SSID or PLMNID)       ~
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               | AP-Name Len   |        Access-Point Name                      ~
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            */
            e_bit = tvb_get_guint8(tvb,offset);
            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_e_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;

            net_name_len = tvb_get_guint8(tvb,offset);
            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_net_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;

            if(e_bit == 0x80){
                const guint8* name;
                proto_tree_add_item_ret_string(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_net_name, tvb, offset, net_name_len, ENC_BIG_ENDIAN|ENC_UTF_8, pinfo->pool, &name);
                proto_item_append_text(ti, " Network Name: %s", name);
            }else{
                proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_net_name_data, tvb, offset, net_name_len, ENC_BIG_ENDIAN|ENC_UTF_8);
            };
            offset = offset+net_name_len;

            ap_name_len = tvb_get_guint8(tvb,offset);
            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_ap_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;

            proto_tree_add_item_ret_string(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_ap_name, tvb, offset, ap_name_len, ENC_BIG_ENDIAN|ENC_UTF_8, pinfo->pool, &ap_name);
            proto_item_append_text(ti, " AP Name: %s", ap_name);

            offset = offset+ap_name_len;
            break;

        case 2: /* Geo-Location */
            /*
                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
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               |  ANI Type=2   | ANI Length=6  |       Latitude Degrees
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                               |              Longitude Degrees                |
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            */
            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees, tvb, offset, 3, ENC_BIG_ENDIAN);
            offset +=3;

            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees, tvb, offset, 3, ENC_BIG_ENDIAN);
            offset +=3;
            break;

        case 3: /* Operator-Identifier */
            /*
                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
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               | ANI Type=3    |    ANI Length   |   Op-ID Type  |
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                        Operator-Identifier                    ~
               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            */
            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_op_id_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset += 1;

            proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_op_id, tvb, offset, sub_opt_len - 1, ENC_NA);
            offset = offset + sub_opt_len - 1;

            break;
        default:
            proto_tree_add_expert(subopt_tree, pinfo, &ei_mip6_ani_type_not_dissected, tvb, offset, sub_opt_len);
            offset = offset + sub_opt_len;
            break;
        }
    }

    return tvb_captured_length(tvb);
}

/* 55 Delegated Mobile Network Prefix Option [RFC7148]

    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     |   Length      |V|  Reserved   | Prefix Length |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    .                                                               .
    +           IPv4 or IPv6 Delegated Mobile Network Prefix        +
    |                         (DMNP)                                |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/

static int
dissect_mip6_opt_dmnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_tree* opt_tree;
    proto_item* ti;
    int option_len = tvb_reported_length(tvb)-2;
    int offset = 2;
    guint8 prefix_len;

    opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_dmnp, ett_mip6_opt_dmnp, &ti, option_len, MIP6_DMNP_MIN_LEN);

    proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_v_flag, tvb,
                        offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_reserved, tvb,
                        offset, 1, ENC_BIG_ENDIAN);

    offset++;
    proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_prefix_len, tvb,
                        offset, 1, ENC_BIG_ENDIAN);
    prefix_len = tvb_get_guint8(tvb, offset);

    offset++;

    switch (option_len) {
    case 6:
        /* IPv4 Prefix */
        proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_dmnp_ipv4, tvb,
                            offset, 4, ENC_BIG_ENDIAN);
        proto_item_append_text(ti, ": %s/%u",
                               tvb_ip_to_str(pinfo->pool, tvb, offset), prefix_len);
            break;

    case 18:
        /* IPv6 Prefix */
        proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_dmnp_ipv6, tvb,
                            offset, 16, ENC_NA);
        proto_item_append_text(ti, ": %s/%u",
                               tvb_ip6_to_str(pinfo->pool, tvb, offset), prefix_len);
        break;

    default:
        proto_tree_add_expert(opt_tree, pinfo, &ei_mip6_opt_len_invalid,
                              tvb, offset, -1);
        break;
    }

    return tvb_captured_length(tvb);
}

/* Like "dissect_ip_tcp_options()", but assumes the length of an option
 * *doesn't* include the type and length bytes.  The option parsers,
 * however, are passed a length that *does* include them.
 */
static void
dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
              int eol, packet_info *pinfo, proto_tree *opt_tree)
{
    guchar          opt;
    const char     *name;
    guint           len;
    dissector_handle_t option_dissector;
    tvbuff_t       *next_tvb;
    proto_item     *ti;
    proto_tree     *unknown_tree;

    while ((gint)length > 0) {
        opt = tvb_get_guint8(tvb, offset);
        --length;      /* account for type byte */

        if (opt == MIP6_PAD1) {
          /* We assume that the only option with no length is Pad1 option,
             so that we can treat unknown options as having a minimum length of 2,
             and at least be able to move on to the next option by using the length in the option. */

            proto_tree_add_item(opt_tree, proto_mip6_option_pad1, tvb, offset, 1, ENC_NA);
            offset += 1;
        } else {
            option_dissector = dissector_get_uint_handle(mip6_option_table, opt);
            if (option_dissector == NULL) {
                name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
            } else {
                name = dissector_handle_get_protocol_short_name(option_dissector);
            }

            /* Option has a length. Is it in the packet? */
            if (length == 0) {
                /* Bogus - packet must at least include
                 * option code byte and length byte!
                 */
                proto_tree_add_expert_format(opt_tree, pinfo, &ei_mip6_opt_len_invalid, tvb, offset, 1,
                        "%s (length byte past end of options)", name);
                return;
            }

            len = tvb_get_guint8(tvb, offset + 1);  /* Size specified in option */
            --length;    /* account for length byte */

            if (len > length) {
                /* Bogus - option goes past the end of the header. */
                proto_tree_add_expert_format(opt_tree, pinfo, &ei_mip6_opt_len_invalid, tvb, offset, length,
                        "%s (option length = %u byte%s says option goes past end of options)",
                        name, len, plurality(len, "", "s"));
                return;
            }

            if (option_dissector == NULL) {
                unknown_tree = proto_tree_add_subtree(opt_tree, tvb, offset, len+2, ett_mip6_opt_unknown, &ti, name);
                proto_tree_add_item(unknown_tree, hf_mip6_mobility_opt, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(unknown_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);

                expert_add_info(pinfo, ti, &ei_mip6_ie_not_dissected);
            } else {
                next_tvb = tvb_new_subset_length(tvb, offset, len+2);
                call_dissector(option_dissector, next_tvb, pinfo, opt_tree);
            }

            length -= len;
            offset += (len + 2);
        }

        if (opt == eol)
            break;
    }
}

/* Function to dissect mobility options */
static int
dissect_mip6_options(tvbuff_t *tvb, proto_tree *mip6_tree, int offset, int len,
             packet_info *pinfo)
{
    proto_tree *opts_tree;

    opts_tree = proto_tree_add_subtree(mip6_tree, tvb, offset, len, ett_mip6, NULL, "Mobility Options");

    dissect_mipv6_options(tvb, offset, len, -1, pinfo, opts_tree);

    return len;
}

/* Function that dissects the whole MIPv6 packet */
static int
dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    proto_tree *mip6_tree, *root_tree;
    guint8      type, pproto;
    guint       len, offset = 0, start_offset = offset;
    proto_item *ti, *header_item;
    tvbuff_t   *next_tvb;

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

    len = (tvb_get_guint8(tvb, MIP6_HLEN_OFF) + 1) * 8;
    pproto = tvb_get_guint8(tvb, MIP6_PROTO_OFF);

    root_tree = p_ipv6_pinfo_select_root(pinfo, tree);
    p_ipv6_pinfo_add_len(pinfo, len);

    ti = proto_tree_add_item(root_tree, proto_mip6, tvb, 0, len, ENC_NA);
    mip6_tree = proto_item_add_subtree(ti, ett_mip6);

    /* Process header fields */
    proto_tree_add_item(mip6_tree, hf_mip6_proto, tvb,
            MIP6_PROTO_OFF, 1, ENC_BIG_ENDIAN);

    header_item = proto_tree_add_uint_format_value(mip6_tree, hf_mip6_hlen, tvb,
                MIP6_HLEN_OFF, 1,
                tvb_get_guint8(tvb, MIP6_HLEN_OFF),
                "%u (%u bytes)",
                tvb_get_guint8(tvb, MIP6_HLEN_OFF),
                len);

    proto_tree_add_item(mip6_tree, hf_mip6_mhtype, tvb,
            MIP6_TYPE_OFF, 1, ENC_BIG_ENDIAN);

    proto_tree_add_item(mip6_tree, hf_mip6_reserved, tvb,
            MIP6_RES_OFF, 1, ENC_BIG_ENDIAN);

    proto_tree_add_checksum(mip6_tree, tvb, MIP6_CSUM_OFF, hf_mip6_csum,
            -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);

    /* Process mobility header */
    type = tvb_get_guint8(tvb, MIP6_TYPE_OFF);
    col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_ext(type, &mip6_mh_types_ext, "Unknown Mobility Header (%u)"));
    switch (type) {
    case MIP6_BRR:
        /* 0 Binding Refresh Request */
        offset = dissect_mip6_brr(tvb, mip6_tree, pinfo);
        break;
    case MIP6_HOTI:
        /* 1 Home Test Init */
        offset = dissect_mip6_hoti(tvb, mip6_tree, pinfo);
        break;
    case MIP6_MHCOTI:
        /* 2 Care-of Test Init */
        offset = dissect_mip6_coti(tvb, mip6_tree, pinfo);
        break;
    case MIP6_HOT:
        /* 3 Home Test */
        offset = dissect_mip6_hot(tvb, mip6_tree, pinfo);
        break;
    case MIP6_MHCOT:
        /* 4 Care-of Test */
        offset = dissect_mip6_cot(tvb, mip6_tree, pinfo);
        break;
    case MIP6_BU:
        /* 5 Binding Update */
        pinfo->link_dir = P2P_DIR_UL;
        offset = dissect_mip6_bu(tvb, mip6_tree, pinfo);
        if (proto_nemo == 1) {
            col_set_str(pinfo->cinfo, COL_PROTOCOL, "NEMO");
        }
        break;
    case MIP6_BA:
        /* 6 Binding Acknowledgement */
        pinfo->link_dir = P2P_DIR_DL;
        offset = dissect_mip6_ba(tvb, mip6_tree, pinfo);
        if (proto_nemo == 1) {
            col_set_str(pinfo->cinfo, COL_PROTOCOL, "NEMO");
        }
        break;
    case MIP6_BE:
        /* 7 Binding Error */
        offset = dissect_mip6_be(tvb, mip6_tree, pinfo);
        break;
    case MIP6_FBU:
        /* 8 Fast Binding Update */
        offset = dissect_fmip6_fbu(tvb, mip6_tree, pinfo);
        break;
    case MIP6_FBACK:
        /* 9 Fast Binding Acknowledgment */
        offset = dissect_fmip6_fback(tvb, mip6_tree, pinfo);
        break;
    case MIP6_FNA:
        /* 10 Fast Neighbor Advertisement */
        offset = dissect_fmip6_fna(tvb, mip6_tree, pinfo);
        break;
    case MIP6_EMH:
        /* 11 Experimental Mobility Header RFC5096 */
        if (len > 8) {
            proto_tree_add_item(mip6_tree, hf_mip6_opt_em_data, tvb, offset+MIP6_DATA_OFF, len-MIP6_DATA_OFF, ENC_NA);
        }
        offset = len;
        break;
    case MIP6_HAS:
        /* 12 Home Agent Switch */
        offset = dissect_mip6_has(tvb, mip6_tree, pinfo);
        break;
    case MIP6_HB:
        /* 13 Heartbeat */
        offset = dissect_mip6_hb(tvb, mip6_tree, pinfo);
        break;
    case MIP6_HI:
        /* 14 Handover Initiate RFC5568 */
        offset = dissect_mip6_hi(tvb, mip6_tree, pinfo);
        break;
    case MIP6_HAck:
        /* 14 Handover Acknowledge*/
        offset = dissect_mip6_hack(tvb, mip6_tree, pinfo);
        break;
    case MIP6_BR:
        /* 16 Binding Revocation Indication / Acknowledge */
        offset = dissect_pmip6_bri(tvb, mip6_tree, pinfo);
        break;
    case MIP6_LRI:
        /* 17 Localized Routing Initiation */
        offset = dissect_pmip6_lri(tvb, mip6_tree, pinfo, offset);
        break;
    case MIP6_LRA:
        /* 18 Localized Routing Acknowledgment */
        offset = dissect_pmip6_lra(tvb, mip6_tree, pinfo, offset);
        break;
    default:
        offset = dissect_mip6_unknown(tvb, mip6_tree, pinfo);
        break;
    }

    /* Process mobility options */
    if (offset < len) {
        if (len < (offset - start_offset)) {
            expert_add_info(pinfo, header_item, &ei_mip6_bogus_header_length);
            return offset;
        }
        len -= (offset - start_offset);
        dissect_mip6_options(tvb, mip6_tree, offset, len, pinfo);
    }

    if ((type == MIP6_FNA) && (pproto == IP_PROTO_IPV6)) {
        col_set_str(pinfo->cinfo, COL_INFO, "Fast Neighbor Advertisement[Fast Binding Update]");
        next_tvb = tvb_new_subset_remaining(tvb, len + 8);
        ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip6 *)data);
    }

    if ((type == MIP6_FBACK) && (pproto == IP_PROTO_AH)) {
        col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgment");
        next_tvb = tvb_new_subset_remaining(tvb, len + offset);
        ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip6 *)data);
    }

    return tvb_captured_length(tvb);
}

/* Register the protocol with Wireshark */
void
proto_register_mip6(void)
{
    /* Setup list of header fields */
    static hf_register_info hf[] = {

    { &hf_mip6_proto,
      { "Payload protocol", "mip6.proto",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hlen,
        { "Header length", "mip6.hlen",
                FT_UINT8, BASE_DEC, NULL, 0,
                NULL, HFILL }
    },
    { &hf_mip6_mhtype,
      { "Mobility Header Type", "mip6.mhtype",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mh_types_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_reserved,
      { "Reserved", "mip6.reserved",
        FT_UINT8, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_csum,
      { "Checksum", "mip6.csum",
        FT_UINT16, BASE_HEX, NULL, 0,
        "Header Checksum", HFILL }
    },

    { &hf_mip6_hoti_cookie,
      { "Home Init Cookie", "mip6.hoti.cookie",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_coti_cookie,
      { "Care-of Init Cookie", "mip6.coti.cookie",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_hot_nindex,
      { "Home Nonce Index", "mip6.hot.nindex",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hot_cookie,
      { "Home Init Cookie", "mip6.hot.cookie",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hot_token,
      { "Home Keygen Token", "mip6.hot.token",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_cot_nindex,
      { "Care-of Nonce Index", "mip6.cot.nindex",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_cot_cookie,
      { "Care-of Init Cookie", "mip6.cot.cookie",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },
#if 0
    { &hf_mip6_cot_token,
      { "Care-of Keygen Token", "mip6.cot.token",
        FT_UINT64, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },
#endif

    { &hf_mip6_bu_seqnr,
      { "Sequence number", "mip6.bu.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_bu_a_flag,
      { "Acknowledge (A) flag", "mip6.bu.a_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_a_flag_value), 0x8000,
        NULL, HFILL }
    },
    { &hf_mip6_bu_h_flag,
      { "Home Registration (H) flag", "mip6.bu.h_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_h_flag_value), 0x4000,
        NULL, HFILL }
    },
    { &hf_mip6_bu_l_flag,
      { "Link-Local Compatibility (L) flag", "mip6.bu.l_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_l_flag_value), 0x2000,
        "Home Registration (H) flag", HFILL }
    },
    { &hf_mip6_bu_k_flag,
      { "Key Management Compatibility (K) flag", "mip6.bu.k_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_k_flag_value), 0x1000,
        NULL, HFILL }
    },
    { &hf_mip6_bu_m_flag,
      { "MAP Registration Compatibility (M) flag", "mip6.bu.m_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_m_flag_value), 0x0800,
        NULL, HFILL }
    },
    { &hf_mip6_nemo_bu_r_flag,
      { "Mobile Router (R) flag", "mip6.nemo.bu.r_flag",
        FT_BOOLEAN, 16, TFS(&mip6_nemo_bu_r_flag_value), 0x0400,
        NULL, HFILL }
    },
    { &hf_pmip6_bu_p_flag,
      { "Proxy Registration (P) flag", "mip6.bu.p_flag",
        FT_BOOLEAN, 16, TFS(&pmip6_bu_p_flag_value), 0x0200,
        NULL, HFILL }
    },
    { &hf_mip6_bu_f_flag,
      { "Forcing UDP encapsulation (F) flag", "mip6.bu.f_flag",
        FT_BOOLEAN, 16, TFS(&mip6_bu_f_flag_value), 0x0100,
        NULL, HFILL }
    },
    { &hf_pmip6_bu_t_flag,
      { "TLV-header format (T) flag", "mip6.bu.t_flag",
        FT_BOOLEAN, 16, TFS(&pmip6_bu_t_flag_value), 0x0080,
        NULL, HFILL }
    },
    { &hf_pmip6_bu_b_flag,
      { "Bulk-Binding-Update flag (B)", "mip6.bu.b_flag",
        FT_BOOLEAN, 16, TFS(&pmip6_bu_b_flag_value), 0x0040,
        NULL, HFILL }
    },
    { &hf_mip6_bu_lifetime,
      { "Lifetime", "mip6.bu.lifetime",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_ba_status,
      { "Status", "mip6.ba.status",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_ba_status_value_ext, 0,
        "Binding Acknowledgement status", HFILL }
    },
    { &hf_mip6_ba_k_flag,
      { "Key Management Compatibility (K) flag", "mip6.ba.k_flag",
        FT_BOOLEAN, 8, TFS(&mip6_bu_k_flag_value), 0x80,
        NULL, HFILL }
    },
    { &hf_mip6_nemo_ba_r_flag,
      { "Mobile Router (R) flag", "mip6.nemo.ba.r_flag",
        FT_BOOLEAN, 8, TFS(&mip6_nemo_bu_r_flag_value), 0x40,
        NULL, HFILL }
    },
    { &hf_pmip6_ba_p_flag,
      { "Proxy Registration (P) flag", "mip6.ba.p_flag",
        FT_BOOLEAN, 8, TFS(&pmip6_bu_p_flag_value), 0x20,
        NULL, HFILL }
    },
    { &hf_pmip6_ba_t_flag,
      { "TLV-header format (T) flag", "mip6.ba.t_flag",
        FT_BOOLEAN, 8, TFS(&pmip6_bu_t_flag_value), 0x10,
        NULL, HFILL }
    },
    { &hf_pmip6_ba_b_flag,
      { "Bulk-Binding-Update flag (B)", "mip6.ba.b_flag",
        FT_BOOLEAN, 8, TFS(&pmip6_ba_b_flag_value), 0x08,
        NULL, HFILL }
    },

    { &hf_mip6_ba_seqnr,
      { "Sequence number", "mip6.ba.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_ba_lifetime,
      { "Lifetime", "mip6.ba.lifetime",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_be_status,
      { "Status", "mip6.be.status",
        FT_UINT8, BASE_DEC, VALS(mip6_be_status_value), 0,
        "Binding Error status", HFILL }
    },
    { &hf_mip6_be_haddr,
      { "Home Address", "mip6.be.haddr",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },

    { &hf_fmip6_fbu_seqnr,
      { "Sequence number", "mip6.fbu.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_fmip6_fbu_a_flag,
      { "Acknowledge (A) flag", "mip6.fbu.a_flag",
        FT_BOOLEAN, 8, TFS(&fmip6_fbu_a_flag_value), 0x80,
        NULL, HFILL }
    },
    { &hf_fmip6_fbu_h_flag,
      { "Home Registration (H) flag", "mip6.fbu.h_flag",
        FT_BOOLEAN, 8, TFS(&fmip6_fbu_h_flag_value), 0x40,
        NULL, HFILL }
    },
    { &hf_fmip6_fbu_l_flag,
      { "Link-Local Compatibility (L) flag", "mip6.fbu.l_flag",
        FT_BOOLEAN, 8, TFS(&fmip6_fbu_l_flag_value), 0x20,
        "Home Registration (H) flag", HFILL }
    },
    { &hf_fmip6_fbu_k_flag,
      { "Key Management Compatibility (K) flag", "mip6.fbu.k_flag",
        FT_BOOLEAN, 8, TFS(&fmip6_fbu_k_flag_value), 0x10,
        NULL, HFILL }
    },
    { &hf_fmip6_fbu_lifetime,
      { "Lifetime", "mip6.fbu.lifetime",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_fmip6_fback_status,
      { "Status", "mip6.fback.status",
        FT_UINT8, BASE_DEC, VALS(fmip6_fback_status_value), 0,
        "Fast Binding Acknowledgement status", HFILL }
    },
    { &hf_fmip6_fback_k_flag,
      { "Key Management Compatibility (K) flag", "mip6.fback.k_flag",
        FT_BOOLEAN, 8, TFS(&fmip6_fbu_k_flag_value), 0x80,
        NULL, HFILL }
    },
    { &hf_fmip6_fback_seqnr,
      { "Sequence number", "mip6.fback.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_fmip6_fback_lifetime,
      { "Lifetime", "mip6.fback.lifetime",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_has_num_addrs,
      { "Number of Addresses", "mip6.has.num_addrs",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_has_reserved,
      { "Reserved", "mip6.has.reserved",
        FT_UINT8, BASE_HEX, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_has_address,
      { "Address", "mip6.has.address",
        FT_IPv6, BASE_NONE, NULL, 0,
        "Home Agent Address", HFILL }
    },
    { &hf_mip6_hb_u_flag,
      { "Unsolicited (U) flag", "mip6.hb.u_flag",
        FT_BOOLEAN, 8, TFS(&mip6_hb_u_flag_value), 0x02,
        NULL, HFILL }
    },
    { &hf_mip6_hb_r_flag,
      { "Response (R) flag", "mip6.hb.r_flag",
        FT_BOOLEAN, 8, TFS(&mip6_hb_r_flag_value), 0x01,
        NULL, HFILL }
    },
    { &hf_mip6_hb_seqnr,
      { "Sequence number", "mip6.hb.seqnr",
        FT_UINT32, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hi_seqnr,
      { "Sequence number", "mip6.hi.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hi_s_flag,
      { "Assigned address configuration flag (S) flag", "mip6.hi.s_flag",
        FT_BOOLEAN, 8, NULL, 0x80,
        NULL, HFILL }
    },
    { &hf_mip6_hi_u_flag,
      { "Buffer flag (U) flag", "mip6.hi.u_flag",
        FT_BOOLEAN, 8, NULL, 0x40,
        NULL, HFILL }
    },
    { &hf_mip6_hi_code,
      { "Code", "mip6.hi.code",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hack_seqnr,
      { "Sequence number", "mip6.hack.seqnr",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_hack_code,
      { "Code", "mip6.hack.code",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_reserved,
      { "Reserved", "mip6.3gpp.reserved",
        FT_UINT8, BASE_DEC, NULL, 0xfe,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_flag_m,
      { "M flag", "mip6.3gpp.flag.m",
        FT_BOOLEAN, 8, NULL, 0x01,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_spec_pmipv6_err_code,
      { "3GPP Specific PMIPv6 Error Code", "mip6.3gpp.spec_pmipv6_err_code",
        FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
        "GTPv2 Cause values", HFILL }
    },
    { &hf_mip6_opt_3gpp_pdn_gw_ipv4_addr,
      { "PDN GW IPv4 address", "mip6.3gpp.pdn_gw_ipv4_addr",
        FT_IPv4, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_pdn_gw_ipv6_addr,
      { "PDN GW IPv6 address", "mip6.3gpp.pdn_gw_ipv6_addr",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind,
      { "DHCPv4 Address Allocation Procedure Indication", "mip6.3gpp.dhcpv4_addr_all_proc_ind",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_pdn_type,
      { "PDN type", "mip6.3gpp.pdn_type",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_pdn_ind_cause,
      { "Cause", "mip6.3gpp.pdn_ind_cause",
        FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
        "GTPv2 Cause values", HFILL }
    },
    { &hf_mip6_opt_3gpp_chg_id,
      { "Charging ID", "mip6.3gpp.chg_id",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_charging_characteristic,
      {"Charging Characteristic", "mip6.3gpp.charging_characteristic",
        FT_UINT16, BASE_HEX, NULL, 0xffff,
        NULL, HFILL}
      },
    { &hf_mip6_opt_3gpp_mei,
      {"Mobile Equipment Identity (MEI)", "mip6.3gpp.mei",
        FT_STRING, BASE_NONE, NULL, 0,
        NULL, HFILL}
    },
    { &hf_mip6_opt_3gpp_msisdn,
      {"MSISDN", "mip6.3gpp.msisdn",
        FT_STRING, BASE_NONE, NULL, 0,
        NULL, HFILL}
    },
    { &hf_mip6_opt_3gpp_apn_rest,
      { "APN Restriction", "mip6.3gpp.apn_rest",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_max_apn_rest,
      { "Maximum APN Restriction", "mip6.3gpp.max_apn_rest",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_3gpp_imsi,
      {"Unauthenticated IMSI", "mip6.3gpp.imsi",
        FT_STRING, BASE_NONE, NULL, 0,
        NULL, HFILL}
    },
    { &hf_mip6_opt_3gpp_pdn_conn_id,
      { "PDN Connection ID", "mip6.3gpp.pdn_conn_id",
        FT_UINT8, BASE_DEC, NULL, 0x0f,
        NULL, HFILL }
    },
    { &hf_hf_mip6_opt_3gpp_lapi,
        {"LAPI (Low Access Priority Indication)", "mip6.3gpp.lapi",
        FT_BOOLEAN, 8, NULL, 0x01,
        NULL, HFILL}
    },

    { &hf_mip6_bra_interval,
      { "Refresh interval", "mip6.bra.interval",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_acoa_acoa,
      { "Alternate care-of address", "mip6.acoa.acoa",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_ni_hni,
      { "Home nonce index", "mip6.ni.hni",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_ni_cni,
      { "Care-of nonce index", "mip6.ni.cni",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_bad_auth,
      { "Authenticator", "mip6.bad.auth",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },

    { &hf_fmip6_lla,
      { "Link-layer address", "mip6.lla",
        FT_BYTES, SEP_COLON, NULL, 0,
        NULL, HFILL }
    },

    { &hf_fmip6_lla_optcode,
      { "Option-Code", "mip6.lla.optcode",
        FT_UINT8, BASE_DEC, VALS(fmip6_lla_optcode_value), 0,
        NULL, HFILL }
    },

    { &hf_mip6_nemo_mnp_pfl,
      { "Mobile Network Prefix Length", "mip6.nemo.mnp.pfl",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },

    { &hf_mip6_nemo_mnp_mnp,
      { "Mobile Network Prefix", "mip6.nemo.mnp.mnp",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },


    { &hf_mip6_mnid_subtype,
      { "Subtype", "mip6.mnid.subtype",
        FT_UINT8, BASE_DEC, VALS(mip6_mnid_subtype_value), 0,
        NULL, HFILL }
    },
    { &hf_mip6_mnid_identifier,
      { "Identifier", "mip6.mnid.identifier",
        FT_STRING, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_auth_sub_type,
      { "Subtype", "mip6.auth.subtype",
        FT_UINT8, BASE_DEC, VALS(mip6_auth_subtype_value), 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_auth_mobility_spi,
      { "Mobility SPI", "mip6.auth.mobility_spi",
        FT_UINT32, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_auth_auth_data,
      { "Authentication Data", "mip6.auth.auth_data",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mseg_id_timestamp,
      { "Timestamp", "mip6.mseg_id.timestamp",
        FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_cgar_cga_par,
      { "CGA Parameters", "mip6.cgar.cga_par",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_sign_sign,
      { "CGA Parameters", "mip6.sign.sign",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_phkt_phkt,
      { "Permanent Home Keygen Token", "mip6.phkt.phkt",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mocot_co_keygen_tok,
      { "Care-of Keygen Token", "mip6.mocot.co_keygen_tok",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_dnsu_status,
      { "Status", "mip6.dnsu.status",
        FT_UINT8, BASE_DEC, VALS(mip6_dnsu_status_values), 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_dnsu_flag_r,
      { "R flag", "mip6.dnsu.flag.r",
        FT_BOOLEAN, 8, TFS(&mip6_dnsu_r_flag_value), 0x80,
        NULL, HFILL }
    },
    { &hf_mip6_opt_dnsu_mn_id,
      { "MN identity (FQDN)", "mip6.dnsu.mn_id",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_em_data,
      { "Data", "mip6.em.data",
        FT_BYTES, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_vsm_vid,
      { "Vendor Id", "mip6.vsm.vendorId",
        FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_vsm_subtype,
      { "Subtype", "mip6.vsm.subtype",
        FT_UINT8, BASE_DEC, VALS(mip6_vsm_subtype_value), 0,
        NULL, HFILL }
    },
    { &hf_mip6_vsm_subtype_3gpp,
      { "Subtype", "mip6.vsm.subtype",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_vsm_subtype_3gpp_value_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_ss_identifier,
      { "Identifier", "mip6.ss.identifier",
        FT_STRING, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_badff_spi,
      { "SPI", "mip6.badff.spi",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_badff_auth,
      { "Authenticator", "mip6.badff.auth",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_pmip6_hi_hi,
      { "Handoff Indicator", "mip6.hi",
        FT_UINT8, BASE_DEC, VALS(pmip6_hi_opttype_value), 0,
        NULL, HFILL }
    },
    { &hf_pmip6_hi_reserved,
      { "Reserved", "mip6.hi.reserved",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_pmip6_att_reserved,
      { "Reserved", "mip6.att.reserved",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_pmip6_att_att,
      { "Access Technology Type", "mip6.att",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &pmip6_att_att_value_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mnlli_reserved,
      { "Reserved", "mip6.mnlli.reserved",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mnlli_lli,
      { "Link-layer Identifier", "mip6.mnlli.lli",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_pmip6_timestamp,
      { "Timestamp", "mip6.timestamp_tmp",
        FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_pmip6_opt_lila_lla,
      { "Link-local Address", "mip6.lila_lla",
        FT_IPv6, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_pmip6_rc,
      { "Restart Counter", "mip6.rc",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL}
    },
    { &hf_mip6_ipv4ha_preflen,
      { "Prefix-len", "mip6.ipv4ha.preflen",
        FT_UINT8, BASE_DEC, NULL, 0xfc,
        NULL, HFILL}
    },

    { &hf_mip6_ipv4ha_p_flag,
      { "mobile network prefix (P) flag", "mip6.ipv4ha.p_flag",
        FT_BOOLEAN, 16, TFS(&mip6_ipv4ha_p_flag_value), 0x0200,
        NULL, HFILL }
    },

    { &hf_mip6_ipv4ha_ha,
      { "IPv4 Home Address", "mip6.ipv4ha.ha",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4ha_reserved,
      { "Reserved", "mip6.ipv4ha.reserved",
        FT_UINT8, BASE_HEX, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4aa_status,
      { "Status", "mip6.ipv4aa.sts",
        FT_UINT8, BASE_DEC, VALS(pmip6_ipv4aa_status_values), 0x0,
        NULL, HFILL}
    },
    { &hf_mip6_opt_natd_f_flag,
      { "(F) flag", "mip6.natd.f_flag",
        FT_BOOLEAN, 16, TFS(&mip6_natd_f_flag_value), 0x8000,
        NULL, HFILL }
    },
    { &hf_mip6_opt_natd_reserved,
      { "Reserved", "mip6.natd.reserved",
        FT_UINT16, BASE_DEC, NULL, 0x7fff,
        NULL, HFILL }
    },
    { &hf_mip6_opt_natd_refresh_t,
      { "Refresh time", "mip6.natd.refresh_t",
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_ipv4coa_reserved,
      { "Reserved", "mip6.ipv4coa.reserved",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_ipv4coa_addr,
      { "IPv4 Care-of address", "mip6.ipv4coa.addr",
        FT_IPv4, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_pmip6_gre_key,
      { "GRE Key", "mip6.gre_key",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL}
    },

    { &hf_mip6_opt_mhipv6ap_opt_code,
      { "Option-Code", "mip6.mhipv6ap.opt_code",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mhipv6ap_prefix_l,
      { "Prefix Length", "mip6.mhipv6ap.len",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mhipv6ap_ipv6_address,
      { "IPv6 Address", "mip6.mhipv6ap.ipv6_address",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_mhipv6ap_ipv6_address_prefix,
      { "IPv6 Address/Prefix", "mip6.mhipv6ap.ipv6_address_prefix",
        FT_STRING, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_bi_bid,
      { "Binding ID (BID)", "mip6.bi.bid",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_bi_status,
      { "Status", "mip6.bi.status",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_bi_h_flag,
      { "Simultaneous Home and Foreign Binding (H)", "mip6.bi.h_flag",
        FT_BOOLEAN, 8, NULL, 0x80,
        NULL, HFILL }
    },
    { &hf_mip6_bi_coa_ipv4,
      { "IPv4 care-of address (CoA)", "mip6.bi.coa_ipv4",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_bi_coa_ipv6,
      { "IPv6 care-of address (CoA)", "mip6.bi.coa_ipv6",
        FT_IPv6, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_binding_refresh_request,
      { "Binding Refresh Request", "mip6.binding_refresh_request",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_unknown_type_data,
      { "Message Data", "mip6.unknown_type_data",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_fast_neighbor_advertisement,
      { "Fast Neighbor Advertisement", "mip6.fast_neighbor_advertisement",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_vsm_data,
      { "Data", "mip6.vsm.data",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_vsm_req_data,
      { "Req-Data", "mip6.vsm.req_data",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_padn,
      { "PadN", "mip6.padn",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4dra_reserved,
      { "Reserved", "mip6.ipv4dra.reserved",
        FT_UINT16, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4dra_dra,
      { "IPv4 Default-Router Address", "mip6.ipv4dra.dra",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4dsm_reserved,
      { "Reserved", "mip6.ipv4dsm.reserved",
        FT_UINT16, BASE_DEC, NULL, 0xfffe,
        NULL, HFILL }
    },
    { &hf_mip6_ipv4dsm_s_flag,
      { "DHCP Support Mode (S)", "mip6.ipv4dsm.s_flag",
        FT_BOOLEAN, 16, TFS(&mip6_ipv4dsm_s_flag_value), 0x0001,
        NULL, HFILL }
    },

    { &hf_mip6_cr_reserved,
      { "Reserved", "mip6.cr.reserved",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_cr_req_type,
      { "Req-type", "mip6.cr.req_type",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mobility_options_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_cr_req_length,
      { "Req-length", "mip6.cr.req_length",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_lmaa_opt_code,
      { "Option-Code", "mip6.lmaa.opt_code",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_lmaa_reserved,
      { "Reserved", "mip6.lmaa.reserved",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_lmaa_ipv4,
      { "Local Mobility Anchor Address", "mip6.lmaa.ipv4",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_lmaa_ipv6,
      { "Local Mobility Anchor Address", "mip6.lmaa.ipv6",
        FT_IPv6, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_mobility_opt,
      { "Mobility Option", "mip6.mobility_opt",
        FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mobility_options_ext, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_len,
      { "Length", "mip6.mobility_opt.len",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_pmip6_bri_brtype,
      { "B.R. Type", "mip6.bri_br.type",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_rtrigger,
      { "R. Trigger", "mip6.bri_r.trigger",
        FT_UINT8, BASE_DEC, VALS(pmip6_bri_rtrigger), 0x0,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_status,
      { "Status", "mip6.bri_status",
        FT_UINT8, BASE_DEC, VALS(pmip6_bri_status), 0x0,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_seqnr,
      { "Sequence Number", "mip6.bri_seqnr",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_ip_flag,
      { "Proxy Binding (P) Flag", "mip6.bri_ip",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_iv_flag,
      { "IPv4 HoA Binding Only (V) Flag", "mip6.bri_iv",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_ig_flag,
      { "Global (G) Flag", "mip6.bri_ig",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x2000,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_ap_flag,
      { "Proxy Binding (P) Flag", "mip6.bri_ap",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000,
        NULL, HFILL }
    },
    { &hf_pmip6_bri_av_flag,
      { "IPv4 HoA Binding Only (V) Flag", "mip6.bri_av",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_ag_flag,
      { "Global (G) Flag", "mip6.bri_ag",
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x2000,
        NULL, HFILL }
    },

    { &hf_pmip6_bri_res,
      { "Reserved", "mip6.bri_res",
        FT_UINT16, BASE_HEX, NULL, 0x1FFF,
        "Must be zero", HFILL }
    },

    { &hf_pmip6_lri_sequence,
      { "Sequence", "mip6.lri.sequence",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        "A monotonically increasing integer", HFILL }
    },

    { &hf_pmip6_lri_reserved,
      { "Reserved", "mip6.lri.reserved",
        FT_UINT16, BASE_HEX, NULL, 0x0,
        "This field is unused and MUST be set to zero", HFILL }
    },

    { &hf_pmip6_lri_lifetime,
      { "Lifetime", "mip6.lri.lifetime",
        FT_UINT16, BASE_HEX, NULL, 0x0,
        "The requested time, in seconds", HFILL }
    },

    { &hf_pmip6_lra_sequence,
      { "Sequence", "mip6.lra.sequence",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        "A monotonically increasing integer", HFILL }
    },

    { &hf_pmip6_lra_u,
      { "unsolicited", "mip6.lri.unsolicited",
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
        "When set to 1, the LRA message is sent unsolicited", HFILL }
    },

    { &hf_pmip6_lra_reserved,
      { "Reserved", "mip6.lra.reserved",
        FT_UINT8, BASE_HEX, NULL, 0x7F,
        "This field is unused and MUST be set to zero", HFILL }
    },

    { &hf_pmip6_lra_status,
      { "Status", "mip6.lra.status",
        FT_UINT8, BASE_DEC, VALS(pmip6_lra_status_vals), 0x0,
        "Indicating the result of processing the Localized Routing Acknowledgment message.", HFILL }
    },

    { &hf_pmip6_lra_lifetime,
      { "Lifetime", "mip6.lra.lifetime",
        FT_UINT16, BASE_HEX, NULL, 0x0,
        "The requested time, in seconds", HFILL }
    },

    { &hf_mip6_opt_recap_reserved,
      { "Reserved", "mip6.recap.reserved",
        FT_UINT16, BASE_HEX, NULL, 0x0,
        "Must be zero", HFILL }
    },

    { &hf_mip6_opt_redir_k,
      { "K", "mip6.redir.k",
        FT_BOOLEAN, 16, NULL, MIP6_REDIR_FLAG_K,
        "bit is set (1) if the Optional IPv6 r2LMA Address is included in the mobility option", HFILL }
    },
    { &hf_mip6_opt_redir_n,
      { "N", "mip6.redir.n",
        FT_BOOLEAN, 16, NULL, MIP6_REDIR_FLAG_N,
        "bit is set (1) if the Optional IPv4 r2LMA Address is included in the mobility option", HFILL }
    },
    { &hf_mip6_opt_redir_reserved,
      { "Reserved", "mip6.redir.reserved",
        FT_UINT16, BASE_HEX, NULL, MIP6_REDIR_FLAG_RSV,
        "Must be zero", HFILL }
    },
    { &hf_mip6_opt_redir_addr_r2LMA_ipv6,
      { "IPv6 r2LMA Address", "mip6.redir.addr_r2lma_ipv6",
        FT_IPv6, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_redir_addr_r2LMA_ipv4,
      { "IPv4 r2LMA Address", "mip6.redir.addr_r2lma_ipv4",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_load_inf_priority,
      { "Priority", "mip6.load_inf.priority",
        FT_UINT16, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_load_inf_sessions_in_use,
      { "Sessions in Use", "mip6.load_inf.sessions_in_use",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_load_inf_maximum_sessions,
      { "Maximum Sessions", "mip6.load_inf.maximum_sessions",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_load_inf_used_capacity,
      { "Used Capacity", "mip6.load_inf.used_capacity",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_load_inf_maximum_capacity,
      { "Maximum Capacity", "mip6.load_inf.maximum_capacity",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_alt_ip4,
      { "Alternate IPv4 Care-of Address", "mip6.alt_ip4",
        FT_IPv4, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_mng_sub_type,
      { "Sub Type", "mip6.mng.sub_type",
        FT_UINT8, BASE_DEC, VALS(mip6_mng_id_type_vals), 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_mng_reserved,
      { "Reserved", "mip6.mng.reserved",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_mng_mng_id,
      { "Mobile Node Group Identifier", "mip6.mng.mng_id",
        FT_UINT32, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_mag_ipv6_reserved,
      { "Reserved", "mip6.mag_ipv6.reserved",
        FT_UINT8, BASE_HEX, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_mag_ipv6_address_length,
      { "Address Length", "mip6.mag_ipv6.address_length",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        "This field MUST be set to 128", HFILL }
    },

    { &hf_mip6_opt_mag_ipv6_address,
      { "Address", "mip6.mag_ipv6.address",
        FT_IPv6, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub,
      { "ANI", "mip6.acc_net_id",
        FT_NONE, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },


    { &hf_mip6_opt_acc_net_id_sub_opt,
      { "ANI Type", "mip6.acc_net_id.ani",
        FT_UINT8, BASE_DEC, VALS(mmip6_opt_acc_net_id_sub_opt_vals), 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_len,
      { "Length", "mip6.acc_net_id.sub_opt_len",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_e_bit,
      { "E(Encoding)", "mip6.acc_net_id.e_bit",
        FT_BOOLEAN, 8, TFS(&mip6_opt_acc_net_id_sub_opt_e_bit_value), 0x80,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_net_name_len,
      { "Net-Name Length", "mip6.acc_net_id.net_name_len",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_net_name,
      { "Network Name", "mip6.acc_net_id.net_name",
        FT_STRING, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_net_name_data,
      { "Network Name", "mip6.acc_net_id.net_name_data",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        "Network Name with undefined format", HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_ap_name_len,
      { "AP-Name Length", "mip6.acc_net_id.ap_name_len",
        FT_UINT8, BASE_DEC, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_ap_name,
      { "Access-Point Name", "mip6.acc_net_id.ap_name",
        FT_STRING, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees,
      { "Latitude Degrees", "mip6.acc_net_id.geo.latitude_degrees",
        FT_INT24, BASE_CUSTOM, CF_FUNC(degrees_base_custom), 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees,
      { "Longitude Degrees", "mip6.acc_net_id.geo.longitude_degrees",
        FT_INT24, BASE_CUSTOM, CF_FUNC(degrees_base_custom), 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_op_id_type,
      { "Op-ID Type", "mip6.acc_net_id.op_id.type",
        FT_UINT8, BASE_DEC, VALS(mip6_opt_acc_net_id_sub_opt_op_id_type), 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_acc_net_id_sub_opt_op_id,
      { "Op-ID", "mip6.acc_net_id.op_id",
        FT_BYTES, BASE_NONE, NULL, 0x0,
        NULL, HFILL }
    },

    { &hf_mip6_opt_dmnp_v_flag,
      { "IPv4 Prefix (V) flag", "mip6.dmnp.v_flag",
        FT_BOOLEAN, 8, TFS(&mip6_dmnp_v_flag_value), 0x80,
        NULL, HFILL }
    },

    { &hf_mip6_opt_dmnp_reserved,
      { "Reserved", "mip6.dmnp.reserved",
        FT_UINT8, BASE_DEC, NULL, 0x7F,
        NULL, HFILL }
    },

    { &hf_mip6_opt_dmnp_prefix_len,
      { "Prefix Length", "mip6.dmnp.prefix_len",
        FT_UINT8, BASE_DEC, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_dmnp_dmnp_ipv4,
      { "IPv4 Delegated Mobile Network Prefix", "mip6.dmnp.dmnp_ipv4",
        FT_IPv4, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },
    { &hf_mip6_opt_dmnp_dmnp_ipv6,
      { "IPv6 Delegated Mobile Network Prefix", "mip6.dmnp.dmnp_ipv6",
        FT_IPv6, BASE_NONE, NULL, 0,
        NULL, HFILL }
    },

};

    /* Setup protocol subtree array */
    static gint *ett[] = {
        &ett_mip6,
        &ett_mip6_opts,
        &ett_mip6_opt_pad1,
        &ett_mip6_opt_padn,
        &ett_mip6_opt_bra,
        &ett_mip6_opt_acoa,
        &ett_mip6_opt_ni,
        &ett_mip6_opt_bad,
        &ett_fmip6_opt_lla,
        &ett_mip6_nemo_opt_mnp,
        &ett_mip6_opt_mnid,
        &ett_mip6_opt_auth,
        &ett_mip6_opt_mesgid,
        &ett_mip6_opt_cgapr,
        &ett_mip6_opt_cgar,
        &ett_mip6_opt_sign,
        &ett_mip6_opt_phkt,
        &ett_mip6_opt_mocoti,
        &ett_mip6_opt_mocot,
        &ett_mip6_opt_dnsu,
        &ett_mip6_opt_em,
        &ett_mip6_opt_vsm,
        &ett_mip6_opt_ssm,
        &ett_mip6_opt_badff,
        &ett_mip6_opt_unknown,
        &ett_pmip6_opt_hnp,
        &ett_pmip6_opt_hi,
        &ett_pmip6_opt_att,
        &ett_pmip6_opt_mnlli,
        &ett_pmip6_opt_lla,
        &ett_pmip6_opt_ts,
        &ett_pmip6_opt_rc,
        &ett_mip6_opt_ipv4ha,
        &ett_mip6_opt_ipv4aa,
        &ett_mip6_opt_natd,
        &ett_mip6_opt_ipv4coa,
        &ett_pmip6_opt_grek,
        &ett_pmip6_opt_mhipv6ap,
        &ett_pmip6_opt_bi,
        &ett_mip6_opt_ipv4hareq,
        &ett_mip6_opt_ipv4harep,
        &ett_mip6_opt_ipv4dra,
        &ett_mip6_opt_ipv4dsm,
        &ett_mip6_opt_cr,
        &ett_mip6_opt_lmaa,
        &ett_mip6_opt_recap,
        &ett_mip6_opt_redir,
        &ett_mip6_opt_load_inf,
        &ett_mip6_opt_alt_ip4,
        &ett_mip6_opt_mng,
        &ett_mip6_opt_mag_ipv6,
        &ett_mip6_opt_acc_net_id,
        &ett_mip6_sub_opt_acc_net_id,
        &ett_mip6_opt_dmnp,
    };

    static ei_register_info ei[] = {
        { &ei_mip6_ie_not_dissected, { "mip6.ie_not_dissected", PI_UNDECODED, PI_NOTE, "IE data not dissected yet", EXPFILL }},
        { &ei_mip6_ani_type_not_dissected, { "mip6.acc_net_id.ani.unknown", PI_UNDECODED, PI_NOTE, "ANI Type not dissect yet", EXPFILL }},
        { &ei_mip6_opt_len_invalid, { "mip6.opt.len.invalid", PI_PROTOCOL, PI_WARN, "Invalid length for option", EXPFILL }},
        { &ei_mip6_vsm_data_not_dissected, { "mip6.vsm.data_not_dissected", PI_UNDECODED, PI_NOTE, "Data (Not dissected yet)", EXPFILL }},
        { &ei_mip6_bogus_header_length, { "mip6.bogus_header_length", PI_PROTOCOL, PI_WARN, "Bogus header length", EXPFILL }},
    };

    expert_module_t* expert_mip6;

    /* Register the protocol name and description */
    proto_mip6 = proto_register_protocol("Mobile IPv6", "MIPv6", "mipv6");

    /* Register the dissector by name */
    mip6_handle = register_dissector("mip6", dissect_mip6, proto_mip6);

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

    mip6_vsm_dissector_table = register_dissector_table("mip6.vsm", "Mobile IPv6 vendor specific option", proto_mip6, FT_UINT32, BASE_DEC);
    mip6_option_table = register_dissector_table("mip6.option", "MIPv6 Options", proto_mip6, FT_UINT8, BASE_DEC);

    /* Register MIPv6 options as their own protocols so we can get the name of the option */
    proto_mip6_option_pad1 = proto_register_protocol_in_name_only("MIPv6 Option - Pad1", "Pad1", "mip6.options.pad1", proto_mip6, FT_BYTES);
    proto_mip6_option_padn = proto_register_protocol_in_name_only("MIPv6 Option - PadN", "PadN", "mip6.options.padn", proto_mip6, FT_BYTES);
    proto_mip6_option_bra = proto_register_protocol_in_name_only("MIPv6 Option - Binding Refresh Advice", "Binding Refresh Advice", "mip6.options.bra", proto_mip6, FT_BYTES);
    proto_mip6_option_acoa = proto_register_protocol_in_name_only("MIPv6 Option - Alternate Care-of Address", "Alternate Care-of Address", "mip6.options.acoa", proto_mip6, FT_BYTES);
    proto_mip6_option_ni = proto_register_protocol_in_name_only("MIPv6 Option - Nonce Indices", "Nonce Indices", "mip6.options.ni", proto_mip6, FT_BYTES);
    proto_mip6_option_bad_auth = proto_register_protocol_in_name_only("MIPv6 Option - Authorization Data", "Authorization Data", "mip6.options.bad_auth", proto_mip6, FT_BYTES);
    proto_mip6_option_mnp = proto_register_protocol_in_name_only("MIPv6 Option - Mobile Network Prefix", "Mobile Network Prefix", "mip6.options.mnp", proto_mip6, FT_BYTES);
    proto_mip6_option_mhlla = proto_register_protocol_in_name_only("MIPv6 Option - Mobility Header Link-Layer Address", "Mobility Header Link-Layer Address", "mip6.options.mhlla", proto_mip6, FT_BYTES);
    proto_mip6_option_mnid = proto_register_protocol_in_name_only("MIPv6 Option - Mobile Node Identifier", "Mobile Node Identifier", "mip6.options.mnid", proto_mip6, FT_BYTES);
    proto_mip6_option_auth = proto_register_protocol_in_name_only("MIPv6 Option - AUTH-OPTION-TYPE", "AUTH-OPTION-TYPE", "mip6.options.auth", proto_mip6, FT_BYTES);
    proto_mip6_option_mseg_id = proto_register_protocol_in_name_only("MIPv6 Option - MESG-ID-OPTION-TYPE", "MESG-ID-OPTION-TYPE", "mip6.options.mseg_id", proto_mip6, FT_BYTES);
    proto_mip6_option_cgapr = proto_register_protocol_in_name_only("MIPv6 Option - CGA Parameters Request", "CGA Parameters Request", "mip6.options.cgapr", proto_mip6, FT_BYTES);
    proto_mip6_option_cgar = proto_register_protocol_in_name_only("MIPv6 Option - CGA Parameters", "CGA Parameters", "mip6.options.cgar", proto_mip6, FT_BYTES);
    proto_mip6_option_sign = proto_register_protocol_in_name_only("MIPv6 Option - Signature", "Signature", "mip6.options.sign", proto_mip6, FT_BYTES);
    proto_mip6_option_phkt = proto_register_protocol_in_name_only("MIPv6 Option - Permanent Home Keygen Token", "Permanent Home Keygen Token", "mip6.options.phkt", proto_mip6, FT_BYTES);
    proto_mip6_option_coti = proto_register_protocol_in_name_only("MIPv6 Option - Care-of Test Init", "Care-of Test Init", "mip6.options.coti", proto_mip6, FT_BYTES);
    proto_mip6_option_cot = proto_register_protocol_in_name_only("MIPv6 Option - Care-of Test", "Care-of Test", "mip6.options.cot", proto_mip6, FT_BYTES);
    proto_mip6_option_dnsu = proto_register_protocol_in_name_only("MIPv6 Option - DNS-UPDATE-TYPE", "DNS-UPDATE-TYPE", "mip6.options.dnsu", proto_mip6, FT_BYTES);
    proto_mip6_option_em = proto_register_protocol_in_name_only("MIPv6 Option - Experimental", "Experimental", "mip6.options.em", proto_mip6, FT_BYTES);
    proto_mip6_option_vsm = proto_register_protocol_in_name_only("MIPv6 Option - Vendor Specific", "Vendor Specific", "mip6.options.vsm", proto_mip6, FT_BYTES);
    proto_mip6_option_ssm = proto_register_protocol_in_name_only("MIPv6 Option - Service Selection", "Service Selection", "mip6.options.ssm", proto_mip6, FT_BYTES);
    proto_mip6_option_badff = proto_register_protocol_in_name_only("MIPv6 Option - Binding Authorization Data for FMIPv6 (BADF)", "Binding Authorization Data for FMIPv6 (BADF)", "mip6.options.badff", proto_mip6, FT_BYTES);
    proto_mip6_option_hnp = proto_register_protocol_in_name_only("MIPv6 Option - Home Network Prefix", "Home Network Prefix", "mip6.options.hnp", proto_mip6, FT_BYTES);
    proto_mip6_option_hi = proto_register_protocol_in_name_only("MIPv6 Option - Handoff Indicator", "Handoff Indicator", "mip6.options.hi", proto_mip6, FT_BYTES);
    proto_mip6_option_att = proto_register_protocol_in_name_only("MIPv6 Option - Access Technology Type Option", "Access Technology Type Option", "mip6.options.att", proto_mip6, FT_BYTES);
    proto_mip6_option_mnlli = proto_register_protocol_in_name_only("MIPv6 Option - Mobile Node Link-layer Identifier", "Mobile Node Link-layer Identifier", "mip6.options.mnlli", proto_mip6, FT_BYTES);
    proto_mip6_option_lla = proto_register_protocol_in_name_only("MIPv6 Option - Link-local Address", "Link-local Address", "mip6.options.lla", proto_mip6, FT_BYTES);
    proto_mip6_option_ts = proto_register_protocol_in_name_only("MIPv6 Option - Timestamp", "Timestamp", "mip6.options.ts", proto_mip6, FT_BYTES);
    proto_mip6_option_rc = proto_register_protocol_in_name_only("MIPv6 Option - Restart Counter", "Restart Counter", "mip6.options.rc", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4ha = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Home Address", "IPv4 Home Address", "mip6.options.ipv4ha", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4aa = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Address Acknowledgement", "IPv4 Address Acknowledgement", "mip6.options.ipv4aa", proto_mip6, FT_BYTES);
    proto_mip6_option_natd = proto_register_protocol_in_name_only("MIPv6 Option - NAT Detection", "NAT Detection", "mip6.options.natd", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4coa = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Care-of Address", "IPv4 Care-of Address", "mip6.options.ipv4coa", proto_mip6, FT_BYTES);
    proto_mip6_option_grek = proto_register_protocol_in_name_only("MIPv6 Option - GRE Key", "GRE Key", "mip6.options.grek", proto_mip6, FT_BYTES);
    proto_mip6_option_mhipv6ap = proto_register_protocol_in_name_only("MIPv6 Option - Mobility Header IPv6 Address/Prefix", "Mobility Header IPv6 Address/Prefix", "mip6.options.mhipv6ap", proto_mip6, FT_BYTES);
    proto_mip6_option_bi = proto_register_protocol_in_name_only("MIPv6 Option - Binding Identifier", "Binding Identifier", "mip6.options.bi", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4hareq = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Home Address Request", "IPv4 Home Address Request", "mip6.options.ipv4hareq", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4harep = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Home Address Reply", "IPv4 Home Address Reply", "mip6.options.ipv4harep", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4dra = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 Default-Router Address", "IPv4 Default-Router Address", "mip6.options.ipv4dra", proto_mip6, FT_BYTES);
    proto_mip6_option_ipv4dsm = proto_register_protocol_in_name_only("MIPv6 Option - IPv4 DHCP Support Mode", "IPv4 DHCP Support Mode", "mip6.options.ipv4dsm", proto_mip6, FT_BYTES);
    proto_mip6_option_cr = proto_register_protocol_in_name_only("MIPv6 Option - Context Request", "Context Request", "mip6.options.cr", proto_mip6, FT_BYTES);
    proto_mip6_option_lmaa = proto_register_protocol_in_name_only("MIPv6 Option - Mobile Node Link-local Address Interface Identifier", "Mobile Node Link-local Address Interface Identifier", "mip6.options.lmaa", proto_mip6, FT_BYTES);
    proto_mip6_option_recap = proto_register_protocol_in_name_only("MIPv6 Option - Redirect-Capability", "Redirect-Capability", "mip6.options.recap", proto_mip6, FT_BYTES);
    proto_mip6_option_redir = proto_register_protocol_in_name_only("MIPv6 Option - Redirect", "Redirect", "mip6.options.redir", proto_mip6, FT_BYTES);
    proto_mip6_option_load_inf = proto_register_protocol_in_name_only("MIPv6 Option - Load Information", "Load Information", "mip6.options.load_inf", proto_mip6, FT_BYTES);
    proto_mip6_option_alt_ip4 = proto_register_protocol_in_name_only("MIPv6 Option - Alternate IPv4", "Alternate IPv4", "mip6.options.alt_ip4", proto_mip6, FT_BYTES);
    proto_mip6_option_mng = proto_register_protocol_in_name_only("MIPv6 Option - Mobile Node Group Identifier", "Mobile Node Group Identifier", "mip6.options.mng", proto_mip6, FT_BYTES);
    proto_mip6_option_mag_ipv6 = proto_register_protocol_in_name_only("MIPv6 Option - MAG IPv6 Address", "MAG IPv6 Address", "mip6.options.mag_ipv6", proto_mip6, FT_BYTES);
    proto_mip6_option_acc_net_id = proto_register_protocol_in_name_only("MIPv6 Option - Access Network Identifier", "Access Network Identifier", "mip6.options.acc_net_id", proto_mip6, FT_BYTES);
    proto_mip6_option_dmnp = proto_register_protocol_in_name_only("MIPv6 Option - Delegated Mobile Network Prefix", "Delegated Mobile Network Prefix", "mip6.options.dmnp", proto_mip6, FT_BYTES);
}

void
proto_reg_handoff_mip6(void)
{
    dissector_add_uint("ip.proto", IP_PROTO_MIPV6_OLD, mip6_handle);
    dissector_add_uint("ip.proto", IP_PROTO_MIPV6, mip6_handle);

    /* Add support for PMIPv6 control messages over IPV4 */
    dissector_add_uint_with_preference("udp.port", UDP_PORT_PMIP6_CNTL, mip6_handle);
    ip_dissector_table = find_dissector_table("ip.proto");

    dissector_add_uint("mip6.vsm", VENDOR_THE3GPP, create_dissector_handle(dissect_mip6_opt_vsm_3gpp, proto_mip6));


    /* Create dissection function handles for all MIPv6 options */
    dissector_add_uint("mip6.option", MIP6_PADN, create_dissector_handle( dissect_mip6_opt_padn, proto_mip6_option_padn ));
    dissector_add_uint("mip6.option", MIP6_BRA, create_dissector_handle( dissect_mip6_opt_bra, proto_mip6_option_bra ));
    dissector_add_uint("mip6.option", MIP6_ACOA, create_dissector_handle( dissect_mip6_opt_acoa, proto_mip6_option_acoa ));
    dissector_add_uint("mip6.option", MIP6_NI, create_dissector_handle( dissect_mip6_opt_ni, proto_mip6_option_ni ));
    dissector_add_uint("mip6.option", MIP6_AUTD, create_dissector_handle( dissect_mip6_opt_bad, proto_mip6_option_bad_auth ));
    dissector_add_uint("mip6.option", MIP6_MNP, create_dissector_handle( dissect_mip6_nemo_opt_mnp, proto_mip6_option_mnp ));
    dissector_add_uint("mip6.option", MIP6_MHLLA, create_dissector_handle( dissect_fmip6_opt_lla, proto_mip6_option_mhlla ));
    dissector_add_uint("mip6.option", MIP6_MNID, create_dissector_handle( dissect_mip6_opt_mnid, proto_mip6_option_mnid ));
    dissector_add_uint("mip6.option", MIP6_AUTH, create_dissector_handle( dissect_mip6_opt_auth, proto_mip6_option_auth ));
    dissector_add_uint("mip6.option", MIP6_MESGID, create_dissector_handle( dissect_mip6_opt_mseg_id, proto_mip6_option_mseg_id ));
    dissector_add_uint("mip6.option", MIP6_CGAPR, create_dissector_handle( dissect_mip6_opt_cgapr, proto_mip6_option_cgapr ));
    dissector_add_uint("mip6.option", MIP6_CGAR, create_dissector_handle( dissect_mip6_opt_cgar, proto_mip6_option_cgar ));
    dissector_add_uint("mip6.option", MIP6_SIGN, create_dissector_handle( dissect_mip6_opt_sign, proto_mip6_option_sign ));
    dissector_add_uint("mip6.option", MIP6_PHKT, create_dissector_handle( dissect_mip6_opt_phkt, proto_mip6_option_phkt ));
    dissector_add_uint("mip6.option", MIP6_MOCOTI, create_dissector_handle( dissect_mip6_opt_coti, proto_mip6_option_coti ));
    dissector_add_uint("mip6.option", MIP6_MOCOT, create_dissector_handle( dissect_mip6_opt_mocot, proto_mip6_option_cot ));
    dissector_add_uint("mip6.option", MIP6_DNSU, create_dissector_handle( dissect_mip6_opt_dnsu, proto_mip6_option_dnsu ));
    dissector_add_uint("mip6.option", MIP6_EM, create_dissector_handle( dissect_mip6_opt_em, proto_mip6_option_em ));
    dissector_add_uint("mip6.option", MIP6_VSM, create_dissector_handle( dissect_mip6_opt_vsm, proto_mip6_option_vsm ));
    dissector_add_uint("mip6.option", MIP6_SSM, create_dissector_handle( dissect_mip6_opt_ssm, proto_mip6_option_ssm ));
    dissector_add_uint("mip6.option", MIP6_BADFF, create_dissector_handle( dissect_mip6_opt_badff, proto_mip6_option_badff ));
    dissector_add_uint("mip6.option", MIP6_HNP, create_dissector_handle( dissect_mip6_opt_hnp, proto_mip6_option_hnp ));
    dissector_add_uint("mip6.option", MIP6_MOHI, create_dissector_handle( dissect_pmip6_opt_hi, proto_mip6_option_hi ));
    dissector_add_uint("mip6.option", MIP6_ATT, create_dissector_handle( dissect_pmip6_opt_att, proto_mip6_option_att ));
    dissector_add_uint("mip6.option", MIP6_MNLLI, create_dissector_handle( dissect_pmip6_opt_mnlli, proto_mip6_option_mnlli ));
    dissector_add_uint("mip6.option", MIP6_LLA, create_dissector_handle( dissect_pmip6_opt_lla, proto_mip6_option_lla ));
    dissector_add_uint("mip6.option", MIP6_TS, create_dissector_handle( dissect_pmip6_opt_ts, proto_mip6_option_ts ));
    dissector_add_uint("mip6.option", MIP6_RC, create_dissector_handle( dissect_pmip6_opt_rc, proto_mip6_option_rc ));
    dissector_add_uint("mip6.option", MIP6_IPV4HA, create_dissector_handle( dissect_pmip6_opt_ipv4ha, proto_mip6_option_ipv4ha ));
    dissector_add_uint("mip6.option", MIP6_IPV4AA, create_dissector_handle( dissect_pmip6_opt_ipv4aa, proto_mip6_option_ipv4aa ));
    dissector_add_uint("mip6.option", MIP6_NATD, create_dissector_handle( dissect_pmip6_opt_natd, proto_mip6_option_natd ));
    dissector_add_uint("mip6.option", MIP6_IPV4COA, create_dissector_handle( dissect_pmip6_opt_ipv4coa, proto_mip6_option_ipv4coa ));
    dissector_add_uint("mip6.option", MIP6_GREK, create_dissector_handle( dissect_pmip6_opt_grek, proto_mip6_option_grek ));
    dissector_add_uint("mip6.option", MIP6_MHIPV6AP, create_dissector_handle( dissect_pmip6_opt_mhipv6ap, proto_mip6_option_mhipv6ap ));
    dissector_add_uint("mip6.option", MIP6_BI, create_dissector_handle( dissect_pmip6_opt_bi, proto_mip6_option_bi ));
    dissector_add_uint("mip6.option", MIP6_IPV4HAREQ, create_dissector_handle( dissect_pmip6_opt_ipv4hareq, proto_mip6_option_ipv4hareq ));
    dissector_add_uint("mip6.option", MIP6_IPV4HAREP, create_dissector_handle( dissect_pmip6_opt_ipv4harep, proto_mip6_option_ipv4harep ));
    dissector_add_uint("mip6.option", MIP6_IPV4DRA, create_dissector_handle( dissect_pmip6_opt_ipv4dra, proto_mip6_option_ipv4dra ));
    dissector_add_uint("mip6.option", MIP6_IPV4DSM, create_dissector_handle( dissect_pmip6_opt_ipv4dsm, proto_mip6_option_ipv4dsm ));
    dissector_add_uint("mip6.option", MIP6_CR, create_dissector_handle( dissect_pmip6_opt_cr, proto_mip6_option_cr ));
    dissector_add_uint("mip6.option", MIP6_LMAA, create_dissector_handle( dissect_pmip6_opt_lmaa, proto_mip6_option_lmaa ));
    dissector_add_uint("mip6.option", MIP6_RECAP, create_dissector_handle( dissect_pmip6_opt_recap, proto_mip6_option_recap ));
    dissector_add_uint("mip6.option", MIP6_REDIR, create_dissector_handle( dissect_pmip6_opt_redir, proto_mip6_option_redir ));
    dissector_add_uint("mip6.option", MIP6_LOAD_INF, create_dissector_handle( dissect_pmip6_opt_load_inf, proto_mip6_option_load_inf ));
    dissector_add_uint("mip6.option", MIP6_ALT_IP4_CO, create_dissector_handle( dissect_pmip6_opt_alt_ip4, proto_mip6_option_alt_ip4 ));
    dissector_add_uint("mip6.option", MIP6_MNG, create_dissector_handle( dissect_pmip6_opt_mng, proto_mip6_option_mng ));
    dissector_add_uint("mip6.option", MIP6_MAG_IPv6, create_dissector_handle( dissect_pmip6_opt_mag_ipv6, proto_mip6_option_mag_ipv6 ));
    dissector_add_uint("mip6.option", MIP6_ACC_NET_ID, create_dissector_handle( dissect_pmip6_opt_acc_net_id, proto_mip6_option_acc_net_id ));
    dissector_add_uint("mip6.option", MIP6_DMNP, create_dissector_handle( dissect_mip6_opt_dmnp, proto_mip6_option_dmnp ));
}

/*
 * Editor modelines  -  https://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:
 */