1 /* packet-mip6.c
2  *
3  * Definitions and Routines for Mobile IPv6 dissection (RFC 3775)
4  * Copyright 2003 Oy L M Ericsson Ab <teemu.rinta-aho@ericsson.fi>
5  *
6  * FMIPv6 (RFC 4068) support added by Martin Andre <andre@clarinet.u-strasbg.fr>
7  * Copyright 2006, Nicolas DICHTEL - 6WIND - <nicolas.dichtel@6wind.com>
8  *
9  * Modifications for NEMO packets (RFC 3963): Bruno Deniaud
10  * (bdeniaud@irisa.fr, nono@chez.com) 12 Oct 2005
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 1998 Gerald Combs
15  *
16  * SPDX-License-Identifier: GPL-2.0-or-later
17  *
18  * References:
19  * RFC 3775, Mobility Support in IPv6
20  * RFC 4285, Authentication Protocol for Mobile IPv6
21  * RFC 4866, Enhanced Route Optimization for Mobile IPv6
22  * RFC 5026, Mobile IPv6 Bootstrapping in Split Scenario
23  * RFC 5094, Mobile IPv6 Vendor Specific Option
24  * RFC 5096, Mobile IPv6 Experimental Messages
25  * RFC 5213, Proxy Mobile IPv6
26  * RFC 5555, Mobile IPv6 Support for Dual Stack Hosts and Routers (Errata)
27  * RFC 5568. Mobile IPv6 Fast Handovers
28  * RFC 5648, Multiple Care-of Addresses Registration
29  * RFC 5844, IPv4 Support for Proxy Mobile IPv6
30  * RFC 5949, Fast Handovers for Proxy Mobile IPv6
31  * RFC 6275, Mobility Support in IPv6 (Obsoletes RFC 3775).
32  * RFC 6602, Bulk Binding Update Support for Proxy Mobile IPv6
33  * RFC 6705, Localized Routing for Proxy Mobile IPv6
34  * RFC 6757, Access Network Identifier (ANI) Option for Proxy Mobile IPv6
35  * RFC 7148, Prefix Delegation Support for Proxy Mobile IPv6
36  *
37  */
38 
39 #include "config.h"
40 
41 #include <epan/packet.h>
42 #include <epan/to_str.h>
43 
44 #include <epan/ipproto.h>
45 #include <epan/expert.h>
46 #include <epan/ip_opts.h>
47 #include <epan/sminmpec.h>
48 #include <epan/addr_resolv.h>
49 
50 #include <wsutil/str_util.h>
51 
52 #include "packet-ntp.h"
53 #include "packet-gtpv2.h"
54 #include "packet-e164.h"
55 #include "packet-e212.h"
56 #include "packet-gsm_a_common.h"
57 #include "packet-ip.h"
58 
59 void proto_register_mip6(void);
60 void proto_reg_handoff_mip6(void);
61 
62 static dissector_handle_t mip6_handle;
63 
64 #define UDP_PORT_PMIP6_CNTL 5436
65 
66 static dissector_table_t mip6_vsm_dissector_table;
67 
68 /* Mobility Header types */
69 typedef enum {
70     MIP6_BRR    =  0,
71     MIP6_HOTI   =  1,
72     MIP6_MHCOTI =  2,
73     MIP6_HOT    =  3,
74     MIP6_MHCOT  =  4,
75     MIP6_BU     =  5,
76     MIP6_BA     =  6,
77     MIP6_BE     =  7,
78     MIP6_FBU    =  8,
79     MIP6_FBACK  =  9,
80     MIP6_FNA    = 10,
81     MIP6_EMH    = 11,
82     MIP6_HAS    = 12,
83     MIP6_HB     = 13,
84     MIP6_HI     = 14,
85     MIP6_HAck   = 15,
86     MIP6_BR     = 16,
87     MIP6_LRI    = 17,
88     MIP6_LRA    = 18
89 } mhTypes;
90 
91 /* http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml */
92 static const value_string mip6_mh_types[] = {
93     {MIP6_BRR,    "Binding Refresh Request"},           /* [RFC3775] */
94     {MIP6_HOTI,   "Home Test Init"},                    /* [RFC3775] */
95     {MIP6_MHCOTI, "Care-of Test Init"},                 /* [RFC3775] */
96     {MIP6_HOT,    "Home Test"},                         /* [RFC3775] */
97     {MIP6_MHCOT,  "Care-of Test"},                      /* [RFC3775] */
98     {MIP6_BU,     "Binding Update"},                    /* [RFC3775] */
99     {MIP6_BA,     "Binding Acknowledgement"},           /* [RFC3775] */
100     {MIP6_BE,     "Binding Error"},                     /* [RFC3775] */
101     {MIP6_FBU,    "Fast Binding Update"},               /* [RFC5568] */
102     {MIP6_FBACK,  "Fast Binding Acknowledgment"},       /* [RFC5568] */
103     {MIP6_FNA,    "Fast Neighbor Advertisement"},       /* [RFC5568] */
104     {MIP6_EMH,    "Experimental Mobility Header"},      /* [RFC5096] */
105     {MIP6_HAS,    "Home Agent Switch"},                 /* [RFC5142] */
106     {MIP6_HB,     "Heartbeat"},                         /* [RFC5847] */
107     {MIP6_HI,     "Handover Initiate"},                 /* [RFC5568] */
108     {MIP6_HAck,   "Handover Acknowledge"},              /* [RFC5568] */
109     {MIP6_BR,     "Binding Revocation"},                /* [RFC5846] */
110     {MIP6_LRI,    "Localized Routing Initiation"},      /* [RFC6705] */
111     {MIP6_LRA,    "Localized Routing Acknowledgment"},  /* [RFC6705] */
112 
113     {0,      NULL}
114 };
115 static value_string_ext mip6_mh_types_ext = VALUE_STRING_EXT_INIT(mip6_mh_types);
116 
117 /* Mobility Option types
118  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
119  */
120 typedef enum {
121     MIP6_PAD1      =  0,        /*  0 Pad1 [RFC3775] */
122     MIP6_PADN      =  1,        /*  1 PadN [RFC3775] */
123     MIP6_BRA       =  2,        /*  2 Binding Refresh Advice */
124     MIP6_ACOA      =  3,        /*  3 Alternate Care-of Address */
125     MIP6_NI        =  4,        /*  4 Nonce Indices */
126     MIP6_AUTD      =  5,        /*  5 Authorization Data */
127     MIP6_MNP       =  6,        /*  6 Mobile Network Prefix Option */
128     MIP6_MHLLA     =  7,        /*  7 Mobility Header Link-Layer Address option [RFC5568] */
129     MIP6_MNID      =  8,        /*  8 MN-ID-OPTION-TYPE */
130     MIP6_AUTH      =  9,        /*  9 AUTH-OPTION-TYPE */
131     MIP6_MESGID    = 10,        /* 10 MESG-ID-OPTION-TYPE [RFC4285]  */
132     MIP6_CGAPR     = 11,        /* 11 CGA Parameters Request [RFC4866]  */
133     MIP6_CGAR      = 12,        /* 12 CGA Parameters [RFC4866]  */
134     MIP6_SIGN      = 13,        /* 13 Signature [RFC4866]  */
135     MIP6_PHKT      = 14,        /* 14 Permanent Home Keygen Token [RFC4866]  */
136     MIP6_MOCOTI    = 15,        /* 15 Care-of Test Init [RFC4866]  */
137     MIP6_MOCOT     = 16,        /* 16 Care-of Test [RFC4866]  */
138     MIP6_DNSU      = 17,        /* 17 DNS-UPDATE-TYPE [RFC5026]  */
139     MIP6_EM        = 18,        /* 18 Experimental Mobility Option [RFC5096]  */
140     MIP6_VSM       = 19,        /* 19 Vendor Specific Mobility Option [RFC5094]  */
141     MIP6_SSM       = 20,        /* 20 Service Selection Mobility Option [RFC5149]  */
142     MIP6_BADFF     = 21,        /* 21 Binding Authorization Data for FMIPv6 (BADF) [RFC5568]  */
143     MIP6_HNP       = 22,        /* 22 Home Network Prefix Option [RFC5213]   */
144     MIP6_MOHI      = 23,        /* 23 Handoff Indicator Option [RFC5213]   */
145     MIP6_ATT       = 24,        /* 24 Access Technology Type Option [RFC5213]  */
146     MIP6_MNLLI     = 25,        /* 25 Mobile Node Link-layer Identifier Option [RFC5213]  */
147     MIP6_LLA       = 26,        /* 26 Link-local Address Option [RFC5213   */
148     MIP6_TS        = 27,        /* 27 Timestamp */
149     MIP6_RC        = 28,        /* 28 Restart Counter [RFC5847] */
150     MIP6_IPV4HA    = 29,        /* 29 IPv4 Home Address [RFC5555]  */
151     MIP6_IPV4AA    = 30,        /* 30 IPv4 Address Acknowledgement [RFC5555] */
152     MIP6_NATD      = 31,        /* 31 NAT Detection [RFC5555]  */
153     MIP6_IPV4COA   = 32,        /* 32 IPv4 Care-of Address [RFC5555]  */
154     MIP6_GREK      = 33,        /* 33 GRE Key Option [RFC5845]  */
155     MIP6_MHIPV6AP  = 34,        /* 34 Mobility Header IPv6 Address/Prefix [RFC5568]  */
156     MIP6_BI        = 35,        /* 35 Binding Identifier [RFC5648]  */
157     MIP6_IPV4HAREQ = 36,        /* 36 IPv4 Home Address Request [RFC5844] */
158     MIP6_IPV4HAREP = 37,        /* 37 IPv4 Home Address Reply [RFC5844] */
159     MIP6_IPV4DRA   = 38,        /* 38 IPv4 Default-Router Address [RFC5844] */
160     MIP6_IPV4DSM   = 39,        /* 39 IPv4 DHCP Support Mode [RFC5844] */
161     MIP6_CR        = 40,        /* 40 Context Request Option [RFC5949] */
162     MIP6_LMAA      = 41,        /* 41 Local Mobility Anchor Address Option [RFC5949] */
163     MIP6_MNLLAII   = 42,        /* 42 Mobile Node Link-local Address Interface Identifier Option [RFC5949] */
164     MIP6_TB        = 43,        /* 43 Transient Binding [RFC-ietf-mipshop-transient-bce-pmipv6-07] */
165     MIP6_FS        = 44,        /* 44 Flow Summary Mobility Option [RFC-ietf-mext-flow-binding-11] */
166     MIP6_FI        = 45,        /* 45 Flow Identification Mobility Option [RFC-ietf-mext-flow-binding-11]] */
167     MIP6_RECAP     = 46,        /* 46 Redirect-Capability Mobility Option [RFC6463] */
168     MIP6_REDIR     = 47,        /* 47 Redirect Mobility Option [RFC6463] */
169     MIP6_LOAD_INF  = 48,        /* 48 Load Information Mobility Option [RFC6463] */
170     MIP6_ALT_IP4_CO= 49,        /* 49 Alternate IPv4 Care-of Address [RFC6463] */
171     MIP6_MNG       = 50,        /* 50 Mobile Node Group Identifier [RFC6602] */
172     MIP6_MAG_IPv6  = 51,        /* 51 MAG IPv6 Address [RFC6705] */
173     MIP6_ACC_NET_ID= 52,        /* 52 Access Network Identifier [RFC6757] */
174     MIP6_DMNP      = 55         /* 55 Delegated Mobile Network Prefix Option [RFC7148] */
175 
176 } optTypes;
177 
178 /* Mobility Option types
179  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
180  */
181 
182 static const value_string mip6_mobility_options[] = {
183     { MIP6_PAD1,       "Pad1"},                                         /* RFC3775 */
184     { MIP6_PADN,       "PadN"},                                         /* RFC3775 */
185     { MIP6_BRA,        "Binding Refresh Advice"},                       /* RFC3775 */
186     { MIP6_ACOA,       "Alternate Care-of Address"},                    /* RFC3775 */
187     { MIP6_NI,         "Nonce Indices"},                                /* RFC3775 */
188     { MIP6_AUTD,       "Authorization Data"},                           /* RFC3775 */
189     { MIP6_MNP,        "Mobile Network Prefix"},                        /* RFC3963 */
190     { MIP6_MHLLA,      "Mobility Header Link-Layer Address"},           /* RFC5568 */
191     { MIP6_MNID,       "Mobile Node Identifier"},                       /* RFC4283 MN-ID*/
192     { MIP6_AUTH,       "AUTH"},                                         /* RFC4285 */
193     { MIP6_MESGID,     "MESG-ID"},                                      /* RFC4285 */
194     { MIP6_CGAPR,      "CGA Parameters Request"},                       /* RFC4866 */
195     { MIP6_CGAR,       "CGA Parameters"},                               /* RFC4866 */
196     { MIP6_SIGN,       "Signature"},                                    /* RFC4866 */
197     { MIP6_PHKT,       "Permanent Home Keygen Token"},                  /* RFC4866 */
198     { MIP6_MOCOTI,     "Care-of Test Init"},                            /* RFC4866 */
199     { MIP6_MOCOT,      "Care-of Test"},                                 /* RFC4866 */
200     { MIP6_DNSU,       "DNS-UPDATE-TYPE"},                              /* RFC5026 */
201     { MIP6_EM,         "Experimental"},                                 /* RFC5096 */
202     { MIP6_VSM,        "Vendor Specific"},                              /* RFC5094 */
203     { MIP6_SSM,        "Service Selection"},                            /* RFC5149 */
204     { MIP6_BADFF,      "Binding Authorization Data for FMIPv6 (BADF)"}, /* RFC5568 */
205     { MIP6_HNP,        "Home Network Prefix"},                          /* RFC5213 */
206     { MIP6_MOHI,       "Handoff Indicator"},                            /* RFC5213 */
207     { MIP6_ATT,        "Access Technology Type"},                       /* RFC5213 */
208     { MIP6_MNLLI,      "Mobile Node Link-layer Identifier"},            /* RFC5213 */
209     { MIP6_LLA,        "Link-local Address"},                           /* RFC5213 */
210     { MIP6_TS,         "Timestamp"},                                    /* RFC5213 */
211     { MIP6_RC,         "Restart Counter"},                              /* RFC5847 */
212     { MIP6_IPV4HA,     "IPv4 Home Address"},                            /* RFC5555 */
213     { MIP6_IPV4AA,     "IPv4 Address Acknowledgement"},                 /* RFC5555 */
214     { MIP6_NATD,       "NAT Detection"},                                /* RFC5555 */
215     { MIP6_IPV4COA,    "IPv4 Care-of Address"},                         /* RFC5555 */
216     { MIP6_GREK,       "GRE Key"},                                      /* RFC5845 */
217     { MIP6_MHIPV6AP,   "Mobility Header IPv6 Address/Prefix"},          /* RFC5568 */
218     { MIP6_BI,         "Binding Identifier"},                           /* RFC5648 */
219     { MIP6_IPV4HAREQ,  "IPv4 Home Address Request"},                    /* RFC5844 */
220     { MIP6_IPV4HAREP,  "IPv4 Home Address Reply"},                      /* RFC5844 */
221     { MIP6_IPV4DRA,    "IPv4 Default-Router Address"},                  /* RFC5844 */
222     { MIP6_IPV4DSM,    "IPv4 DHCP Support Mode"},                       /* RFC5844 */
223     { MIP6_CR,         "Context Request"},                              /* RFC5949 */
224     { MIP6_LMAA,       "Local Mobility Anchor Address"},                /* RFC5949 */
225     { MIP6_MNLLAII,    "Mobile Node Link-local Address Interface Identifier"}, /* RFC5949 */
226     { MIP6_TB,         "Transient Binding"},                            /* RFC6058 */
227     { MIP6_FS,         "Flow Summary"},                                 /* RFC6089 */
228     { MIP6_FI,         "Flow Identification"},                          /* RFC6089 */
229     { MIP6_RECAP,      "Redirect-Capability"},                          /* RFC6463 */
230     { MIP6_REDIR,      "Redirect"},                                     /* RFC6463 */
231     { MIP6_LOAD_INF,   "Load Information"},                             /* RFC6463 */
232     { MIP6_ALT_IP4_CO, "Alternate IPv4 Care-of Address"},               /* RFC6463 */
233     { MIP6_MNG,        "Mobile Node Group Identifier"},                 /* RFC6602 */
234     { MIP6_MAG_IPv6,   "MAG IPv6 Address"},                             /* RFC6705 */
235     { MIP6_ACC_NET_ID, "Access Network Identifier"},                    /* RFC6757 */
236     { MIP6_DMNP,       "Delegated Mobile Network Prefix"},              /* RFC7148 */
237 
238     { 0, NULL }
239 };
240 static value_string_ext mip6_mobility_options_ext = VALUE_STRING_EXT_INIT(mip6_mobility_options);
241 
242 /*
243  * Status Codes (DNS Update Mobility Option)
244  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-3
245  */
246 
247 static const value_string mip6_dnsu_status_values[] = {
248     { 0, "DNS update performed"},                    /* [RFC5026] */
249     /* 1-127 Unassigned   */
250     { 128, "Reason unspecified"},                    /* [RFC5026] */
251     { 129, "Administratively prohibited"},           /* [RFC5026] */
252     { 130, "DNS Update Failed"},                     /* [RFC5026] */
253     /* 131-255 Unassigned  */
254 
255     {   0, NULL }
256 };
257 
258 static const true_false_string mip6_dnsu_r_flag_value = {
259     "Mobile Node is requesting the HA to remove the DNS entry",
260     "Mobile Node is requesting the HA to create or update a DNS entry"
261 };
262 
263 
264 /* Binding Update flag description */
265 static const true_false_string mip6_bu_a_flag_value = {
266     "Binding Acknowledgement requested",
267     "Binding Acknowledgement not requested"
268 };
269 
270 static const true_false_string mip6_bu_h_flag_value = {
271     "Home Registration",
272     "No Home Registration"
273 };
274 
275 static const true_false_string mip6_bu_l_flag_value = {
276     "Link-Local Address Compatibility",
277     "No Link-Local Address Compatibility"
278 };
279 
280 static const true_false_string mip6_bu_k_flag_value = {
281     "Key Management Mobility Compatibility",
282     "No Key Management Mobility Compatibility"
283 };
284 
285 static const true_false_string mip6_bu_m_flag_value = {
286     "MAP Registration Compatibility",
287     "No MAP Registration Compatibility",
288 };
289 
290 static const true_false_string mip6_nemo_bu_r_flag_value = {
291     "Mobile Router Compatibility",
292     "No Mobile Router Compatibility"
293 };
294 
295 static const true_false_string pmip6_bu_p_flag_value = {
296     "Proxy Registration",
297     "No Proxy Registration"
298 };
299 
300 static const true_false_string mip6_bu_f_flag_value = {
301     "Forcing UDP encapsulation used",
302     "No Forcing UDP encapsulation"
303 };
304 
305 static const true_false_string pmip6_bu_t_flag_value = {
306     "TLV-header format used",
307     "No TLV-header format"
308 };
309 
310 static const true_false_string pmip6_bu_b_flag_value = {
311     "Enable bulk binding update support",
312     "Disable bulk binding update support"
313 };
314 
315 static const true_false_string pmip6_ba_b_flag_value = {
316     "Enabled bulk binding update support",
317     "Disabled bulk binding update support"
318 };
319 
320 /* Binding Acknowledgement status values
321  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xhtml
322  */
323 static const value_string mip6_ba_status_value[] = {
324     {   0, "Binding Update accepted" },
325     {   1, "Accepted but prefix discovery necessary" },
326     {   2, "GRE_KEY_OPTION_NOT_REQUIRED" },                 /* [RFC5845] */
327     {   3, "GRE_TUNNELING_BUT_TLV_HEADER_NOT_SUPPORTED" },  /* [RFC5845] */
328     {   4, "MCOA NOTCOMPLETE" },                            /* [RFC5648] */
329     {   5, "MCOA RETURNHOME WO/NDP" },                      /* [RFC5648] */
330     {   6, "PBU_ACCEPTED_TB_IGNORED_SETTINGSMISMATCH" },    /* [RFC-ietf-mipshop-transient-bce-pmipv6-07] */
331     /* 7-127 Unassigned */
332 
333     { 128, "Reason unspecified" },
334     { 129, "Administratively prohibited" },
335     { 130, "Insufficient resources" },
336     { 131, "Home registration not supported" },
337     { 132, "Not home subnet" },
338     { 133, "Not home agent for this mobile node" },
339     { 134, "Duplicate Address Detection failed" },
340     { 135, "Sequence number out of window" },
341     { 136, "Expired home nonce index" },
342     { 137, "Expired care-of nonce index" },
343     { 138, "Expired nonces" },
344     { 139, "Registration type change disallowed" },
345     { 140, "Mobile Router Operation not permitted" },
346     { 141, "Invalid Prefix" },
347     { 142, "Not Authorized for Prefix" },
348     { 143, "Mobile Network Prefix information unavailable" },
349     { 145, "Proxy Registration not supported by the LMA" },
350     { 146, "Proxy Registrations from this MAG not allowed" },
351     { 147, "No home address for this NAI" },
352     { 148, "Invalid Time Stamp Option" },
353     { 149, "Permanent home keygen token exists" },                  /* [RFC4866] */
354     { 150, "Non-null home nonce index expected" },                  /* [RFC4866] */
355     { 151, "SERVICE_AUTHORIZATION_FAILED" },                        /* [RFC5149] */
356     { 152, "PROXY_REG_NOT_ENABLED" },                               /* [RFC5213] */
357     { 153, "NOT_LMA_FOR_THIS_MOBILE_NODE" },                        /* [RFC5213] */
358     { 154, "MAG_NOT_AUTHORIZED_FOR_PROXY_REG" },                    /* [RFC5213] */
359     { 155, "NOT_AUTHORIZED_FOR_HOME_NETWORK_PREFIX" },              /* [RFC5213] */
360     { 156, "TIMESTAMP_MISMATCH" },                                  /* [RFC5213] */
361     { 157, "TIMESTAMP_LOWER_THAN_PREV_ACCEPTED" },                  /* [RFC5213] */
362     { 158, "MISSING_HOME_NETWORK_PREFIX_OPTION" },                  /* [RFC5213] */
363     { 159, "BCE_PBU_PREFIX_SET_DO_NOT_MATCH" },                     /* [RFC5213] */
364     { 160, "MISSING_MN_IDENTIFIER_OPTION" },                        /* [RFC5213] */
365     { 161, "MISSING_HANDOFF_INDICATOR_OPTION" },                    /* [RFC5213] */
366     { 162, "MISSING_ACCESS_TECH_TYPE_OPTION" },                     /* [RFC5213] */
367     { 163, "GRE_KEY_OPTION_REQUIRED" },                             /* [RFC5845] */
368     { 164, "MCOA MALFORMED" },                                      /* [RFC5648] */
369     { 165, "MCOA NON-MCOA BINDING EXISTS" },                        /* [RFC5648] */
370     { 166, "MCOA PROHIBITED" },                                     /* [RFC5648] */
371     { 167, "MCOA UNKNOWN COA" },                                    /* [RFC5648] */
372     { 168, "MCOA BULK REGISTRATION PROHIBITED" },                   /* [RFC5648] */
373     { 169, "MCOA SIMULTANEOUS HOME AND FOREIGN PROHIBITED" },       /* [RFC5648] */
374     { 170, "NOT_AUTHORIZED_FOR_IPV4_MOBILITY_SERVICE" },            /* [RFC5844] */
375     { 171, "NOT_AUTHORIZED_FOR_IPV4_HOME_ADDRESS" },                /* [RFC5844] */
376     { 172, "NOT_AUTHORIZED_FOR_IPV6_MOBILITY_SERVICE" },            /* [RFC5844] */
377     { 173, "MULTIPLE_IPV4_HOME_ADDRESS_ASSIGNMENT_NOT_SUPPORTED" }, /* [RFC5844] */
378     { 174, "Invalid Care-of Address" },                             /* [RFC6275] */
379     { 175, "INVALID_MOBILE_NODE_GROUP_IDENTIFIER" },                /* [RFC6602] */
380     { 176, "REINIT_SA_WITH_HAC" },                                  /* [RFC6618] */
381     { 177, "NOT_AUTHORIZED_FOR_DELEGATED_MNP" },                    /* [RFC7148] */
382     { 178, "REQUESTED_DMNP_IN_USE" },                               /* [RFC7148] */
383 
384 
385     {   0, NULL }
386 };
387 static value_string_ext mip6_ba_status_value_ext = VALUE_STRING_EXT_INIT(mip6_ba_status_value);
388 
389 /* Binding Error status values */
390 static const value_string mip6_be_status_value[] = {
391     { 1, "Unknown binding for Home Address destination option" },
392     { 2, "Unrecognized MH type value" },
393     { 0, NULL }
394 };
395 
396 /* Fast Binding Update flag description */
397 static const true_false_string fmip6_fbu_a_flag_value = {
398     "Fast Binding Acknowledgement requested",
399     "Fast Binding Acknowledgement not requested"
400 };
401 
402 static const true_false_string fmip6_fbu_h_flag_value = {
403     "Home Registration",
404     "No Home Registration"
405 };
406 
407 static const true_false_string fmip6_fbu_l_flag_value = {
408     "Link-Local Address Compatibility",
409     "No Link-Local Address Compatibility"
410 };
411 
412 static const true_false_string fmip6_fbu_k_flag_value = {
413     "Key Management Mobility Compatibility",
414     "No Key Management Mobility Compatibility"
415 };
416 
417 /* Fast Binding Acknowledgement status values */
418 static const value_string fmip6_fback_status_value[] = {
419     {   0, "Fast Binding Update accepted" },
420     {   1, "Accepted but use supplied NCoA" },
421     { 128, "Reason unspecified" },
422     { 129, "Administratively prohibited" },
423     { 130, "Insufficient resources" },
424     { 131, "Incorrect interface identifier length" },
425     {   0, NULL }
426 };
427 
428 /* Heartbeat flag description */
429 static const true_false_string mip6_hb_u_flag_value = {
430     "Unsolicited Heartbeat Response",
431     "Otherwise"
432 };
433 
434 static const true_false_string mip6_hb_r_flag_value = {
435     "Heartbeat Response",
436     "Heartbeat Request"
437 };
438 
439 /* MH LLA Option code */
440 static const value_string fmip6_lla_optcode_value[] = {
441     {   2, "Link Layer Address of the MN" },
442     {   0, NULL }
443 };
444 
445 /* Mobile Node Identifier Option code */
446 static const value_string mip6_mnid_subtype_value[] = {
447     {   1, "Network Access Identifier (NAI)" },
448     {   0, NULL }
449 };
450 
451 
452 /* Enumerating Algorithms */
453 static const value_string mip6_auth_subtype_value[] = {
454     {   0, "Reserved (not available for assignment)" },
455     {   3, "HMAC_SHA1_SPI" },
456     {   5, "Reserved for use by 3GPP2" },
457     {   0, NULL }
458 };
459 
460 /* mobile network prefix flag description */
461 static const true_false_string mip6_ipv4ha_p_flag_value = {
462     "mobile network prefixt requested",
463     "mobile network prefix not requested"
464 };
465 
466 /* NAT Detection Option F flag values */
467 static const true_false_string mip6_natd_f_flag_value = {
468     "MUST use UDP encapsulation",
469     "Do not use UDP encapsulation"
470 };
471 
472 
473 /* NAT Detection Option F flag values */
474 static const true_false_string mip6_ipv4dsm_s_flag_value = {
475     "DHCP Server",
476     "DHCP Relay"
477 };
478 
479 /* Vendor-Specific Mobility Option */
480 static const value_string mip6_vsm_subtype_value[] = {
481     {   0, NULL }
482 };
483 
484 /* Vendor-Specific Mobility Option (3GPP TS29.282) */
485 static const value_string mip6_vsm_subtype_3gpp_value[] = {
486     {   1, "Protocol Configuration Options" },
487     {   2, "3GPP Specific PMIPv6 Error Code" },
488     {   3, "PMIPv6 PDN GW IP Address" },
489     {   4, "PMIPv6 DHCPv4 Address Allocation Procedure Indication" },
490     {   5, "PMIPv6 Fully Qualified PDN Connection Set Identifier" },
491     {   6, "PMIPv6 PDN type indication" },
492     {   7, "Charging ID" },
493     {   8, "Selection Mode" },
494     {   9, "I-WLAN Mobility Access Point Name (APN)" },
495     {  10, "Charging Characteristics" },
496     {  11, "Mobile Equipment Identity (MEI)" },
497     {  12, "MSISDN" },
498     {  13, "Serving Network" },
499     {  14, "APN Restriction" },
500     {  15, "Maximum APN Restriction" },
501     {  16, "Unauthenticated IMSI" },
502     {  17, "PDN Connection ID" },
503     {  18, "PGW Back-Off Time" },                          /* 3GPP TS 29.275 [7] */
504     {  19, "Signalling Priority Indication" },             /* 3GPP TS 29.275 [7] */
505     {  20, "Additional Protocol Configuration Options" },  /* 3GPP TS 29.275 [7] */
506     {  21, "Static IP Address Allocation Indications" },   /* 3GPP TS 29.275 [7] */
507     {  22, "MME / SGSN Identifier" },                      /* 3GPP TS 29.275 [7] */
508     {  23, "End Marker Notification" },                    /* 3GPP TS 29.275 [7] */
509     {  24, "Trusted WLAN Mode Indication" },               /* 3GPP TS 29.275 [7] */
510     {  25, "UE Time Zone" },                               /* 3GPP TS 29.275 [7] */
511     {  26, "Access Network Identifier Timestamp" },        /* 3GPP TS 29.275 [7] */
512     {  27, "Logical Access ID" },                          /* 3GPP TS 29.275 [7] */
513     {  28, "Origination Time Stamp" },                     /* 3GPP TS 29.275 [7] */
514     {  29, "Maximum Wait Time" },                          /* 3GPP TS 29.275 [7] */
515     {  30, "TWAN Capabilities" },                          /* 3GPP TS 29.275 [7] */
516 
517     {   0, NULL }
518 };
519 static value_string_ext mip6_vsm_subtype_3gpp_value_ext = VALUE_STRING_EXT_INIT(mip6_vsm_subtype_3gpp_value);
520 
521 
522 /* Handoff Indicator Option type
523  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-9
524  */
525 static const value_string pmip6_hi_opttype_value[] = {
526     {   0, "Reserved" },
527     {   1, "Attachment over a new interface" },
528     {   2, "Handoff between two different interfaces of the mobile node" },
529     {   3, "Handoff between mobile access gateways for the same interface" },
530     {   4, "Handoff state unknown" },
531     {   5, "Handoff state not changed (Re-registration)" },
532     {   0, NULL }
533 };
534 
535 /* Access Technology Type Option type
536  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-10
537  */
538 static const value_string pmip6_att_att_value[] = {
539     {   0, "Reserved" },
540     {   1, "Virtual" },
541     {   2, "PPP" },
542     {   3, "IEEE 802.3" },
543     {   4, "IEEE 802.11a/b/g" },
544     {   5, "IEEE 802.16e" },
545     {   6, "3GPP GERAN" },
546     {   7, "3GPP UTRAN" },
547     {   8, "3GPP E-UTRAN" },
548     {   9, "3GPP2 eHRPD" },
549     {  10, "3GPP2 HRPD" },
550     {  11, "3GPP2 1xRTT" },
551     {  12, "3GPP2 UMB" },
552     {   0, NULL }
553 };
554 static value_string_ext pmip6_att_att_value_ext = VALUE_STRING_EXT_INIT(pmip6_att_att_value);
555 
556 /* IPv4 Home Address Reply Status Codes [RFC5844]
557  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#home-address-reply
558  */
559 
560 static const value_string pmip6_ipv4aa_status_values[] = {
561     {   0, "Success" },
562     /* 1-127 Unassigned */
563     {   128, "Virtual" },
564     {   129, "PPP" },
565     {   130, "IEEE 802.3" },
566     {   131, "IEEE 802.11a/b/g" },
567     {   132, "IEEE 802.16e" },
568     /* 133-255 Unassigned  */
569     {   0, NULL }
570 };
571 
572 /* PMIP6 BRI R. Trigger values */
573 static const value_string pmip6_bri_rtrigger[] = {
574     { 0x00,     "Unspecified"},
575     { 0x01,     "Administrative Reason"},
576     { 0x02,     "Inter-MAG Handover - same Access Type"},
577     { 0x03,     "Inter-MAG Handover - different Access Type"},
578     { 0x04,     "Inter-MAG Handover - Unknown"},
579     { 0x05,     "User Initiated Session(s) Termination"},
580     { 0x06,     "Access Network Session(s) Termination"},
581     { 0x07,     "Possible Out-of Sync BCE State"},
582     /* 8-127 Unassigned  */
583     { 0x128,    "Per-Peer Policy"},
584     { 0x129,    "Revoking Mobility Node Local Policy"},
585     /* 130-249 Unassigned  */
586     /* 250-255 Reserved for Testing Purposes Only */
587     { 0,        NULL},
588 };
589 
590 /* PMIP6 BRI Status values */
591 static const value_string pmip6_bri_status[] = {
592     { 0x00,     "Success"},
593     { 0x01,     "Partial Success"},
594     { 0x02,     "Binding Does NOT Exist"},
595     { 0x03,     "IPv4 HoA Binding Does NOT Exist"},
596     { 0x04,     "Global Revocation NOT Authorized"},
597     { 0x05,     "CAN NOT Identify Binding"},
598     { 0x06,     "Revocation Failed, MN is Attached"},
599     { 0,        NULL},
600 };
601 
602 #if 0
603 /* Handoff Indicator values */
604 static const range_string handoff_indicator[] = {
605     { 0x00, 0x00,   "Reserved"                              },
606     { 0x01, 0x01,   "Attachment over a new interface"       },
607     { 0x02, 0x02,   "Handoff between two different interfaces of the mobile node"   },
608     { 0x03, 0x03,   "Handoff between mobile access gateways for the same interface" },
609     { 0x04, 0x04,   "Handoff state unknown"                                         },
610     { 0x05, 0x05,   "Handoff state not changed (Re-registration)"                   },
611     { 0x06, 0xff,   "Unassigned"                                                    },
612     { 0,    0,      NULL                                                            }
613 };
614 #endif
615 
616 /* Mobile Node Group Identifier Type
617  * http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobile-node-group-id-type
618  */
619 
620 static const value_string mip6_mng_id_type_vals[] = {
621     { 0x00,     "Reserved"},
622     { 0x01,     "Bulk Binding Update Group"},
623     { 0,        NULL},
624 };
625 
626 static const value_string pmip6_lra_status_vals[] = {
627     { 0,     "Success"},
628     { 128,   "Localized Routing Not Allowed"},
629     { 129,   "MN Not Attached"},
630     { 0,        NULL},
631 };
632 
633 /* Delegated Mobile Network Prefix V Flag Values */
634 static const true_false_string mip6_dmnp_v_flag_value = {
635     "IPv4 Prefix",
636     "IPv6 Prefix"
637 };
638 
639 /* Message lengths */
640 #define MIP6_BRR_LEN          2
641 #define MIP6_HOTI_LEN        10
642 #define MIP6_COTI_LEN        10
643 #define MIP6_HOT_LEN         18
644 #define MIP6_COT_LEN         18
645 #define MIP6_BU_LEN           6
646 #define MIP6_BA_LEN           6
647 #define MIP6_BE_LEN          18
648 #define FMIP6_FBU_LEN         6
649 #define FMIP6_FBACK_LEN       6
650 #define FMIP6_FNA_LEN         2
651 #define MIP6_EMH_LEN          0
652 #define MIP6_HB_LEN           6
653 #define MIP6_HI_LEN           4
654 #define MIP6_HAck_LEN         4
655 #define MIP6_BR_LEN           6
656 /* PMIP BRI */
657 #define PMIP6_BRI_LEN         6
658 
659 /* Field offsets & lengths for mobility headers */
660 #define MIP6_PROTO_OFF        0
661 #define MIP6_HLEN_OFF         1
662 #define MIP6_TYPE_OFF         2
663 #define MIP6_RES_OFF          3
664 #define MIP6_CSUM_OFF         4
665 #define MIP6_DATA_OFF         6
666 #define MIP6_PROTO_LEN        1
667 #define MIP6_HLEN_LEN         1
668 #define MIP6_TYPE_LEN         1
669 #define MIP6_RES_LEN          1
670 #define MIP6_CSUM_LEN         2
671 
672 #define MIP6_BRR_RES_OFF      6
673 #define MIP6_BRR_OPTS_OFF     8
674 #define MIP6_BRR_RES_LEN      2
675 
676 #define MIP6_HOTI_RES_OFF     6
677 #define MIP6_HOTI_COOKIE_OFF  8
678 #define MIP6_HOTI_OPTS_OFF   16
679 #define MIP6_HOTI_RES_LEN     2
680 #define MIP6_HOTI_COOKIE_LEN  8
681 
682 #define MIP6_COTI_RES_OFF     6
683 #define MIP6_COTI_COOKIE_OFF  8
684 #define MIP6_COTI_OPTS_OFF   16
685 #define MIP6_COTI_RES_LEN     2
686 #define MIP6_COTI_COOKIE_LEN  8
687 
688 #define MIP6_HOT_INDEX_OFF    6
689 #define MIP6_HOT_COOKIE_OFF   8
690 #define MIP6_HOT_TOKEN_OFF   16
691 #define MIP6_HOT_OPTS_OFF    24
692 #define MIP6_HOT_INDEX_LEN    2
693 #define MIP6_HOT_COOKIE_LEN   8
694 #define MIP6_HOT_TOKEN_LEN    8
695 
696 #define MIP6_COT_INDEX_OFF    6
697 #define MIP6_COT_COOKIE_OFF   8
698 #define MIP6_COT_TOKEN_OFF   16
699 #define MIP6_COT_OPTS_OFF    24
700 #define MIP6_COT_INDEX_LEN    2
701 #define MIP6_COT_COOKIE_LEN   8
702 #define MIP6_COT_TOKEN_LEN    8
703 
704 #define MIP6_BU_SEQNR_OFF     6
705 #define MIP6_BU_FLAGS_OFF     8
706 #define MIP6_BU_RES_OFF       9
707 #define MIP6_BU_LIFETIME_OFF 10
708 #define MIP6_BU_OPTS_OFF     12
709 #define MIP6_BU_SEQNR_LEN     2
710 #define MIP6_BU_FLAGS_LEN     2
711 #define MIP6_BU_RES_LEN       0
712 #define MIP6_BU_LIFETIME_LEN  2
713 
714 #define MIP6_BA_STATUS_OFF    6
715 #define MIP6_BA_FLAGS_OFF     7
716 #define MIP6_BA_SEQNR_OFF     8
717 #define MIP6_BA_LIFETIME_OFF 10
718 #define MIP6_BA_OPTS_OFF     12
719 #define MIP6_BA_STATUS_LEN    1
720 #define MIP6_BA_FLAGS_LEN     1
721 #define MIP6_BA_SEQNR_LEN     2
722 #define MIP6_BA_LIFETIME_LEN  2
723 
724 #define MIP6_BE_STATUS_OFF    6
725 #define MIP6_BE_RES_OFF       7
726 #define MIP6_BE_HOA_OFF       8
727 #define MIP6_BE_OPTS_OFF     24
728 #define MIP6_BE_STATUS_LEN    1
729 #define MIP6_BE_RES_LEN       1
730 #define MIP6_BE_HOA_LEN      16
731 
732 #define FMIP6_FBU_SEQNR_OFF     6
733 #define FMIP6_FBU_FLAGS_OFF     8
734 #define FMIP6_FBU_RES_OFF       9
735 #define FMIP6_FBU_LIFETIME_OFF 10
736 #define FMIP6_FBU_OPTS_OFF     12
737 #define FMIP6_FBU_SEQNR_LEN     2
738 #define FMIP6_FBU_FLAGS_LEN     1
739 #define FMIP6_FBU_RES_LEN       1
740 #define FMIP6_FBU_LIFETIME_LEN  2
741 
742 #define FMIP6_FBACK_STATUS_OFF    6
743 #define FMIP6_FBACK_FLAGS_OFF     7
744 #define FMIP6_FBACK_SEQNR_OFF     8
745 #define FMIP6_FBACK_LIFETIME_OFF 10
746 #define FMIP6_FBACK_OPTS_OFF     12
747 #define FMIP6_FBACK_STATUS_LEN    1
748 #define FMIP6_FBACK_FLAGS_LEN     1
749 #define FMIP6_FBACK_SEQNR_LEN     2
750 #define FMIP6_FBACK_LIFETIME_LEN  2
751 
752 #define FMIP6_FNA_RES_OFF     6
753 #define FMIP6_FNA_OPTS_OFF    8
754 #define FMIP6_FNA_RES_LEN     2
755 
756 #define MIP6_HB_RES_OFF       6
757 #define MIP6_HB_FLAGS_OFF     7
758 #define MIP6_HB_SEQNR_OFF     8
759 #define MIP6_HB_OPTS_OFF     12
760 #define MIP6_HB_RES_LEN       1
761 #define MIP6_HB_FLAGS_LEN     1
762 #define MIP6_HB_SEQNR_LEN     4
763 
764 #define MIP6_HI_SEQNR_OFF     6
765 #define MIP6_HI_FLAGS_OFF     8
766 #define MIP6_HI_CODE_OFF      9
767 #define MIP6_HI_OPTS_OFF     10
768 #define MIP6_HI_SEQNR_LEN     2
769 #define MIP6_HI_FLAGS_LEN     1
770 #define MIP6_HI_CODE_LEN      1
771 
772 #define MIP6_HAck_SEQNR_OFF   6
773 #define MIP6_HAck_RES_OFF     8
774 #define MIP6_HAck_CODE_OFF    9
775 #define MIP6_HAck_OPTS_OFF   10
776 #define MIP6_HAck_SEQNR_LEN   2
777 #define MIP6_HAck_RES_LEN     1
778 #define MIP6_HAck_CODE_LEN    1
779 
780 #define MIP6_BR_TYPE_OFF      6
781 #define MIP6_BR_TRGR_OFF      7
782 #define MIP6_BR_SEQNR_OFF     8
783 #define MIP6_BR_FLAGS_OFF    10
784 #define MIP6_BR_RES_OFF      11
785 #define MIP6_BR_OPTS_OFF     12
786 #define MIP6_BR_TYPE_LEN      1
787 #define MIP6_BR_TRGR_LEN      1
788 #define MIP6_BR_SEQNR_LEN     2
789 #define MIP6_BR_FLAGS_LEN     1
790 #define MIP6_BR_RES_LEN       1
791 
792 /* PMIP BRI */
793 #define PMIP6_BRI_BRTYPE_OFF     6
794 #define PMIP6_BRI_RTRIGGER_OFF   7
795 #define PMIP6_BRI_STATUS_OFF     7
796 #define PMIP6_BRI_SEQNR_OFF      8
797 #define PMIP6_BRI_FLAGS_OFF     10
798 #define PMIP6_BRI_RES_OFF       11
799 #define PMIP6_BRI_BRTYPE_LEN     1
800 #define PMIP6_BRI_RTRIGGER_LEN   1
801 #define PMIP6_BRI_STATUS_LEN     1
802 #define PMIP6_BRI_SEQNR_LEN      2
803 #define PMIP6_BRI_FLAGS_LEN      2
804 
805 /* Field offsets & field and option lengths for mobility options.
806  * The option length does *not* include the option type and length
807  * fields.  The field offsets, however, do include the type and
808  * length fields. */
809 #define MIP6_BRA_LEN          2
810 #define MIP6_BRA_RI_LEN       2
811 
812 #define MIP6_ACOA_LEN        16
813 #define MIP6_ACOA_ACOA_LEN   16
814 
815 #define MIP6_NEMO_MNP_LEN         18
816 #define MIP6_NEMO_MNP_MNP_LEN     16
817 
818 #define MIP6_NI_LEN           4
819 #define MIP6_NI_HNI_LEN       2
820 #define MIP6_NI_CNI_LEN       2
821 
822 #define FMIP6_LLA_MINLEN      1
823 #define FMIP6_LLA_OPTCODE_LEN 1
824 
825 #define MIP6_MNID_MINLEN      2
826 #define MIP6_MNID_SUBTYPE_LEN 1
827 
828 #define MIP6_AUTH_MINLEN      6
829 #define MIP6_CGAPR_MINLEN     0
830 #define MIP6_CGAR_MINLEN      1
831 #define MIP6_SIGN_MINLEN      1
832 #define MIP6_PHKT_MINLEN      1
833 #define MIP6_MOCOTI_MINLEN    0
834 #define MIP6_MOCOT_MINLEN     8
835 #define MIP6_DNSU_MINLEN      5
836 #define MIP6_EM_MINLEN        1
837 #define MIP6_MESG_ID_LEN      8
838 
839 #define MIP6_VSM_MINLEN       2
840 #define MIP6_VSM_VID_LEN      4
841 #define MIP6_VSM_SUBTYPE_LEN  1
842 
843 #define MIP6_SSM_MINLEN       1
844 
845 #define MIP6_BADFF_MINLEN     4
846 
847 #define PMIP6_HI_LEN          2
848 #define PMIP6_HI_HI_LEN       1
849 
850 #define PMIP6_ATT_LEN         2
851 #define PMIP6_ATT_ATT_LEN     1
852 
853 #define PMIP6_MNLLI_MIN_LEN   1
854 
855 #define PMIP6_LLA_LEN         16
856 
857 #define PMIP6_TS_LEN          8
858 
859 #define PMIP6_RC_LEN          4
860 #define PMIP6_RC_RC_LEN       4
861 
862 #define MIP6_IPV4HA_LEN         6
863 #define MIP6_IPV4HA_PREFIXL_LEN 1
864 #define MIP6_IPV4HA_HA_LEN      4
865 
866 #define MIP6_IPV4AA_LEN         6
867 #define MIP6_IPV4AA_STATUS_LEN  1
868 #define MIP6_IPV4AA_PREFIXL_LEN 1
869 #define MIP6_IPV4AA_HA_LEN      4
870 
871 #define MIP6_NATD_LEN              6
872 
873 #define MIP6_IPV4COA_LEN           6
874 
875 #define PMIP6_GREK_MIN_LEN         2
876 #define PMIP6_GREK_ID_LEN          4
877 
878 #define MIP6_MHIPV6AP_LEN      18
879 
880 #define MIP6_BI_MIN_LEN            4
881 
882 #define MIP6_IPV4HAREQ_LEN         6
883 #define MIP6_IPV4HAREQ_PREFIXL_LEN 1
884 #define MIP6_IPV4HAREQ_HA_LEN      4
885 
886 #define MIP6_IPV4HAREP_LEN         6
887 #define MIP6_IPV4HAREP_STATUS_LEN  1
888 #define MIP6_IPV4HAREP_PREFIXL_LEN 1
889 #define MIP6_IPV4HAREP_HA_LEN      4
890 
891 #define MIP6_IPV4DRA_LEN      6
892 #define MIP6_IPV4DRA_RES_LEN  2
893 #define MIP6_IPV4DRA_DRA_LEN  4
894 
895 #define MIP6_IPV4DSM_LEN      2
896 
897 #define MIP6_CR_MIN_LEN       4
898 
899 #define MIP6_LMAA_MIN_LEN     6
900 
901 #define MIP6_RECAP_LEN        2
902 #define MIP6_REDIR_MIN_LEN    6
903 #define MIP6_REDIR_FLAG_K     0x8000
904 #define MIP6_REDIR_FLAG_N     0x4000
905 #define MIP6_REDIR_FLAG_RSV   0x3FFF
906 
907 #define MIP6_LOAD_INF_LEN     18
908 #define MIP6_ALT_IP4_LEN      4
909 
910 #define MIP6_MNG_LEN          6
911 
912 #define MIP6_MAG_IPv6_LEN    16
913 
914 #define MIP6_ACC_NET_ID_MIN_LEN    3
915 
916 #define MIP6_DMNP_MIN_LEN     6
917 
918 static dissector_table_t ip_dissector_table;
919 
920 /* Initialize the protocol and registered header fields */
921 static int proto_mip6 = -1;
922 static int proto_nemo = -1;
923 static int proto_mip6_option_pad1 = -1;
924 static int proto_mip6_option_padn = -1;
925 static int proto_mip6_option_bra = -1;
926 static int proto_mip6_option_acoa = -1;
927 static int proto_mip6_option_ni = -1;
928 static int proto_mip6_option_bad_auth = -1;
929 static int proto_mip6_option_mnp = -1;
930 static int proto_mip6_option_mhlla = -1;
931 static int proto_mip6_option_mnid = -1;
932 static int proto_mip6_option_auth = -1;
933 static int proto_mip6_option_mseg_id = -1;
934 static int proto_mip6_option_cgapr = -1;
935 static int proto_mip6_option_cgar = -1;
936 static int proto_mip6_option_sign = -1;
937 static int proto_mip6_option_phkt = -1;
938 static int proto_mip6_option_coti = -1;
939 static int proto_mip6_option_cot = -1;
940 static int proto_mip6_option_dnsu = -1;
941 static int proto_mip6_option_em = -1;
942 static int proto_mip6_option_vsm = -1;
943 static int proto_mip6_option_ssm = -1;
944 static int proto_mip6_option_badff = -1;
945 static int proto_mip6_option_hnp = -1;
946 static int proto_mip6_option_hi = -1;
947 static int proto_mip6_option_att = -1;
948 static int proto_mip6_option_mnlli = -1;
949 static int proto_mip6_option_lla = -1;
950 static int proto_mip6_option_ts = -1;
951 static int proto_mip6_option_rc = -1;
952 static int proto_mip6_option_ipv4ha = -1;
953 static int proto_mip6_option_ipv4aa = -1;
954 static int proto_mip6_option_natd = -1;
955 static int proto_mip6_option_ipv4coa = -1;
956 static int proto_mip6_option_grek = -1;
957 static int proto_mip6_option_mhipv6ap = -1;
958 static int proto_mip6_option_bi = -1;
959 static int proto_mip6_option_ipv4hareq = -1;
960 static int proto_mip6_option_ipv4harep = -1;
961 static int proto_mip6_option_ipv4dra = -1;
962 static int proto_mip6_option_ipv4dsm = -1;
963 static int proto_mip6_option_cr = -1;
964 static int proto_mip6_option_lmaa = -1;
965 static int proto_mip6_option_recap = -1;
966 static int proto_mip6_option_redir = -1;
967 static int proto_mip6_option_load_inf = -1;
968 static int proto_mip6_option_alt_ip4 = -1;
969 static int proto_mip6_option_mng = -1;
970 static int proto_mip6_option_mag_ipv6 = -1;
971 static int proto_mip6_option_acc_net_id = -1;
972 static int proto_mip6_option_dmnp = -1;
973 
974 static int hf_mip6_proto = -1;
975 static int hf_mip6_hlen = -1;
976 static int hf_mip6_mhtype = -1;
977 static int hf_mip6_reserved = -1;
978 static int hf_mip6_csum = -1;
979 
980 static int hf_mip6_hoti_cookie = -1;
981 
982 static int hf_mip6_coti_cookie = -1;
983 
984 static int hf_mip6_hot_nindex = -1;
985 static int hf_mip6_hot_cookie = -1;
986 static int hf_mip6_hot_token = -1;
987 
988 static int hf_mip6_cot_nindex = -1;
989 static int hf_mip6_cot_cookie = -1;
990 /* static int hf_mip6_cot_token = -1; */
991 
992 static int hf_mip6_bu_seqnr = -1;
993 static int hf_mip6_bu_a_flag = -1;
994 static int hf_mip6_bu_h_flag = -1;
995 static int hf_mip6_bu_l_flag = -1;
996 static int hf_mip6_bu_k_flag = -1;
997 static int hf_mip6_bu_m_flag = -1;
998 static int hf_mip6_nemo_bu_r_flag = -1;
999 static int hf_pmip6_bu_p_flag = -1;
1000 static int hf_mip6_bu_f_flag = -1;
1001 static int hf_pmip6_bu_t_flag = -1;
1002 static int hf_pmip6_bu_b_flag = -1;
1003 static int hf_mip6_bu_lifetime = -1;
1004 
1005 static int hf_mip6_ba_status = -1;
1006 static int hf_mip6_ba_k_flag = -1;
1007 static int hf_mip6_nemo_ba_r_flag = -1;
1008 static int hf_pmip6_ba_p_flag = -1;
1009 static int hf_pmip6_ba_t_flag = -1;
1010 static int hf_pmip6_ba_b_flag = -1;
1011 static int hf_mip6_ba_seqnr = -1;
1012 static int hf_mip6_ba_lifetime = -1;
1013 
1014 static int hf_mip6_be_status = -1;
1015 static int hf_mip6_be_haddr = -1;
1016 
1017 static int hf_fmip6_fbu_seqnr = -1;
1018 static int hf_fmip6_fbu_a_flag = -1;
1019 static int hf_fmip6_fbu_h_flag = -1;
1020 static int hf_fmip6_fbu_l_flag = -1;
1021 static int hf_fmip6_fbu_k_flag = -1;
1022 static int hf_fmip6_fbu_lifetime = -1;
1023 
1024 static int hf_fmip6_fback_status = -1;
1025 static int hf_fmip6_fback_k_flag = -1;
1026 static int hf_fmip6_fback_seqnr = -1;
1027 static int hf_fmip6_fback_lifetime = -1;
1028 
1029 static int hf_mip6_has_num_addrs = -1;
1030 static int hf_mip6_has_reserved = -1;
1031 static int hf_mip6_has_address = -1;
1032 
1033 static int hf_mip6_hb_u_flag = -1;
1034 static int hf_mip6_hb_r_flag = -1;
1035 static int hf_mip6_hb_seqnr = -1;
1036 
1037 static int hf_mip6_hi_seqnr = -1;
1038 static int hf_mip6_hi_s_flag = -1;
1039 static int hf_mip6_hi_u_flag = -1;
1040 static int hf_mip6_hi_code = -1;
1041 
1042 static int hf_mip6_hack_seqnr = -1;
1043 static int hf_mip6_hack_code = -1;
1044 
1045 static int hf_mip6_opt_3gpp_reserved = -1;
1046 static int hf_mip6_opt_3gpp_flag_m = -1;
1047 static int hf_mip6_opt_3gpp_spec_pmipv6_err_code = -1;
1048 static int hf_mip6_opt_3gpp_pdn_gw_ipv4_addr = -1;
1049 static int hf_mip6_opt_3gpp_pdn_gw_ipv6_addr = -1;
1050 static int hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind = -1;
1051 static int hf_mip6_opt_3gpp_pdn_type = -1;
1052 static int hf_mip6_opt_3gpp_pdn_ind_cause = -1;
1053 static int hf_mip6_opt_3gpp_chg_id = -1;
1054 static int hf_mip6_opt_3gpp_charging_characteristic = -1;
1055 static int hf_mip6_opt_3gpp_mei = -1;
1056 static int hf_mip6_opt_3gpp_msisdn = -1;
1057 static int hf_mip6_opt_3gpp_apn_rest = -1;
1058 static int hf_mip6_opt_3gpp_max_apn_rest = -1;
1059 static int hf_mip6_opt_3gpp_imsi = -1;
1060 static int hf_mip6_opt_3gpp_pdn_conn_id = -1;
1061 static int hf_hf_mip6_opt_3gpp_lapi = -1;
1062 
1063 static int hf_mip6_bra_interval = -1;
1064 
1065 static int hf_mip6_acoa_acoa = -1;
1066 static int hf_mip6_nemo_mnp_mnp = -1;
1067 static int hf_mip6_nemo_mnp_pfl = -1;
1068 
1069 static int hf_mip6_ni_hni = -1;
1070 static int hf_mip6_ni_cni = -1;
1071 
1072 static int hf_mip6_bad_auth = -1;
1073 
1074 static int hf_fmip6_lla = -1;
1075 static int hf_fmip6_lla_optcode = -1;
1076 
1077 static int hf_mip6_mnid_subtype = -1;
1078 static int hf_mip6_mnid_identifier = -1;
1079 static int hf_mip6_vsm_vid = -1;
1080 static int hf_mip6_vsm_subtype = -1;
1081 static int hf_mip6_vsm_subtype_3gpp = -1;
1082 
1083 static int hf_mip6_opt_ss_identifier = -1;
1084 
1085 static int hf_mip6_opt_badff_spi = -1;
1086 static int hf_mip6_opt_badff_auth = -1;
1087 
1088 static int hf_mip6_opt_auth_sub_type = -1;
1089 static int hf_mip6_opt_auth_mobility_spi = -1;
1090 static int hf_mip6_opt_auth_auth_data = -1;
1091 static int hf_mip6_opt_mseg_id_timestamp = -1;
1092 
1093 static int hf_mip6_opt_cgar_cga_par = -1;
1094 static int hf_mip6_opt_sign_sign = -1;
1095 static int hf_mip6_opt_phkt_phkt = -1;
1096 static int hf_mip6_opt_mocot_co_keygen_tok = -1;
1097 
1098 static int hf_mip6_opt_dnsu_status = -1;
1099 static int hf_mip6_opt_dnsu_flag_r = -1;
1100 static int hf_mip6_opt_dnsu_mn_id = -1;
1101 
1102 static int hf_mip6_opt_em_data = -1;
1103 
1104 static int hf_pmip6_hi_hi = -1;
1105 static int hf_pmip6_hi_reserved = -1;
1106 
1107 static int hf_pmip6_att_reserved = -1;
1108 static int hf_pmip6_att_att = -1;
1109 
1110 static int hf_mip6_opt_mnlli_reserved = -1;
1111 static int hf_mip6_opt_mnlli_lli = -1;
1112 
1113 static int hf_pmip6_timestamp = -1;
1114 static int hf_pmip6_rc = -1;
1115 static int hf_mip6_ipv4ha_preflen = -1;
1116 static int hf_mip6_ipv4ha_p_flag = -1;
1117 static int hf_mip6_ipv4ha_ha = -1;
1118 static int hf_mip6_ipv4ha_reserved = -1;
1119 static int hf_mip6_ipv4aa_status = -1;
1120 
1121 static int hf_mip6_opt_natd_f_flag = -1;
1122 static int hf_mip6_opt_natd_reserved = -1;
1123 static int hf_mip6_opt_natd_refresh_t = -1;
1124 
1125 static int hf_mip6_opt_ipv4coa_reserved = -1;
1126 static int hf_mip6_opt_ipv4coa_addr = -1;
1127 
1128 static int hf_pmip6_gre_key = -1;
1129 static int hf_mip6_opt_mhipv6ap_opt_code = -1;
1130 static int hf_mip6_opt_mhipv6ap_prefix_l = -1;
1131 static int hf_mip6_opt_mhipv6ap_ipv6_address = -1;
1132 static int hf_mip6_opt_mhipv6ap_ipv6_address_prefix = -1;
1133 static int hf_mip6_ipv4dra_reserved = -1;
1134 static int hf_mip6_ipv4dra_dra = -1;
1135 
1136 static int hf_mip6_ipv4dsm_reserved = -1;
1137 static int hf_mip6_ipv4dsm_s_flag = -1;
1138 static int hf_mip6_cr_reserved = -1;
1139 static int hf_mip6_cr_req_type = -1;
1140 static int hf_mip6_cr_req_length = -1;
1141 
1142 static int hf_mip6_lmaa_opt_code = -1;
1143 static int hf_mip6_lmaa_reserved = -1;
1144 static int hf_mip6_lmaa_ipv4 = -1;
1145 static int hf_mip6_lmaa_ipv6 = -1;
1146 
1147 static int hf_mip6_mobility_opt = -1;
1148 static int hf_mip6_opt_len = -1;
1149 
1150 static int hf_mip6_opt_bi_bid = -1;
1151 static int hf_mip6_opt_bi_status = -1;
1152 static int hf_mip6_bi_h_flag = -1;
1153 static int hf_mip6_bi_coa_ipv4 = -1;
1154 static int hf_mip6_bi_coa_ipv6 = -1;
1155 
1156 static int hf_mip6_binding_refresh_request = -1;
1157 static int hf_mip6_unknown_type_data = -1;
1158 static int hf_mip6_fast_neighbor_advertisement = -1;
1159 static int hf_mip6_vsm_data = -1;
1160 static int hf_mip6_vsm_req_data = -1;
1161 static int hf_mip6_opt_padn = -1;
1162 
1163 /* PMIP BRI */
1164 static int hf_pmip6_bri_brtype = -1;
1165 static int hf_pmip6_bri_rtrigger = -1;
1166 static int hf_pmip6_bri_status = -1;
1167 static int hf_pmip6_bri_seqnr = -1;
1168 static int hf_pmip6_bri_ip_flag = -1;
1169 static int hf_pmip6_bri_ap_flag = -1;
1170 static int hf_pmip6_bri_iv_flag = -1;
1171 static int hf_pmip6_bri_av_flag = -1;
1172 static int hf_pmip6_bri_ig_flag = -1;
1173 static int hf_pmip6_bri_ag_flag = -1;
1174 static int hf_pmip6_bri_res = -1;
1175 
1176 static int hf_pmip6_lri_sequence = -1;
1177 static int hf_pmip6_lri_reserved = -1;
1178 static int hf_pmip6_lri_lifetime = -1;
1179 
1180 static int hf_pmip6_lra_sequence = -1;
1181 static int hf_pmip6_lra_u = -1;
1182 static int hf_pmip6_lra_reserved = -1;
1183 static int hf_pmip6_lra_status = -1;
1184 static int hf_pmip6_lra_lifetime = -1;
1185 
1186 static int hf_mip6_opt_recap_reserved = -1;
1187 static int hf_mip6_opt_redir_k = -1;
1188 static int hf_mip6_opt_redir_n = -1;
1189 static int hf_mip6_opt_redir_reserved = -1;
1190 static int hf_mip6_opt_redir_addr_r2LMA_ipv6 = -1;
1191 static int hf_mip6_opt_redir_addr_r2LMA_ipv4 = -1;
1192 static int hf_mip6_opt_load_inf_priority = -1;
1193 static int hf_mip6_opt_load_inf_sessions_in_use = -1;
1194 static int hf_mip6_opt_load_inf_maximum_sessions = -1;
1195 static int hf_mip6_opt_load_inf_used_capacity = -1;
1196 static int hf_mip6_opt_load_inf_maximum_capacity = -1;
1197 static int hf_mip6_opt_alt_ip4 = -1;
1198 
1199 /* Mobile Node Group Identifier Optionm */
1200 static int hf_mip6_opt_mng_sub_type = -1;
1201 static int hf_mip6_opt_mng_reserved = -1;
1202 static int hf_mip6_opt_mng_mng_id = -1;
1203 
1204 static int hf_mip6_opt_mag_ipv6_reserved = -1;
1205 static int hf_mip6_opt_mag_ipv6_address_length = -1;
1206 static int hf_mip6_opt_mag_ipv6_address = -1;
1207 
1208 static int hf_mip6_opt_acc_net_id_sub = -1;
1209 static int hf_mip6_opt_acc_net_id_sub_opt = -1;
1210 static int hf_mip6_opt_acc_net_id_sub_opt_len = -1;
1211 static int hf_mip6_opt_acc_net_id_sub_opt_e_bit = -1;
1212 static int hf_mip6_opt_acc_net_id_sub_opt_net_name_len = -1;
1213 static int hf_mip6_opt_acc_net_id_sub_opt_net_name = -1;
1214 static int hf_mip6_opt_acc_net_id_sub_opt_net_name_data = -1;
1215 static int hf_mip6_opt_acc_net_id_sub_opt_ap_name_len = -1;
1216 static int hf_mip6_opt_acc_net_id_sub_opt_ap_name = -1;
1217 static int hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees = -1;
1218 static int hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees = -1;
1219 static int hf_mip6_opt_acc_net_id_sub_opt_op_id_type = -1;
1220 static int hf_mip6_opt_acc_net_id_sub_opt_op_id = -1;
1221 
1222 static int hf_pmip6_opt_lila_lla = -1;
1223 
1224 /* Delegated Mobile Network Prefix Option */
1225 static int hf_mip6_opt_dmnp_v_flag = -1;
1226 static int hf_mip6_opt_dmnp_reserved = -1;
1227 static int hf_mip6_opt_dmnp_prefix_len = -1;
1228 static int hf_mip6_opt_dmnp_dmnp_ipv4 = -1;
1229 static int hf_mip6_opt_dmnp_dmnp_ipv6 = -1;
1230 
1231 /* Initialize the subtree pointers */
1232 static gint ett_mip6 = -1;
1233 static gint ett_mip6_opt_pad1 = -1;
1234 static gint ett_mip6_opt_padn = -1;
1235 static gint ett_mip6_opts = -1;
1236 static gint ett_mip6_opt_bra = -1;
1237 static gint ett_mip6_opt_acoa = -1;
1238 static gint ett_mip6_opt_ni = -1;
1239 static gint ett_mip6_opt_bad = -1;
1240 static gint ett_mip6_nemo_opt_mnp = -1;
1241 static gint ett_fmip6_opt_lla = -1;
1242 static gint ett_mip6_opt_mnid = -1;
1243 static gint ett_mip6_opt_auth = -1;
1244 static gint ett_mip6_opt_mesgid = -1;
1245 static gint ett_mip6_opt_cgapr = -1;
1246 static gint ett_mip6_opt_cgar = -1;
1247 static gint ett_mip6_opt_sign = -1;
1248 static gint ett_mip6_opt_phkt = -1;
1249 static gint ett_mip6_opt_mocoti = -1;
1250 static gint ett_mip6_opt_mocot = -1;
1251 static gint ett_mip6_opt_dnsu = -1;
1252 static gint ett_mip6_opt_em = -1;
1253 static gint ett_mip6_opt_vsm = -1;
1254 static gint ett_mip6_opt_ssm = -1;
1255 static gint ett_mip6_opt_badff = -1;
1256 static gint ett_mip6_opt_unknown = -1;
1257 static gint ett_pmip6_opt_hnp = -1;
1258 static gint ett_pmip6_opt_hi = -1;
1259 static gint ett_pmip6_opt_att = -1;
1260 static gint ett_pmip6_opt_mnlli = -1;
1261 static gint ett_pmip6_opt_lla = -1;
1262 static gint ett_pmip6_opt_ts = -1;
1263 static gint ett_pmip6_opt_rc = -1;
1264 static gint ett_mip6_opt_ipv4ha = -1;
1265 static gint ett_mip6_opt_ipv4aa = -1;
1266 static gint ett_mip6_opt_natd = -1;
1267 static gint ett_mip6_opt_ipv4coa = -1;
1268 static gint ett_pmip6_opt_grek = -1;
1269 static gint ett_pmip6_opt_mhipv6ap = -1;
1270 static gint ett_pmip6_opt_bi = -1;
1271 static gint ett_mip6_opt_ipv4hareq = -1;
1272 static gint ett_mip6_opt_ipv4harep = -1;
1273 static gint ett_mip6_opt_ipv4dra = -1;
1274 static gint ett_mip6_opt_ipv4dsm = -1;
1275 static gint ett_mip6_opt_cr = -1;
1276 static gint ett_mip6_opt_lmaa = -1;
1277 static gint ett_mip6_opt_recap = -1;
1278 static gint ett_mip6_opt_redir = -1;
1279 static gint ett_mip6_opt_load_inf = -1;
1280 static gint ett_mip6_opt_alt_ip4 = -1;
1281 static gint ett_mip6_opt_mng = -1;
1282 static gint ett_mip6_opt_mag_ipv6 = -1;
1283 static gint ett_mip6_opt_acc_net_id = -1;
1284 static gint ett_mip6_sub_opt_acc_net_id = -1;
1285 static gint ett_mip6_opt_dmnp = -1;
1286 
1287 static expert_field ei_mip6_ie_not_dissected = EI_INIT;
1288 static expert_field ei_mip6_ani_type_not_dissected = EI_INIT;
1289 static expert_field ei_mip6_opt_len_invalid = EI_INIT;
1290 static expert_field ei_mip6_vsm_data_not_dissected = EI_INIT;
1291 static expert_field ei_mip6_bogus_header_length = EI_INIT;
1292 
1293 static dissector_table_t mip6_option_table;
1294 
1295 /* Functions to dissect the mobility headers */
1296 static int
dissect_mip6_brr(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1297 dissect_mip6_brr(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1298 {
1299     proto_tree_add_item(mip6_tree, hf_mip6_binding_refresh_request, tvb, MIP6_DATA_OFF, MIP6_BRR_LEN, ENC_NA);
1300 
1301     return MIP6_DATA_OFF + MIP6_BRR_LEN;
1302 }
1303 
1304 static int
dissect_mip6_hoti(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1305 dissect_mip6_hoti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1306 {
1307     if (mip6_tree) {
1308         proto_tree *data_tree;
1309 
1310         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1311                 MIP6_HOTI_LEN, ett_mip6, NULL, "Home Test Init");
1312 
1313         proto_tree_add_item(data_tree, hf_mip6_hoti_cookie, tvb,
1314                 MIP6_HOTI_COOKIE_OFF, MIP6_HOTI_COOKIE_LEN, ENC_BIG_ENDIAN);
1315     }
1316 
1317     return MIP6_DATA_OFF + MIP6_HOTI_LEN;
1318 }
1319 
1320 static int
dissect_mip6_coti(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1321 dissect_mip6_coti(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1322 {
1323     if (mip6_tree) {
1324         proto_tree *data_tree;
1325 
1326         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1327                 MIP6_COTI_LEN, ett_mip6, NULL, "Care-of Test Init");
1328 
1329         proto_tree_add_item(data_tree, hf_mip6_coti_cookie, tvb,
1330                 MIP6_COTI_COOKIE_OFF, MIP6_COTI_COOKIE_LEN, ENC_BIG_ENDIAN);
1331     }
1332 
1333     return MIP6_DATA_OFF + MIP6_COTI_LEN;
1334 }
1335 
1336 static int
dissect_mip6_hot(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1337 dissect_mip6_hot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1338 {
1339     if (mip6_tree) {
1340         proto_tree *data_tree;
1341 
1342         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1343                 MIP6_HOT_LEN, ett_mip6, NULL, "Home Test");
1344 
1345         proto_tree_add_item(data_tree, hf_mip6_hot_nindex, tvb,
1346                 MIP6_HOT_INDEX_OFF, MIP6_HOT_INDEX_LEN, ENC_BIG_ENDIAN);
1347         proto_tree_add_item(data_tree, hf_mip6_hot_cookie, tvb,
1348                 MIP6_HOT_COOKIE_OFF, MIP6_HOT_COOKIE_LEN, ENC_BIG_ENDIAN);
1349         proto_tree_add_item(data_tree, hf_mip6_hot_token, tvb,
1350                 MIP6_HOT_TOKEN_OFF, MIP6_HOT_TOKEN_LEN, ENC_BIG_ENDIAN);
1351     }
1352 
1353     return MIP6_DATA_OFF + MIP6_HOT_LEN;
1354 }
1355 
1356 static int
dissect_mip6_cot(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1357 dissect_mip6_cot(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1358 {
1359     if (mip6_tree) {
1360         proto_tree *data_tree;
1361 
1362         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1363                 MIP6_COT_LEN, ett_mip6, NULL, "Care-of Test");
1364 
1365         proto_tree_add_item(data_tree, hf_mip6_cot_nindex, tvb,
1366                 MIP6_COT_INDEX_OFF, MIP6_COT_INDEX_LEN, ENC_BIG_ENDIAN);
1367         proto_tree_add_item(data_tree, hf_mip6_cot_cookie, tvb,
1368                 MIP6_COT_COOKIE_OFF, MIP6_COT_COOKIE_LEN, ENC_BIG_ENDIAN);
1369         proto_tree_add_item(data_tree, hf_mip6_hot_token, tvb,
1370                 MIP6_COT_TOKEN_OFF, MIP6_COT_TOKEN_LEN, ENC_BIG_ENDIAN);
1371     }
1372 
1373     return MIP6_DATA_OFF + MIP6_COT_LEN;
1374 }
1375 
1376 /* RFC3775 */
1377 
1378 /*
1379 http://www.iana.org/assignments/mobility-parameters/mobility-parameters.xml#mobility-parameters-11
1380 A 0x8000 [RFC6275]
1381 H 0x4000 [RFC6275]
1382 L 0x2000 [RFC6275]
1383 K 0x1000 [RFC6275]
1384 M 0x0800 [RFC4140]
1385 R 0x0400 [RFC3963]
1386 P 0x0200 [RFC5213]
1387 F 0x0100 [RFC5555]
1388 T 0x0080 [RFC5845]
1389 B 0x0040 [RFC6602]
1390 */
1391 static int
dissect_mip6_bu(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1392 dissect_mip6_bu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1393 {
1394     if (mip6_tree) {
1395         proto_tree *data_tree;
1396         int         lifetime;
1397 
1398         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1399                 MIP6_BU_LEN, ett_mip6, NULL, "Binding Update");
1400 
1401         proto_tree_add_item(data_tree, hf_mip6_bu_seqnr, tvb,
1402                 MIP6_BU_SEQNR_OFF, MIP6_BU_SEQNR_LEN, ENC_BIG_ENDIAN);
1403 
1404         proto_tree_add_item(data_tree, hf_mip6_bu_a_flag, tvb,
1405                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1406         proto_tree_add_item(data_tree, hf_mip6_bu_h_flag, tvb,
1407                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1408         proto_tree_add_item(data_tree, hf_mip6_bu_l_flag, tvb,
1409                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1410         proto_tree_add_item(data_tree, hf_mip6_bu_k_flag, tvb,
1411                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1412         proto_tree_add_item(data_tree, hf_mip6_bu_m_flag, tvb,
1413                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1414         proto_tree_add_item(data_tree, hf_mip6_nemo_bu_r_flag, tvb,
1415                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1416         proto_tree_add_item(data_tree, hf_pmip6_bu_p_flag, tvb,
1417                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1418         proto_tree_add_item(data_tree, hf_mip6_bu_f_flag, tvb,
1419                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1420         proto_tree_add_item(data_tree, hf_pmip6_bu_t_flag, tvb,
1421                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1422         proto_tree_add_item(data_tree, hf_pmip6_bu_b_flag, tvb,
1423                 MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, ENC_BIG_ENDIAN);
1424 
1425         if ((tvb_get_guint8(tvb, MIP6_BU_FLAGS_OFF) & 0x0004 ) == 0x0004)
1426             proto_nemo = 1;
1427 
1428         lifetime = tvb_get_ntohs(tvb, MIP6_BU_LIFETIME_OFF);
1429         proto_tree_add_uint_format_value(data_tree, hf_mip6_bu_lifetime, tvb,
1430                 MIP6_BU_LIFETIME_OFF,
1431                 MIP6_BU_LIFETIME_LEN, lifetime,
1432                 "%d (%ld seconds)",
1433                 lifetime, (long)lifetime * 4);
1434     }
1435 
1436     return MIP6_DATA_OFF + MIP6_BU_LEN;
1437 }
1438 
1439 static int
dissect_mip6_ba(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1440 dissect_mip6_ba(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1441 {
1442     if (mip6_tree) {
1443         proto_tree *data_tree;
1444         int         lifetime;
1445 
1446         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1447                 MIP6_BA_LEN, ett_mip6, NULL, "Binding Acknowledgement");
1448 
1449         proto_tree_add_item(data_tree, hf_mip6_ba_status, tvb,
1450                 MIP6_BA_STATUS_OFF, MIP6_BA_STATUS_LEN, ENC_BIG_ENDIAN);
1451         proto_tree_add_item(data_tree, hf_mip6_ba_k_flag, tvb,
1452                 MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
1453         proto_tree_add_item(data_tree, hf_mip6_nemo_ba_r_flag, tvb,
1454                 MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
1455         proto_tree_add_item(data_tree, hf_pmip6_ba_p_flag, tvb,
1456                 MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
1457         proto_tree_add_item(data_tree, hf_pmip6_ba_t_flag, tvb,
1458                 MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
1459         proto_tree_add_item(data_tree, hf_pmip6_ba_b_flag, tvb,
1460                 MIP6_BA_FLAGS_OFF, MIP6_BA_FLAGS_LEN, ENC_BIG_ENDIAN);
1461         if ((tvb_get_guint8(tvb, MIP6_BA_FLAGS_OFF) & 0x0040 ) == 0x0040)
1462             proto_nemo = 1;
1463 
1464         proto_tree_add_item(data_tree, hf_mip6_ba_seqnr, tvb,
1465                 MIP6_BA_SEQNR_OFF, MIP6_BA_SEQNR_LEN, ENC_BIG_ENDIAN);
1466 
1467         lifetime = tvb_get_ntohs(tvb, MIP6_BA_LIFETIME_OFF);
1468         proto_tree_add_uint_format_value(data_tree, hf_mip6_ba_lifetime, tvb,
1469                 MIP6_BA_LIFETIME_OFF,
1470                 MIP6_BA_LIFETIME_LEN, lifetime,
1471                 "%d (%ld seconds)",
1472                 lifetime, (long)lifetime * 4);
1473     }
1474 
1475     return MIP6_DATA_OFF + MIP6_BA_LEN;
1476 }
1477 
1478 static int
dissect_mip6_be(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1479 dissect_mip6_be(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1480 {
1481     if (mip6_tree) {
1482         proto_tree *data_tree;
1483 
1484         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1485                 MIP6_BE_LEN, ett_mip6, NULL, "Binding Error");
1486 
1487         proto_tree_add_item(data_tree, hf_mip6_be_status, tvb,
1488                 MIP6_BE_STATUS_OFF, MIP6_BE_STATUS_LEN, ENC_BIG_ENDIAN);
1489         proto_tree_add_item(data_tree, hf_mip6_be_haddr, tvb,
1490                 MIP6_BE_HOA_OFF, MIP6_BE_HOA_LEN, ENC_NA);
1491     }
1492 
1493     return MIP6_DATA_OFF + MIP6_BE_LEN;
1494 }
1495 
1496 /* Home Agent Switch Message */
1497 /*
1498        0                   1                   2                   3
1499        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
1500                                       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1501                                       |# of Addresses |   Reserved    |
1502       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1503       |                                                               |
1504       +                                                               +
1505       .                                                               .
1506       .                      Home Agent Addresses                     .
1507       .                                                               .
1508       +                                                               +
1509       |                                                               |
1510       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1511       |                                                               |
1512       +                                                               +
1513       .                                                               .
1514       .                        Mobility Options                       .
1515       .                                                               .
1516       +                                                               +
1517       |                                                               |
1518       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1519 */
1520 
1521 static int
dissect_mip6_has(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1522 dissect_mip6_has(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1523 {
1524     guint num_addrs, len;
1525 
1526     num_addrs = tvb_get_guint8(tvb, MIP6_DATA_OFF);
1527     len = 2 + num_addrs * 16;
1528 
1529     if (mip6_tree) {
1530         proto_tree *data_tree;
1531         gint off;
1532         guint i;
1533 
1534         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1535                 len, ett_mip6, NULL, "Home Agent Switch");
1536 
1537         proto_tree_add_item(data_tree, hf_mip6_has_num_addrs, tvb,
1538                 MIP6_DATA_OFF, 1, ENC_BIG_ENDIAN);
1539 
1540         proto_tree_add_item(data_tree, hf_mip6_has_reserved, tvb,
1541                 MIP6_DATA_OFF + 1, 1, ENC_BIG_ENDIAN);
1542 
1543         for (i = 0, off = MIP6_DATA_OFF + 2; i < num_addrs; i++, off += 16) {
1544             proto_tree_add_item(data_tree, hf_mip6_has_address, tvb, off, 16, ENC_NA);
1545         }
1546     }
1547 
1548     return len;
1549 }
1550 
1551 static int
dissect_mip6_hb(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1552 dissect_mip6_hb(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1553 {
1554     if (mip6_tree) {
1555         proto_tree *data_tree;
1556 
1557         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1558                 MIP6_HB_LEN, ett_mip6, NULL, "Heartbeat");
1559 
1560         proto_tree_add_item(data_tree, hf_mip6_hb_u_flag, tvb,
1561                 MIP6_HB_FLAGS_OFF, MIP6_HB_FLAGS_LEN, ENC_BIG_ENDIAN);
1562         proto_tree_add_item(data_tree, hf_mip6_hb_r_flag, tvb,
1563                 MIP6_HB_FLAGS_OFF, MIP6_HB_FLAGS_LEN, ENC_BIG_ENDIAN);
1564 
1565         proto_tree_add_item(data_tree, hf_mip6_hb_seqnr, tvb,
1566                 MIP6_HB_SEQNR_OFF, MIP6_HB_SEQNR_LEN, ENC_BIG_ENDIAN);
1567 
1568     }
1569 
1570     return MIP6_DATA_OFF + MIP6_HB_LEN;
1571 }
1572 /*
1573       0                   1                   2                   3
1574       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
1575                                      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1576                                      |           Sequence #          |
1577      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1578      |S|U|  Reserved |      Code     |                               |
1579      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               .
1580      |                                                               |
1581      .                                                               .
1582      .                          Mobility options                     .
1583      .                                                               .
1584      |                                                               |
1585      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1586 
1587                  Figure 6: Handover Initiate (HI) Message
1588 
1589 */
1590 static int
dissect_mip6_hi(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1591 dissect_mip6_hi(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1592 {
1593     if (mip6_tree) {
1594         proto_tree *data_tree;
1595 
1596         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF, 4, ett_mip6, NULL, "Handover Initiate");
1597 
1598         proto_tree_add_item(data_tree, hf_mip6_hi_seqnr, tvb,
1599                 MIP6_DATA_OFF, 2, ENC_BIG_ENDIAN);
1600 
1601         proto_tree_add_item(data_tree, hf_mip6_hi_s_flag, tvb,
1602                 MIP6_DATA_OFF+2, 1, ENC_BIG_ENDIAN);
1603         proto_tree_add_item(data_tree, hf_mip6_hi_u_flag, tvb,
1604                 MIP6_DATA_OFF+2, 1, ENC_BIG_ENDIAN);
1605 
1606         proto_tree_add_item(data_tree, hf_mip6_hi_code, tvb,
1607                 MIP6_DATA_OFF+3, 1, ENC_BIG_ENDIAN);
1608 
1609     }
1610 
1611     return MIP6_DATA_OFF + 4;
1612 }
1613 
1614 /*
1615       0                   1                   2                   3
1616       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
1617                                      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1618                                      |           Sequence #          |
1619      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1620      |    Reserved   |      Code     |                               |
1621      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               .
1622      |                                                               |
1623      .                                                               .
1624      .                          Mobility options                     .
1625      .                                                               .
1626      |                                                               |
1627      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1628 
1629                Figure 7: Handover Acknowledge (HAck) Message
1630 
1631 */
1632 
1633 static int
dissect_mip6_hack(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1634 dissect_mip6_hack(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1635 {
1636     if (mip6_tree) {
1637         proto_tree *data_tree;
1638 
1639         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF, 4, ett_mip6, NULL, "Handover Acknowledge ");
1640 
1641         proto_tree_add_item(data_tree, hf_mip6_hack_seqnr, tvb,
1642                 MIP6_DATA_OFF, 2, ENC_BIG_ENDIAN);
1643 
1644 
1645         proto_tree_add_item(data_tree, hf_mip6_hack_code, tvb,
1646                 MIP6_DATA_OFF+3, 1, ENC_BIG_ENDIAN);
1647 
1648     }
1649 
1650     return MIP6_DATA_OFF + 4;
1651 }
1652 
1653 static int
dissect_mip6_unknown(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1654 dissect_mip6_unknown(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1655 {
1656     guint hdr_len, data_len;
1657 
1658     hdr_len = (tvb_get_guint8(tvb, MIP6_HLEN_OFF) + 1) * 8;
1659     data_len = hdr_len - MIP6_DATA_OFF;
1660 
1661     proto_tree_add_item(mip6_tree, hf_mip6_unknown_type_data, tvb, MIP6_DATA_OFF, data_len, ENC_NA);
1662 
1663     return hdr_len;
1664 }
1665 
1666 static int
dissect_fmip6_fbu(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1667 dissect_fmip6_fbu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1668 {
1669     if (mip6_tree) {
1670         proto_tree *data_tree;
1671         int lifetime;
1672 
1673         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1674                 MIP6_BU_LEN, ett_mip6, NULL, "Fast Binding Update");
1675 
1676         proto_tree_add_item(data_tree, hf_fmip6_fbu_seqnr, tvb,
1677                 FMIP6_FBU_SEQNR_OFF, FMIP6_FBU_SEQNR_LEN, ENC_BIG_ENDIAN);
1678 
1679         proto_tree_add_item(data_tree, hf_fmip6_fbu_a_flag, tvb,
1680                 FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
1681         proto_tree_add_item(data_tree, hf_fmip6_fbu_h_flag, tvb,
1682                 FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
1683         proto_tree_add_item(data_tree, hf_fmip6_fbu_l_flag, tvb,
1684                 FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
1685         proto_tree_add_item(data_tree, hf_fmip6_fbu_k_flag, tvb,
1686                 FMIP6_FBU_FLAGS_OFF, FMIP6_FBU_FLAGS_LEN, ENC_BIG_ENDIAN);
1687 
1688         lifetime = tvb_get_ntohs(tvb, FMIP6_FBU_LIFETIME_OFF);
1689         proto_tree_add_uint_format_value(data_tree, hf_fmip6_fbu_lifetime, tvb,
1690                 FMIP6_FBU_LIFETIME_OFF,
1691                 FMIP6_FBU_LIFETIME_LEN, lifetime,
1692                 "%d (%ld seconds)",
1693                 lifetime, (long)lifetime * 4);
1694     }
1695 
1696     return MIP6_DATA_OFF + FMIP6_FBU_LEN;
1697 }
1698 
1699 static int
dissect_fmip6_fback(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1700 dissect_fmip6_fback(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1701 {
1702     if (mip6_tree) {
1703         proto_tree *data_tree;
1704         int         lifetime;
1705 
1706         data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1707                 FMIP6_FBACK_LEN, ett_mip6, NULL, "Fast Binding Acknowledgement");
1708 
1709         proto_tree_add_item(data_tree, hf_fmip6_fback_status, tvb,
1710                 FMIP6_FBACK_STATUS_OFF, FMIP6_FBACK_STATUS_LEN, ENC_BIG_ENDIAN);
1711         proto_tree_add_item(data_tree, hf_fmip6_fback_k_flag, tvb,
1712                 FMIP6_FBACK_FLAGS_OFF, FMIP6_FBACK_FLAGS_LEN, ENC_BIG_ENDIAN);
1713         proto_tree_add_item(data_tree, hf_fmip6_fback_seqnr, tvb,
1714                 FMIP6_FBACK_SEQNR_OFF, FMIP6_FBACK_SEQNR_LEN, ENC_BIG_ENDIAN);
1715         lifetime = tvb_get_ntohs(tvb, FMIP6_FBACK_LIFETIME_OFF);
1716         proto_tree_add_uint_format_value(data_tree, hf_fmip6_fback_lifetime, tvb,
1717                 FMIP6_FBACK_LIFETIME_OFF,
1718                 FMIP6_FBACK_LIFETIME_LEN, lifetime,
1719                 "%d (%ld seconds)",
1720                 lifetime, (long)lifetime * 4);
1721     }
1722 
1723     return MIP6_DATA_OFF + FMIP6_FBACK_LEN;
1724 }
1725 
1726 static int
dissect_fmip6_fna(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_)1727 dissect_fmip6_fna(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
1728 {
1729     proto_tree_add_item(mip6_tree, hf_mip6_fast_neighbor_advertisement, tvb, MIP6_DATA_OFF, FMIP6_FNA_LEN, ENC_NA);
1730 
1731     return MIP6_DATA_OFF + FMIP6_FNA_LEN;
1732 }
1733 
1734 /* PMIP Binding Revocation Indication / Acknowledge */
1735 static int
dissect_pmip6_bri(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo)1736 dissect_pmip6_bri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
1737 {
1738 #define INDICATION  1
1739 #define ACKNOWLEDGE 2
1740 
1741     proto_tree *field_tree;
1742     guint8      br_type;
1743 
1744     br_type = tvb_get_guint8(tvb, PMIP6_BRI_BRTYPE_OFF);
1745 
1746     /* Branch between BR Indication and BR Acknowledge */
1747     if ( br_type == INDICATION )
1748     {
1749         col_append_str(pinfo->cinfo, COL_INFO, " Indication");
1750 
1751         if (mip6_tree)
1752         {
1753             field_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1754                 PMIP6_BRI_LEN, ett_mip6, NULL, "Binding Revocation Indication");
1755 
1756             proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb,
1757                 PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, ENC_BIG_ENDIAN);
1758 
1759             proto_tree_add_item(field_tree, hf_pmip6_bri_rtrigger, tvb,
1760                 PMIP6_BRI_RTRIGGER_OFF, PMIP6_BRI_RTRIGGER_LEN, ENC_BIG_ENDIAN);
1761 
1762             proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb,
1763                 PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, ENC_BIG_ENDIAN);
1764 
1765             proto_tree_add_item(field_tree, hf_pmip6_bri_ip_flag, tvb,
1766                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1767 
1768             proto_tree_add_item(field_tree, hf_pmip6_bri_iv_flag, tvb,
1769                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1770 
1771             proto_tree_add_item(field_tree, hf_pmip6_bri_ig_flag, tvb,
1772                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1773 
1774             proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb,
1775                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1776         }
1777     } else if ( br_type == ACKNOWLEDGE ) {
1778 
1779         col_append_str(pinfo->cinfo, COL_INFO, " Acknowledge");
1780 
1781         if (mip6_tree)
1782         {
1783             field_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
1784                 PMIP6_BRI_LEN, ett_mip6, NULL, "Binding Revocation Acknowledge");
1785 
1786             proto_tree_add_item(field_tree, hf_pmip6_bri_brtype, tvb,
1787                 PMIP6_BRI_BRTYPE_OFF, PMIP6_BRI_BRTYPE_LEN, ENC_BIG_ENDIAN);
1788 
1789             proto_tree_add_item(field_tree, hf_pmip6_bri_status, tvb,
1790                 PMIP6_BRI_STATUS_OFF, PMIP6_BRI_STATUS_LEN, ENC_BIG_ENDIAN);
1791 
1792             proto_tree_add_item(field_tree, hf_pmip6_bri_seqnr, tvb,
1793                 PMIP6_BRI_SEQNR_OFF, PMIP6_BRI_SEQNR_LEN, ENC_BIG_ENDIAN);
1794 
1795             proto_tree_add_item(field_tree, hf_pmip6_bri_ap_flag, tvb,
1796                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1797 
1798             proto_tree_add_item(field_tree, hf_pmip6_bri_av_flag, tvb,
1799                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1800 
1801             proto_tree_add_item(field_tree, hf_pmip6_bri_ag_flag, tvb,
1802                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1803 
1804             proto_tree_add_item(field_tree, hf_pmip6_bri_res, tvb,
1805                 PMIP6_BRI_FLAGS_OFF, PMIP6_BRI_FLAGS_LEN, ENC_BIG_ENDIAN);
1806         }
1807     }
1808 
1809     return MIP6_DATA_OFF + PMIP6_BRI_LEN;
1810 }
1811 
1812 /*
1813 
1814     10.1. Localized Routing Initiation (LRI)
1815 
1816      0                   1                   2                   3
1817      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1818                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1819                                     |           Sequence #          |
1820     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1821     |         Reserved              |           Lifetime            |
1822     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1823     |                                                               |
1824     .                                                               .
1825     .                        Mobility options                       .
1826     .                                                               .
1827     |                                                               |
1828     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1829 
1830 */
1831 
1832 static int
dissect_pmip6_lri(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_,gint offset)1833 dissect_pmip6_lri(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_, gint offset)
1834 {
1835     proto_tree_add_item(mip6_tree, hf_pmip6_lri_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
1836     offset += 2;
1837 
1838     proto_tree_add_item(mip6_tree, hf_pmip6_lri_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1839     offset += 2;
1840 
1841     proto_tree_add_item(mip6_tree, hf_pmip6_lri_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN);
1842     offset += 2;
1843 
1844     return offset;
1845 }
1846 
1847 /*
1848 
1849     10.2. Localized Routing Acknowledgment (LRA)
1850 
1851      0                   1                   2                   3
1852      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
1853                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1854                                     |           Sequence #          |
1855     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1856     |U|  Reserved   |   Status      |           Lifetime            |
1857     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1858     |                                                               |
1859     .                                                               .
1860     .                        Mobility options                       .
1861     .                                                               .
1862     |                                                               |
1863     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1864 
1865 */
1866 
1867 static int
dissect_pmip6_lra(tvbuff_t * tvb,proto_tree * mip6_tree,packet_info * pinfo _U_,gint offset)1868 dissect_pmip6_lra(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_, gint offset)
1869 {
1870     proto_tree_add_item(mip6_tree, hf_pmip6_lra_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
1871     offset += 2;
1872 
1873     proto_tree_add_item(mip6_tree, hf_pmip6_lra_u, tvb, offset, 1, ENC_BIG_ENDIAN);
1874     proto_tree_add_item(mip6_tree, hf_pmip6_lra_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1875     offset += 1;
1876 
1877     proto_tree_add_item(mip6_tree, hf_pmip6_lra_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1878     offset += 1;
1879 
1880     proto_tree_add_item(mip6_tree, hf_pmip6_lra_lifetime, tvb, offset, 2, ENC_BIG_ENDIAN);
1881     offset += 2;
1882 
1883     return offset;
1884 }
1885 /* Functions to dissect the mobility options */
1886 /*Dissect vendor option 3GPP
1887  * Ref  Mobile IPv6 vendor specific option format and usage within 3GPP
1888  * (3GPP TS 29.282 version 10.2.0 Release 10)
1889  */
1890 
1891 /*
1892 
1893      0                   1                   2                   3
1894      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
1895                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1896                                     |     Type      |   Length      |
1897     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1898     |                         Vendor ID                             |
1899     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1900     |   Sub-Type    |  Reserved   |M| 3GPP Specific IE Data Fragment
1901     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1902 
1903 */
1904 
1905 static int
dissect_mip6_opt_vsm_3gpp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)1906 dissect_mip6_opt_vsm_3gpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1907 {
1908     proto_item *hdr_item = tree;
1909     int    len = tvb_reported_length(tvb);
1910     int offset = 0;
1911     guint8 sub_type, m_flag;
1912     tvbuff_t *next_tvb;
1913     gchar *mei_str;
1914     char *digit_str;
1915     gchar *mcc_mnc_str;
1916     gchar *imsi_str;
1917 
1918     /* offset points to the sub type */
1919     sub_type = tvb_get_guint8(tvb,offset);
1920     proto_tree_add_item(tree, hf_mip6_vsm_subtype_3gpp, tvb, offset, 1, ENC_BIG_ENDIAN);
1921     proto_item_append_text(hdr_item, " %s", val_to_str_ext_const(sub_type, &mip6_vsm_subtype_3gpp_value_ext, "<unknown>"));
1922     offset++;
1923     m_flag = tvb_get_guint8(tvb,offset) & 0x01;
1924     proto_tree_add_item(tree, hf_mip6_opt_3gpp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1925     proto_tree_add_item(tree, hf_mip6_opt_3gpp_flag_m, tvb, offset, 1, ENC_BIG_ENDIAN);
1926     offset++;
1927 
1928     /* set len to the length of the data section */
1929     len = len - 2;
1930 
1931     if(m_flag){
1932         proto_tree_add_expert_format(tree, pinfo, &ei_mip6_vsm_data_not_dissected, tvb, offset, len, "Data fragment, handling not implemented yet");
1933         return len;
1934     }
1935 
1936     /* see 3GPP TS 29.275 version 10.5.0 Release 10 */
1937     switch (sub_type) {
1938     /*  1, Protocol Configuration Options
1939      *     3GPP PCO data, in the format from 3GPP TS 24.008 [16] subclause 10.5.6.3, starting with octet 3
1940      *     de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
1941      *     Note needs pinfo->link_dir ?
1942      */
1943     case 1:
1944         pinfo->link_dir = P2P_DIR_DL;
1945         de_sm_pco(tvb, tree, pinfo, offset, len, NULL, 0);
1946         break;
1947     /*  2, 3GPP Specific PMIPv6 Error Code */
1948     case 2:
1949         proto_tree_add_item(tree, hf_mip6_opt_3gpp_spec_pmipv6_err_code, tvb, offset, 1, ENC_BIG_ENDIAN);
1950         break;
1951     /*  3, PMIPv6 PDN GW IP Address
1952      *     PDN GW IP address, as specified in subclause 12.1.1.4
1953      */
1954     case 3:
1955         if(len == 4){
1956             /* Ipv4 address */
1957             proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_gw_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
1958         }else if(len == 16){
1959             /* IPv6 address */
1960             proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_gw_ipv6_addr, tvb, offset, 16, ENC_NA);
1961         }
1962         break;
1963     /*  4, PMIPv6 DHCPv4 Address Allocation Procedure Indication
1964      *     DHCPv4 Address Allocation Procedure Indication, as specified in subclause 12.1.1.5
1965      */
1966     case 4:
1967         proto_tree_add_item(tree, hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
1968         break;
1969     /*  5, PMIPv6 Fully Qualified PDN Connection Set Identifier
1970      * FQ-CSID as specified in subclause 12.1.1.2
1971      */
1972     case 5:
1973         next_tvb = tvb_new_subset_length(tvb, offset, len);
1974         dissect_gtpv2_fq_csid(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
1975         break;
1976     /*  6, PMIPv6 PDN type indication */
1977     case 6:
1978         proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1979         offset++;
1980         proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_ind_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
1981         break;
1982     /*  7, Charging ID
1983      *     Charging ID as specified in subclause 12.1.1.6
1984      */
1985     case 7:
1986         proto_tree_add_item(tree, hf_mip6_opt_3gpp_chg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1987         proto_item_append_text(hdr_item, " %u", tvb_get_ntohl(tvb, offset));
1988         break;
1989     /*  8, Selection Mode */
1990     case 8:
1991         next_tvb = tvb_new_subset_length(tvb, offset, len);
1992         dissect_gtpv2_selec_mode(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
1993         break;
1994     /*  9, I-WLAN Mobility Access Point Name (APN) */
1995     /* 10, Charging Characteristics */
1996     case 10:
1997         proto_tree_add_item(tree, hf_mip6_opt_3gpp_charging_characteristic, tvb, offset, 2, ENC_BIG_ENDIAN);
1998         break;
1999     /* 11, Mobile Equipment Identity (MEI) */
2000     case 11:
2001         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);
2002         proto_item_append_text(hdr_item, " %s", mei_str);
2003         break;
2004     /* 12, MSISDN */
2005     case 12:
2006         dissect_e164_cc(tvb, tree, offset, E164_ENC_BCD);
2007         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);
2008         proto_item_append_text(hdr_item, " %s", digit_str);
2009         break;
2010     /* 13, Serving Network */
2011     case 13:
2012         mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE);
2013         proto_item_append_text(hdr_item," %s", mcc_mnc_str);
2014         break;
2015     /* 14, APN Restriction */
2016     case 14:
2017          proto_tree_add_item(tree, hf_mip6_opt_3gpp_apn_rest, tvb, offset, 1, ENC_BIG_ENDIAN);
2018          break;
2019     /* 15, Maximum APN Restriction */
2020     case 15:
2021          proto_tree_add_item(tree, hf_mip6_opt_3gpp_max_apn_rest, tvb, offset, 1, ENC_BIG_ENDIAN);
2022          break;
2023     /* 16, Unauthenticated IMSI */
2024     case 16:
2025         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);
2026         proto_item_append_text(hdr_item," %s", imsi_str);
2027         break;
2028     /* 17, PDN Connection ID */
2029     case 17:
2030          proto_tree_add_item(tree, hf_mip6_opt_3gpp_pdn_conn_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2031          break;
2032     /* 18, PGW Back-Off Time */
2033     case 18:
2034         next_tvb = tvb_new_subset_length(tvb, offset, len);
2035         dissect_gtpv2_epc_timer(next_tvb, pinfo, tree, hdr_item, len, 0, 0, NULL);
2036         break;
2037     /* 19, Signalling Priority Indication */
2038     case 19:
2039          proto_tree_add_item(tree, hf_hf_mip6_opt_3gpp_lapi, tvb, offset, 1, ENC_BIG_ENDIAN);
2040          break;
2041     /* 20, Additional Protocol Configuration Options
2042      *     12.1.1.19 Additional Protocol Configuration Options
2043      *     The Additional Protocol Configuration Options IE contains additional 3GPP protocol configuration options
2044      *     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
2045      *     with octet 3.
2046      */
2047     default:
2048         proto_tree_add_expert(tree, pinfo, &ei_mip6_vsm_data_not_dissected, tvb, offset, len);
2049         break;
2050     }
2051 
2052     return len;
2053 }
2054 
2055 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)2056 mip6_fixed_option_header(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, int proto, int ett, proto_item** ti, guint len, guint optlen)
2057 {
2058     proto_tree *field_tree;
2059     proto_item *tf;
2060 
2061     *ti = proto_tree_add_item(tree, proto, tvb, 0, -1, ENC_NA);
2062     field_tree = proto_item_add_subtree(*ti, ett);
2063 
2064     tf = proto_tree_add_item(field_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);
2065 
2066     if (len != optlen) {
2067         /* Bogus - option length isn't what it's supposed to be for this option. */
2068         expert_add_info_format(pinfo, tf, &ei_mip6_opt_len_invalid,
2069                             "%s (with option length = %u byte%s; should be %u)",
2070                             proto_get_protocol_short_name(find_protocol_by_id(proto)),
2071                             len, plurality(len, "", "s"), optlen);
2072     }
2073 
2074     return field_tree;
2075 }
2076 
2077 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)2078 mip6_var_option_header(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, int proto, int ett, proto_item** ti, guint len, guint optlen)
2079 {
2080     proto_tree *field_tree;
2081     proto_item *tf;
2082 
2083     *ti = proto_tree_add_item(tree, proto, tvb, 0, -1, ENC_NA);
2084     field_tree = proto_item_add_subtree(*ti, ett);
2085 
2086     tf = proto_tree_add_item(field_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);
2087     if (len < optlen)
2088         expert_add_info_format(pinfo, tf, &ei_mip6_opt_len_invalid,
2089             "%s (with option length = %u byte%s; should be >= %u)", proto_get_protocol_short_name(find_protocol_by_id(proto)),
2090             len, plurality(len, "", "s"), optlen);
2091 
2092     return field_tree;
2093 }
2094 
2095 
2096 
2097 /* 1 PadN [RFC3775] */
2098 static int
dissect_mip6_opt_padn(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2099 dissect_mip6_opt_padn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2100 {
2101     proto_tree* opt_tree;
2102     proto_item* ti;
2103     int option_len = tvb_reported_length(tvb)-2;
2104     int offset = 2;
2105 
2106     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_padn, ett_mip6_opt_padn, &ti, option_len, 0);
2107 
2108     if (option_len > 0) {
2109         proto_tree_add_item(opt_tree, hf_mip6_opt_padn, tvb, offset, option_len, ENC_NA);
2110     }
2111 
2112     return tvb_captured_length(tvb);
2113 }
2114 
2115 /* 2 Binding Refresh Advice */
2116 static int
dissect_mip6_opt_bra(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2117 dissect_mip6_opt_bra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
2118 {
2119     proto_tree* opt_tree;
2120     proto_item* ti;
2121     int option_len = tvb_reported_length(tvb)-2;
2122     int offset = 2;
2123     int ri;
2124 
2125     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_bra, ett_mip6_opt_bra, &ti, option_len, MIP6_BRA_LEN);
2126 
2127     ri = tvb_get_ntohs(tvb, offset);
2128     proto_tree_add_uint_format_value(opt_tree, hf_mip6_bra_interval, tvb,
2129             offset, 2,
2130             ri, "%d (%ld seconds)",
2131             ri, (long)ri * 4);
2132 
2133     return tvb_captured_length(tvb);
2134 }
2135 
2136 /*3  Alternate Care-of Address */
2137 static int
dissect_mip6_opt_acoa(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2138 dissect_mip6_opt_acoa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
2139 {
2140     proto_tree* opt_tree;
2141     proto_item* ti;
2142     int option_len = tvb_reported_length(tvb)-2;
2143     int offset = 2;
2144 
2145     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_acoa, ett_mip6_opt_acoa, &ti, option_len, MIP6_ACOA_LEN);
2146 
2147     proto_tree_add_item(opt_tree, hf_mip6_acoa_acoa, tvb,
2148         offset, MIP6_ACOA_ACOA_LEN, ENC_NA);
2149 
2150     return tvb_captured_length(tvb);
2151 }
2152 
2153 /* 4 Nonce Indices */
2154 static int
dissect_mip6_opt_ni(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2155 dissect_mip6_opt_ni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
2156 {
2157     proto_tree* opt_tree;
2158     proto_item* ti;
2159     int option_len = tvb_reported_length(tvb)-2;
2160     int offset = 2;
2161 
2162     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ni, ett_mip6_opt_ni, &ti, option_len, MIP6_NI_LEN);
2163 
2164     proto_tree_add_item(opt_tree, hf_mip6_ni_hni, tvb, offset, MIP6_NI_HNI_LEN, ENC_BIG_ENDIAN);
2165     offset += MIP6_NI_HNI_LEN;
2166     proto_tree_add_item(opt_tree, hf_mip6_ni_cni, tvb, offset, MIP6_NI_CNI_LEN, ENC_BIG_ENDIAN);
2167 
2168     return tvb_captured_length(tvb);
2169 }
2170 
2171 /* 5 Authorization Data */
2172 static int
dissect_mip6_opt_bad(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2173 dissect_mip6_opt_bad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
2174 {
2175     proto_tree* opt_tree;
2176     proto_item* ti;
2177     int option_len = tvb_reported_length(tvb)-2;
2178     int offset = 2;
2179 
2180     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_bad_auth, ett_mip6_opt_bad, &ti, option_len, 0);
2181 
2182     proto_tree_add_item(opt_tree, hf_mip6_bad_auth, tvb, offset, option_len, ENC_NA);
2183 
2184     return tvb_captured_length(tvb);
2185 }
2186 
2187 static int
dissect_mip6_network_prefix_option(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int proto,int ett,int optlen)2188 dissect_mip6_network_prefix_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int proto, int ett, int optlen)
2189 {
2190     proto_tree* field_tree;
2191     proto_item* ti;
2192     int option_len = tvb_reported_length(tvb)-2;
2193     int offset = 3;
2194     guint32 prefix_len;
2195 
2196     field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto, ett, &ti, option_len, optlen);
2197 
2198     proto_tree_add_item_ret_uint(field_tree, hf_mip6_nemo_mnp_pfl, tvb,
2199             offset, 1, ENC_BIG_ENDIAN, &prefix_len);
2200 
2201     offset++;
2202     proto_tree_add_item(field_tree, hf_mip6_nemo_mnp_mnp, tvb, offset, MIP6_NEMO_MNP_MNP_LEN, ENC_NA);
2203     proto_item_append_text(ti, ": %s/%u", tvb_ip6_to_str(pinfo->pool, tvb, offset), prefix_len);
2204 
2205     return tvb_captured_length(tvb);
2206 }
2207 
2208 /* 6 Mobile Network Prefix Option */
2209 static int
dissect_mip6_nemo_opt_mnp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2210 dissect_mip6_nemo_opt_mnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2211 {
2212     return dissect_mip6_network_prefix_option(tvb, pinfo, tree, proto_mip6_option_mnp, ett_mip6_nemo_opt_mnp, MIP6_NEMO_MNP_LEN);
2213 }
2214 
2215 /* 7 Mobility Header Link-Layer Address option [RFC5568] */
2216 static int
dissect_fmip6_opt_lla(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2217 dissect_fmip6_opt_lla(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2218 {
2219     proto_tree* opt_tree;
2220     proto_item* ti;
2221     int option_len = tvb_reported_length(tvb)-2;
2222     int offset = 2;
2223 
2224     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mhlla, ett_fmip6_opt_lla, &ti, option_len, FMIP6_LLA_MINLEN);
2225 
2226     proto_tree_add_item(opt_tree, hf_fmip6_lla_optcode, tvb,
2227             offset, FMIP6_LLA_OPTCODE_LEN, ENC_BIG_ENDIAN);
2228     offset += FMIP6_LLA_OPTCODE_LEN;
2229 
2230     if (option_len > FMIP6_LLA_OPTCODE_LEN) {
2231         proto_tree_add_item(opt_tree, hf_fmip6_lla, tvb, offset, option_len-FMIP6_LLA_OPTCODE_LEN, ENC_NA);
2232     }
2233 
2234     return tvb_captured_length(tvb);
2235 }
2236 
2237 /* 8 MN-ID-OPTION-TYPE RFC4283 MN-ID
2238    https://tools.ietf.org/html/rfc4283
2239 
2240     0                   1                   2                   3
2241     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
2242                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2243                                     |  Option Type  | Option Length |
2244     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2245     |  Subtype      |          Identifier ...
2246     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2247     :
2248     Option Length:
2249 
2250     8-bit unsigned integer, representing the length in octets of
2251     the Subtype and Identifier fields.
2252 
2253 */
2254 static int
dissect_mip6_opt_mnid(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2255 dissect_mip6_opt_mnid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2256 {
2257     proto_tree* opt_tree;
2258     proto_item* ti;
2259     int option_len = tvb_reported_length(tvb)-2;
2260     int offset = 2;
2261     const guint8 *str;
2262 
2263     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mnid, ett_mip6_opt_mnid, &ti, option_len, MIP6_MNID_MINLEN);
2264 
2265     proto_tree_add_item(opt_tree, hf_mip6_mnid_subtype, tvb,
2266             offset, 1, ENC_BIG_ENDIAN);
2267     offset++;
2268 
2269     if (option_len - offset > 0) {
2270         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);
2271         proto_item_append_text(ti, ": %s", str);
2272     }
2273 
2274     return tvb_captured_length(tvb);
2275 }
2276 
2277 /*  9 AUTH-OPTION-TYPE
2278     https://tools.ietf.org/html/rfc4285
2279 
2280     0                   1                   2                   3
2281      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
2282                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2283                     |  Option Type  | Option Length |  Subtype      |
2284     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2285     |                  Mobility SPI                                 |
2286     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2287     |                  Authentication Data ....
2288     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2289        Figure 2: Mobility Message Authentication Option
2290  */
2291 static int
dissect_mip6_opt_auth(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2292 dissect_mip6_opt_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2293 {
2294     proto_tree* opt_tree;
2295     proto_item* ti;
2296     int option_len = tvb_reported_length(tvb)-2;
2297     int offset = 2;
2298 
2299     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_auth, ett_mip6_opt_auth, &ti, option_len, MIP6_AUTH_MINLEN);
2300 
2301     proto_tree_add_item(opt_tree, hf_mip6_opt_auth_sub_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2302     offset++;
2303     proto_tree_add_item(opt_tree, hf_mip6_opt_auth_mobility_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
2304     offset += 4;
2305     proto_tree_add_item(opt_tree, hf_mip6_opt_auth_auth_data, tvb, offset, option_len-offset, ENC_NA);
2306 
2307     return tvb_captured_length(tvb);
2308 }
2309 
2310 /*  10 MESG-ID-OPTION-TYPE [RFC4285] */
2311 
2312 static int
dissect_mip6_opt_mseg_id(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2313 dissect_mip6_opt_mseg_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2314 {
2315     proto_tree* opt_tree;
2316     proto_item* ti;
2317     int option_len = tvb_reported_length(tvb)-2;
2318     int offset = 2;
2319 
2320     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);
2321 
2322     proto_tree_add_item(opt_tree, hf_mip6_opt_mseg_id_timestamp, tvb, offset, 8, ENC_BIG_ENDIAN);
2323 
2324     return tvb_captured_length(tvb);
2325 }
2326 
2327 
2328 /* 11 CGA Parameters Request [RFC4866]  */
2329 /* Carries no data */
2330 static int
dissect_mip6_opt_cgapr(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2331 dissect_mip6_opt_cgapr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2332 {
2333     int option_len = tvb_reported_length(tvb)-2;
2334     proto_item* ti;
2335 
2336     mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_cgapr, ett_mip6_opt_cgapr, &ti, option_len, MIP6_CGAPR_MINLEN);
2337 
2338     return tvb_captured_length(tvb);
2339 }
2340 
2341 /* 12 CGA Parameters [RFC4866]  */
2342 static int
dissect_mip6_opt_cgar(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2343 dissect_mip6_opt_cgar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2344 {
2345     proto_tree* opt_tree;
2346     proto_item* ti;
2347     int option_len = tvb_reported_length(tvb)-2;
2348     int offset = 2;
2349 
2350     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_cgar, ett_mip6_opt_cgar, &ti, option_len, MIP6_CGAR_MINLEN);
2351 
2352     proto_tree_add_item(opt_tree, hf_mip6_opt_cgar_cga_par, tvb, offset, option_len-2, ENC_NA);
2353 
2354     return tvb_captured_length(tvb);
2355 }
2356 
2357 /* 13 Signature [RFC4866]  */
2358 static int
dissect_mip6_opt_sign(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2359 dissect_mip6_opt_sign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2360 {
2361     proto_tree* opt_tree;
2362     proto_item* ti;
2363     int option_len = tvb_reported_length(tvb)-2;
2364     int offset = 2;
2365 
2366     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_sign, ett_mip6_opt_sign, &ti, option_len, MIP6_SIGN_MINLEN);
2367 
2368     proto_tree_add_item(opt_tree, hf_mip6_opt_sign_sign, tvb, offset, option_len-2, ENC_NA);
2369 
2370     return tvb_captured_length(tvb);
2371 }
2372 
2373 /* 14 Permanent Home Keygen Token [RFC4866]  */
2374 static int
dissect_mip6_opt_phkt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2375 dissect_mip6_opt_phkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2376 {
2377     proto_tree* opt_tree;
2378     proto_item* ti;
2379     int option_len = tvb_reported_length(tvb)-2;
2380     int offset = 2;
2381 
2382     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_phkt, ett_mip6_opt_phkt, &ti, option_len, MIP6_PHKT_MINLEN);
2383 
2384     proto_tree_add_item(opt_tree, hf_mip6_opt_phkt_phkt, tvb, offset, option_len-2, ENC_NA);
2385 
2386     return tvb_captured_length(tvb);
2387 }
2388 
2389 /* 15 Care-of Test Init [RFC4866]
2390  * No data in this option.
2391  */
2392 static int
dissect_mip6_opt_coti(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2393 dissect_mip6_opt_coti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2394 {
2395     int option_len = tvb_reported_length(tvb)-2;
2396     proto_item* ti;
2397 
2398     mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_coti, ett_mip6_opt_mocoti, &ti, option_len, MIP6_MOCOTI_MINLEN);
2399 
2400     return tvb_captured_length(tvb);
2401 }
2402 
2403 /* 16 Care-of Test [RFC4866]  */
2404 static int
dissect_mip6_opt_mocot(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2405 dissect_mip6_opt_mocot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2406 {
2407     proto_tree* opt_tree;
2408     proto_item* ti;
2409     int option_len = tvb_reported_length(tvb)-2;
2410     int offset = 2;
2411 
2412     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_cot, ett_mip6_opt_mocot, &ti, option_len, MIP6_MOCOT_MINLEN);
2413 
2414     proto_tree_add_item(opt_tree, hf_mip6_opt_mocot_co_keygen_tok, tvb, offset, option_len-2, ENC_NA);
2415 
2416     return tvb_captured_length(tvb);
2417 }
2418 
2419 /* 17 DNS-UPDATE-TYPE [RFC5026]
2420 
2421      0                   1                   2                   3
2422      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
2423                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2424                                     |  Option Type  | Option Length |
2425     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2426     |   Status      |R|  Reserved   |     MN identity (FQDN) ...
2427     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2428 
2429     Option Type
2430 
2431       DNS-UPDATE-TYPE (17)
2432 
2433 */
2434 static int
dissect_mip6_opt_dnsu(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2435 dissect_mip6_opt_dnsu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2436 {
2437     proto_tree* opt_tree;
2438     proto_item* ti;
2439     int option_len = tvb_reported_length(tvb)-2;
2440     int offset = 2;
2441 
2442     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_dnsu, ett_mip6_opt_dnsu, &ti, option_len, MIP6_DNSU_MINLEN);
2443 
2444     proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_status, tvb, offset, 1, ENC_BIG_ENDIAN);
2445     offset++;
2446 
2447     proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_flag_r, tvb, offset, 1, ENC_BIG_ENDIAN);
2448     offset++;
2449 
2450     proto_tree_add_item(opt_tree, hf_mip6_opt_dnsu_mn_id, tvb, offset, option_len-2-2, ENC_NA);
2451 
2452     return tvb_captured_length(tvb);
2453 }
2454 
2455 /* 18 Experimental Mobility Option [RFC5096] */
2456 static int
dissect_mip6_opt_em(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2457 dissect_mip6_opt_em(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2458 {
2459     proto_tree* opt_tree;
2460     proto_item* ti;
2461     int option_len = tvb_reported_length(tvb)-2;
2462     int offset = 2;
2463 
2464     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_em, ett_mip6_opt_em, &ti, option_len, MIP6_EM_MINLEN);
2465 
2466     proto_tree_add_item(opt_tree, hf_mip6_opt_em_data, tvb, offset, option_len-2, ENC_NA);
2467 
2468     return tvb_captured_length(tvb);
2469 }
2470 
2471 /* 19 Vendor Specific Mobility Option [RFC5094]  */
2472 /*
2473 
2474      0                   1                   2                   3
2475      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
2476                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2477                                     |     Type      |   Length      |
2478     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2479     |                         Vendor ID                             |
2480     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2481     |   Sub-Type    |             Data.......
2482     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2483 
2484 */
2485 static int
dissect_mip6_opt_vsm(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2486 dissect_mip6_opt_vsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2487 {
2488     proto_tree* opt_tree;
2489     proto_item* ti;
2490     int option_len = tvb_reported_length(tvb)-2;
2491     int offset = 2;
2492     tvbuff_t *next_tvb;
2493     guint32 vendorid;
2494 
2495     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_vsm, ett_mip6_opt_vsm, &ti, option_len, MIP6_VSM_MINLEN);
2496 
2497     proto_tree_add_item_ret_uint(opt_tree, hf_mip6_vsm_vid, tvb,
2498             offset, MIP6_VSM_VID_LEN, ENC_BIG_ENDIAN, &vendorid);
2499     proto_item_append_text(ti, ": %s", enterprises_lookup(vendorid, "<unknown>"));
2500     offset += 4;
2501 
2502     next_tvb = tvb_new_subset_remaining(tvb, offset);
2503     if (!dissector_try_uint(mip6_vsm_dissector_table, vendorid, next_tvb, pinfo, opt_tree)){
2504         proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype, tvb,
2505                 offset, MIP6_VSM_SUBTYPE_LEN, ENC_BIG_ENDIAN);
2506         offset++;
2507 
2508         if (option_len-offset > 0){
2509             proto_tree_add_item(opt_tree, hf_mip6_vsm_data, tvb, offset, option_len-offset, ENC_NA);
2510         }
2511     }
2512 
2513     return tvb_captured_length(tvb);
2514 }
2515 
2516 /* 20 Service Selection Mobility Option [RFC5149]  */
2517 
2518 static int
dissect_mip6_opt_ssm(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2519 dissect_mip6_opt_ssm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2520 {
2521     proto_tree* opt_tree;
2522     proto_item* ti;
2523     int option_len = tvb_reported_length(tvb)-2;
2524     int offset = 2;
2525     guint8 *apn = NULL;
2526     int     name_len, tmp;
2527 
2528     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_ssm, ett_mip6_opt_ssm, &ti, option_len, MIP6_SSM_MINLEN);
2529 
2530     /* 3GPP TS 29.275 version 10.5.0 Release 10, Table 5.1.1.1-2
2531      * Set to the EPS Access Point Name to which the UE
2532      * attaches the new PDN connection.
2533      * The encoding the APN field follows 3GPP TS 23.003
2534      * [12] subclause 9.1 but excluding the trailing zero byte.
2535      * The content of the APN field shall be the full APN with
2536      * both the APN Network Identifier and default APN
2537      * Operator Identifier being present as specified in 3GPP
2538      * TS 23.003 [12] subclauses 9.1.1 and 9.1.2
2539      * NOTE 4.
2540      * NOTE 4: The APN field is not encoded as a dotted string as commonly used in documentation
2541      */
2542 
2543     if (option_len > 0) {
2544         name_len = tvb_get_guint8(tvb, offset);
2545 
2546         if (name_len < 0x20) {
2547             apn = tvb_get_string_enc(pinfo->pool, tvb, offset + 1, option_len - 1, ENC_ASCII);
2548             for (;;) {
2549                 if (name_len >= option_len - 1)
2550                     break;
2551                 tmp = name_len;
2552                 name_len = name_len + apn[tmp] + 1;
2553                 apn[tmp] = '.';
2554             }
2555         }
2556         else {
2557             apn = tvb_get_string_enc(pinfo->pool, tvb, offset, option_len, ENC_ASCII);
2558         }
2559         proto_tree_add_string(opt_tree, hf_mip6_opt_ss_identifier, tvb, offset, option_len, apn);
2560     }
2561     if(apn){
2562         proto_item_append_text(ti, ": %s", apn);
2563     }
2564     return tvb_captured_length(tvb);
2565 }
2566 
2567 /* 21 Binding Authorization Data for FMIPv6 (BADF) [RFC5568]  */
2568 
2569 static int
dissect_mip6_opt_badff(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2570 dissect_mip6_opt_badff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2571 {
2572     proto_tree* opt_tree;
2573     proto_item* ti;
2574     int option_len = tvb_reported_length(tvb)-2;
2575     int offset = 2;
2576 
2577     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_badff, ett_mip6_opt_badff, &ti, option_len, MIP6_BADFF_MINLEN);
2578 
2579     proto_tree_add_item(opt_tree, hf_mip6_opt_badff_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
2580     offset += 4;
2581     proto_tree_add_item(opt_tree, hf_mip6_opt_badff_auth, tvb, offset, option_len-offset, ENC_NA);
2582 
2583     return tvb_captured_length(tvb);
2584 }
2585 
2586 /* 22 Home Network Prefix Option [RFC5213]   */
2587 static int
dissect_mip6_opt_hnp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2588 dissect_mip6_opt_hnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2589 {
2590     return dissect_mip6_network_prefix_option(tvb, pinfo, tree, proto_mip6_option_hnp, ett_pmip6_opt_hnp, MIP6_NEMO_MNP_LEN);
2591 }
2592 
2593 /* 23 Handoff Indicator Option [RFC5213]   */
2594 /*
2595      0                   1                   2                   3
2596      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
2597     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2598     |      Type     |   Length      |  Reserved (R) |       HI      |
2599     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2600 
2601 */
2602 static int
dissect_pmip6_opt_hi(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2603 dissect_pmip6_opt_hi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2604 {
2605     proto_tree* opt_tree;
2606     proto_item* ti;
2607     int option_len = tvb_reported_length(tvb)-2;
2608     int offset = 2;
2609     guint32 hi;
2610 
2611     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_hi, ett_pmip6_opt_hi, &ti, option_len, PMIP6_HI_LEN);
2612 
2613     proto_tree_add_item(opt_tree, hf_pmip6_hi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2614     offset++;
2615 
2616     proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_hi_hi, tvb,
2617             offset, PMIP6_HI_HI_LEN, ENC_BIG_ENDIAN, &hi);
2618 
2619     proto_item_append_text(ti, ": %s", val_to_str_const(hi, pmip6_hi_opttype_value, "<unknown>"));
2620 
2621     return tvb_captured_length(tvb);
2622 }
2623 
2624 /* 24 Access Technology Type Option [RFC5213]  */
2625 /*
2626      0                   1                   2                   3
2627      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
2628     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2629     |      Type     |   Length      |  Reserved (R) |      ATT      |
2630     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2631 
2632 */
2633 static int
dissect_pmip6_opt_att(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2634 dissect_pmip6_opt_att(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2635 {
2636     proto_tree* opt_tree;
2637     proto_item* ti;
2638     int option_len = tvb_reported_length(tvb)-2;
2639     int offset = 2;
2640     guint32 att;
2641 
2642     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_att, ett_pmip6_opt_att, &ti, option_len, PMIP6_ATT_LEN);
2643 
2644     proto_tree_add_item(opt_tree, hf_pmip6_att_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2645     offset++;
2646 
2647     att = tvb_get_guint8(tvb,offset);
2648     proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_att_att, tvb,
2649             offset, PMIP6_ATT_ATT_LEN, ENC_BIG_ENDIAN, &att);
2650     proto_item_append_text(ti, ": %s", val_to_str_ext_const(att, &pmip6_att_att_value_ext, "<unknown>"));
2651 
2652     return tvb_captured_length(tvb);
2653 }
2654 
2655 /* 25 Mobile Node Link-layer Identifier Option [RFC5213]  */
2656 /*
2657      0                   1                   2                   3
2658      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
2659     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2660     |   Type        |    Length     |          Reserved             |
2661     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2662     |                                                               |
2663     +                        Link-layer Identifier                  +
2664     .                              ...                              .
2665     |                                                               |
2666     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2667 
2668 */
2669 static int
dissect_pmip6_opt_mnlli(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2670 dissect_pmip6_opt_mnlli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2671 {
2672     proto_tree* opt_tree;
2673     proto_item* ti;
2674     int option_len = tvb_reported_length(tvb)-2;
2675     int offset = 2;
2676 
2677     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_mnlli, ett_pmip6_opt_mnlli, &ti, option_len, PMIP6_MNLLI_MIN_LEN);
2678 
2679     proto_tree_add_item(opt_tree, hf_mip6_opt_mnlli_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2680     offset += 2;
2681     proto_tree_add_item(opt_tree, hf_mip6_opt_mnlli_lli, tvb, offset, option_len-2, ENC_NA);
2682 
2683     return tvb_captured_length(tvb);
2684 }
2685 
2686 /* 26 Link-local Address Option [RFC5213   */
2687 /*
2688      0                   1                   2                   3
2689      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
2690                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2691                                     |   Type        |    Length     |
2692     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2693     |                                                               |
2694     +                                                               +
2695     |                                                               |
2696     +                  Link-local Address                           +
2697     |                                                               |
2698     +                                                               +
2699     |                                                               |
2700     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2701 
2702 */
2703 static int
dissect_pmip6_opt_lla(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2704 dissect_pmip6_opt_lla(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2705 {
2706     proto_tree* field_tree;
2707     proto_item* ti;
2708     int option_len = tvb_reported_length(tvb)-2;
2709     int offset = 2;
2710 
2711     field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_lla, ett_pmip6_opt_lla, &ti, option_len, PMIP6_LLA_LEN);
2712 
2713     proto_tree_add_item(field_tree, hf_pmip6_opt_lila_lla, tvb, offset, 16, ENC_NA);
2714 
2715     return tvb_captured_length(tvb);
2716 }
2717 
2718 /* 27 Timestamp */
2719 /*
2720      0                   1                   2                   3
2721      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
2722                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2723                                     |      Type     |   Length      |
2724     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2725     |                                                               |
2726     +                          Timestamp                            +
2727     |                                                               |
2728     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2729 
2730      Timestamp
2731 
2732          A 64-bit unsigned integer field containing a timestamp.  The
2733          value indicates the number of seconds since January 1, 1970,
2734          00:00 UTC, by using a fixed point format.  In this format, the
2735          integer number of seconds is contained in the first 48 bits of
2736          the field, and the remaining 16 bits indicate the number of
2737          1/65536 fractions of a second.
2738 
2739 */
2740 static int
dissect_pmip6_opt_ts(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2741 dissect_pmip6_opt_ts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2742 {
2743     proto_tree* opt_tree;
2744     proto_item* ti;
2745     int option_len = tvb_reported_length(tvb)-2;
2746     int offset = 2;
2747     char *str;
2748 
2749     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ts, ett_pmip6_opt_ts, &ti, option_len, PMIP6_TS_LEN);
2750 
2751     proto_tree_add_item_ret_time_string(opt_tree, hf_pmip6_timestamp, tvb, offset, 8, ENC_TIME_MIP6|ENC_BIG_ENDIAN, pinfo->pool, &str);
2752     proto_item_append_text(ti, ": %s", str);
2753 
2754     return tvb_captured_length(tvb);
2755 }
2756 
2757  /* 28 Restart Counter [RFC5847] */
2758 static int
dissect_pmip6_opt_rc(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2759 dissect_pmip6_opt_rc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2760 {
2761     proto_tree* opt_tree;
2762     proto_item* ti;
2763     int option_len = tvb_reported_length(tvb)-2;
2764     int offset = 2;
2765 
2766     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_rc, ett_pmip6_opt_rc, &ti, option_len, PMIP6_RC_LEN);
2767 
2768     proto_tree_add_item(opt_tree, hf_pmip6_rc, tvb,
2769             offset, PMIP6_RC_RC_LEN, ENC_BIG_ENDIAN);
2770 
2771     return tvb_captured_length(tvb);
2772 }
2773 
2774 /* 29 IPv4 Home Address [RFC5555]  */
2775 static int
dissect_pmip6_opt_ipv4ha(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2776 dissect_pmip6_opt_ipv4ha(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2777 {
2778     proto_tree* field_tree;
2779     proto_item* ti;
2780     int option_len = tvb_reported_length(tvb)-2;
2781     int offset = 2;
2782 
2783     field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4ha, ett_mip6_opt_ipv4ha, &ti, option_len, MIP6_IPV4HA_LEN);
2784 
2785     proto_tree_add_item(field_tree, hf_mip6_ipv4ha_preflen, tvb, offset, 1, ENC_BIG_ENDIAN);
2786     proto_tree_add_item(field_tree, hf_mip6_ipv4ha_p_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
2787     offset += 2;
2788 
2789     proto_tree_add_item(field_tree, hf_mip6_ipv4ha_ha, tvb,
2790             offset, MIP6_IPV4HA_HA_LEN, ENC_BIG_ENDIAN);
2791 
2792     return tvb_captured_length(tvb);
2793 }
2794 
2795 /* 30 IPv4 Address Acknowledgement [RFC5555] */
2796 static int
dissect_pmip6_opt_ipv4aa(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2797 dissect_pmip6_opt_ipv4aa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2798 {
2799     proto_tree* field_tree;
2800     proto_item* ti;
2801     int option_len = tvb_reported_length(tvb)-2;
2802     int offset = 2;
2803 
2804     field_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4aa, ett_mip6_opt_ipv4aa, &ti, option_len, MIP6_IPV4AA_LEN);
2805 
2806     proto_tree_add_item(field_tree, hf_mip6_ipv4aa_status, tvb,
2807             offset, MIP6_IPV4AA_STATUS_LEN, ENC_BIG_ENDIAN);
2808     offset += MIP6_IPV4AA_STATUS_LEN;
2809 
2810     proto_tree_add_item(field_tree, hf_mip6_ipv4ha_preflen, tvb,
2811             offset, MIP6_IPV4AA_PREFIXL_LEN, ENC_BIG_ENDIAN);
2812     offset += MIP6_IPV4AA_PREFIXL_LEN;
2813 
2814     proto_tree_add_item(field_tree, hf_mip6_ipv4ha_ha, tvb,
2815             offset, MIP6_IPV4AA_HA_LEN, ENC_BIG_ENDIAN);
2816 
2817     return tvb_captured_length(tvb);
2818 }
2819 
2820 /* 31 NAT Detection [RFC5555]  */
2821 /*
2822      0                   1                   2                   3
2823      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
2824     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2825     |     Type      |    Length     |F|          Reserved           |
2826     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2827     |                      Refresh time                             |
2828     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2829 
2830 */
2831 static int
dissect_pmip6_opt_natd(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2832 dissect_pmip6_opt_natd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2833 {
2834     proto_tree* opt_tree;
2835     proto_item* ti;
2836     int option_len = tvb_reported_length(tvb)-2;
2837     int offset = 2;
2838     proto_item *item;
2839     guint32     refresh_time;
2840 
2841     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_natd, ett_mip6_opt_natd, &ti, option_len, MIP6_NATD_LEN);
2842 
2843     proto_tree_add_item(opt_tree, hf_mip6_opt_natd_f_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
2844     proto_tree_add_item(opt_tree, hf_mip6_opt_natd_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2845     offset += 2;
2846     item = proto_tree_add_item_ret_uint(opt_tree, hf_mip6_opt_natd_refresh_t, tvb, offset, 4, ENC_BIG_ENDIAN, &refresh_time);
2847     if (refresh_time == 0) {
2848         proto_item_append_text(item, " (Ignore)");
2849     }
2850     if (refresh_time == 0xffffffff) {
2851         proto_item_append_text(item, " (keepalives are not needed, no NAT detected)");
2852     }
2853 
2854     return tvb_captured_length(tvb);
2855 }
2856 
2857 /* 32 IPv4 Care-of Address [RFC5555]  */
2858 /*
2859      0                   1                   2                   3
2860      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
2861     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2862     |   Type        |   Length      |         Reserved              |
2863     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2864     |                     IPv4 Care-of address                      |
2865     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2866 
2867 */
2868 
2869 static int
dissect_pmip6_opt_ipv4coa(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2870 dissect_pmip6_opt_ipv4coa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2871 {
2872     proto_tree* opt_tree;
2873     proto_item* ti;
2874     int option_len = tvb_reported_length(tvb)-2;
2875     int offset = 2;
2876 
2877     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4coa, ett_mip6_opt_ipv4coa, &ti, option_len, MIP6_IPV4COA_LEN);
2878 
2879     proto_tree_add_item(opt_tree, hf_mip6_opt_ipv4coa_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2880     offset += 2;
2881     proto_tree_add_item(opt_tree, hf_mip6_opt_ipv4coa_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2882 
2883     return tvb_captured_length(tvb);
2884 }
2885 
2886 /* 33 GRE Key Option [RFC5845]  */
2887 /*
2888      0                   1                   2                   3
2889      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
2890     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2891     |      Type     |   Length      |           Reserved            |
2892     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2893     |                      GRE Key Identifier                       |
2894     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2895 
2896 */
2897 static int
dissect_pmip6_opt_grek(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2898 dissect_pmip6_opt_grek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2899 {
2900     proto_tree* opt_tree;
2901     proto_item* ti;
2902     int option_len = tvb_reported_length(tvb)-2;
2903     int offset = 2;
2904     guint32 key;
2905 
2906     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_grek, ett_pmip6_opt_grek, &ti, option_len, PMIP6_GREK_MIN_LEN);
2907 
2908     proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_reserved, tvb,
2909             offset, 2, ENC_BIG_ENDIAN);
2910 
2911     if (option_len == 6) {
2912         offset += 2;
2913         proto_tree_add_item_ret_uint(opt_tree, hf_pmip6_gre_key, tvb,
2914                             offset, PMIP6_GREK_ID_LEN, ENC_BIG_ENDIAN, &key);
2915         proto_item_append_text(ti, ": %u", key);
2916     }
2917 
2918     return tvb_captured_length(tvb);
2919 }
2920 
2921 /* 34 Mobility Header IPv6 Address/Prefix [RFC5568]
2922      0                   1                   2                   3
2923      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
2924     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2925     |     Type      |   Length      | Option-Code   | Prefix Length |
2926     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2927     |                                                               |
2928     +                                                               +
2929     |                                                               |
2930     +                    IPv6 Address/Prefix                        +
2931     |                                                               |
2932     +                                                               +
2933     |                                                               |
2934     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2935 
2936  */
2937 
2938 static int
dissect_pmip6_opt_mhipv6ap(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2939 dissect_pmip6_opt_mhipv6ap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
2940 {
2941     proto_tree* opt_tree;
2942     proto_item* ti;
2943     int option_len = tvb_reported_length(tvb)-2;
2944     int offset = 2;
2945     guint8 prefix_l;
2946 
2947     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mhipv6ap, ett_pmip6_opt_mhipv6ap, &ti, option_len, MIP6_MHIPV6AP_LEN);
2948 
2949     proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_opt_code, tvb, offset, 1, ENC_BIG_ENDIAN);
2950     offset++;
2951 
2952     prefix_l = tvb_get_guint8(tvb,offset);
2953     proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_prefix_l, tvb, offset, 1, ENC_BIG_ENDIAN);
2954     offset++;
2955 
2956     proto_tree_add_item(opt_tree, hf_mip6_opt_mhipv6ap_ipv6_address, tvb, offset, 16, ENC_NA);
2957     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));
2958     proto_item_append_text(ti, "/%u", prefix_l);
2959     proto_item_set_generated(ti);
2960 
2961     return tvb_captured_length(tvb);
2962 }
2963 /* 35 Binding Identifier [RFC5648]  */
2964 /*
2965      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
2966                                     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2967                                     |   Type = 35   |     Length    |
2968     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2969     |       Binding ID (BID)        |     Status    |H|   Reserved  |
2970     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------------------------+
2971     +                                                               +
2972     :                 IPv4 or IPv6 care-of address (CoA)            :
2973     +                                                               +
2974     +---------------------------------------------------------------+
2975 
2976 */
2977 static int
dissect_pmip6_opt_bi(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)2978 dissect_pmip6_opt_bi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2979 {
2980     proto_tree* opt_tree;
2981     proto_item* ti;
2982     int option_len = tvb_reported_length(tvb)-2;
2983     int offset = 2;
2984 
2985     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_bi, ett_pmip6_opt_bi, &ti, option_len, MIP6_BI_MIN_LEN);
2986 
2987     proto_tree_add_item(opt_tree, hf_mip6_opt_bi_bid, tvb, offset, 2, ENC_BIG_ENDIAN);
2988     offset += 2;
2989 
2990     proto_tree_add_item(opt_tree, hf_mip6_opt_bi_status, tvb, offset, 1, ENC_BIG_ENDIAN);
2991     offset++;
2992 
2993     proto_tree_add_item(opt_tree, hf_mip6_bi_h_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2994     offset++;
2995 
2996     if (option_len == 8) {
2997         /* IPv4 addr */
2998         proto_tree_add_item(opt_tree, hf_mip6_bi_coa_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2999     } else if (option_len == 20) {
3000         /* Ipv6 Addr */
3001         proto_tree_add_item(opt_tree, hf_mip6_bi_coa_ipv6, tvb, offset, 16, ENC_NA);
3002     }
3003 
3004     return tvb_captured_length(tvb);
3005 }
3006 
3007 
3008 /* 36 IPv4 Home Address Request [RFC5844] */
3009 /*
3010      0                   1                   2                   3
3011      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
3012     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3013     |     Type      |   Length      |Prefix-len |      Reserved     |
3014     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3015     |                     IPv4 home address                         |
3016     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3017 
3018 */
3019 static int
dissect_pmip6_opt_ipv4hareq(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3020 dissect_pmip6_opt_ipv4hareq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3021 {
3022     proto_tree* opt_tree;
3023     proto_item* ti;
3024     int option_len = tvb_reported_length(tvb)-2;
3025     int offset = 2;
3026     proto_item *item;
3027     guint32     dword;
3028 
3029     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4hareq, ett_mip6_opt_ipv4hareq, &ti, option_len, MIP6_IPV4HAREQ_LEN);
3030 
3031     proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_preflen, tvb,
3032             offset, 1, ENC_BIG_ENDIAN);
3033     offset++;
3034 
3035     /* Reserved */
3036     proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3037     offset++;
3038 
3039     /* Field is an IPv4 address, so can't be retrieved by proto_tree_add_item_ret_uint */
3040     dword = tvb_get_ntohl(tvb,offset);
3041     item = proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_ha, tvb,
3042             offset, MIP6_IPV4HAREQ_HA_LEN, ENC_BIG_ENDIAN);
3043     if (dword == 0) {
3044         proto_item_append_text(item, " - Request that the local mobility anchor perform the address allocation");
3045     }
3046     proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));
3047 
3048     return tvb_captured_length(tvb);
3049 }
3050 
3051 /* 37 IPv4 Home Address Reply [RFC5844] */
3052 /*
3053      0                   1                   2                   3
3054      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
3055     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3056     |     Type      |    Length     |   Status      |Pref-len   |Res|
3057     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3058     |                      IPv4 home address                        |
3059     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3060 
3061 */
3062 static int
dissect_pmip6_opt_ipv4harep(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3063 dissect_pmip6_opt_ipv4harep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3064 {
3065     proto_tree* opt_tree;
3066     proto_item* ti;
3067     int option_len = tvb_reported_length(tvb)-2;
3068     int offset = 2;
3069     guint32 status;
3070 
3071     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4harep, ett_mip6_opt_ipv4harep, &ti, option_len, MIP6_IPV4HAREP_LEN);
3072 
3073     proto_tree_add_item_ret_uint(opt_tree, hf_mip6_ipv4aa_status, tvb,
3074             offset, MIP6_IPV4HAREP_STATUS_LEN, ENC_BIG_ENDIAN, &status);
3075     proto_item_append_text(ti, ": %s ", val_to_str_const(status, pmip6_ipv4aa_status_values, "<unknown>"));
3076     offset++;
3077 
3078     proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_preflen, tvb,
3079             offset, MIP6_IPV4HAREP_PREFIXL_LEN, ENC_BIG_ENDIAN);
3080     offset++;
3081 
3082     proto_tree_add_item(opt_tree, hf_mip6_ipv4ha_ha, tvb,
3083             offset, MIP6_IPV4HAREP_HA_LEN, ENC_BIG_ENDIAN);
3084 
3085     proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));
3086 
3087     return tvb_captured_length(tvb);
3088 }
3089 
3090 /* 38 IPv4 Default-Router Address [RFC5844] */
3091 /*
3092      0                   1                   2                   3
3093      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
3094     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3095     |      Type     |   Length      |         Reserved (R)          |
3096     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3097     |                  IPv4 Default-Router Address                  |
3098     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3099 
3100 */
3101 static int
dissect_pmip6_opt_ipv4dra(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3102 dissect_pmip6_opt_ipv4dra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3103 {
3104     proto_tree* opt_tree;
3105     proto_item* ti;
3106     int option_len = tvb_reported_length(tvb)-2;
3107     int offset = 2;
3108 
3109     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4dra, ett_mip6_opt_ipv4dra, &ti, option_len, MIP6_IPV4DRA_LEN);
3110 
3111     proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_reserved, tvb,
3112             offset, 2, ENC_BIG_ENDIAN);
3113     offset += 2;
3114 
3115     proto_tree_add_item(opt_tree, hf_mip6_ipv4dra_dra, tvb,
3116             offset, MIP6_IPV4DRA_DRA_LEN, ENC_BIG_ENDIAN);
3117 
3118     proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));
3119 
3120     return tvb_captured_length(tvb);
3121 }
3122 
3123 /* 39 IPv4 DHCP Support Mode [RFC5844] */
3124 /*
3125      0                   1                   2                   3
3126      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
3127     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3128     |      Type     |   Length      |    Reserved (R)             |S|
3129     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3130 
3131 */
3132 
3133 static int
dissect_pmip6_opt_ipv4dsm(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3134 dissect_pmip6_opt_ipv4dsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3135 {
3136     proto_tree* opt_tree;
3137     proto_item* ti;
3138     int option_len = tvb_reported_length(tvb)-2;
3139     int offset = 2;
3140 
3141     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_ipv4dsm, ett_mip6_opt_ipv4dsm, &ti, option_len, MIP6_IPV4DSM_LEN);
3142 
3143     proto_tree_add_item(opt_tree, hf_mip6_ipv4dsm_reserved, tvb,
3144             offset, 2, ENC_BIG_ENDIAN);
3145     proto_tree_add_item(opt_tree, hf_mip6_ipv4dsm_s_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
3146 
3147     return tvb_captured_length(tvb);
3148 }
3149 
3150 /* 40 Context Request Option [RFC5949] */
3151 /*
3152      0                   1                   2                   3
3153      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
3154     +---------------+---------------+---------------+---------------+
3155     |  Option-Type  | Option-Length |           Reserved            |
3156     +---------------+---------------+-------------------------------+
3157     |  Req-type-1   | Req-length-1  |  Req-type-2   | Req-length-2  |
3158     +---------------------------------------------------------------+
3159     |  Req-type-3   | Req-length-3  |          Req-option-3         |
3160     +---------------------------------------------------------------+
3161     |                              ...                              |
3162 
3163 */
3164 
3165 static int
dissect_pmip6_opt_cr(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3166 dissect_pmip6_opt_cr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3167 {
3168     proto_tree* opt_tree;
3169     proto_item* ti;
3170     int option_len = tvb_reported_length(tvb)-2;
3171     int offset = 2;
3172     guint8  req_type, req_length;
3173     guint32 vendorid;
3174 
3175     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_cr, ett_mip6_opt_cr, &ti, option_len, MIP6_CR_MIN_LEN);
3176 
3177     proto_tree_add_item(opt_tree, hf_mip6_cr_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3178     offset += 2;
3179 
3180     while (offset-2 < option_len) {
3181         req_type = tvb_get_guint8(tvb,offset);
3182         proto_tree_add_item(opt_tree, hf_mip6_cr_req_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3183         offset++;
3184 
3185         req_length = tvb_get_guint8(tvb,offset);
3186         proto_tree_add_item(opt_tree, hf_mip6_cr_req_length, tvb, offset, 1, ENC_BIG_ENDIAN);
3187         offset++;
3188 
3189         if (req_length == 0)
3190             continue;
3191 
3192         if (req_type == MIP6_VSM) {
3193             /* vendor specific option */
3194             proto_tree_add_item_ret_uint(opt_tree, hf_mip6_vsm_vid, tvb, offset, 4, ENC_BIG_ENDIAN, &vendorid);
3195             if (vendorid == VENDOR_THE3GPP) {
3196                 proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype_3gpp, tvb, offset+4, 1, ENC_BIG_ENDIAN);
3197             }
3198             else {
3199                 proto_tree_add_item(opt_tree, hf_mip6_vsm_subtype, tvb, offset+4, 1, ENC_BIG_ENDIAN);
3200             }
3201         }
3202         else {
3203             proto_tree_add_item(opt_tree, hf_mip6_vsm_req_data, tvb, offset, req_length, ENC_NA);
3204         }
3205         offset += req_length;
3206     }
3207 
3208     return tvb_captured_length(tvb);
3209 }
3210 
3211 /* 41 Local Mobility Anchor Address Option [RFC5949] */
3212 /*
3213      0                   1                   2                   3
3214      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
3215     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3216     |  Option-Type  | Option-Length |  Option-Code  |   Reserved    |
3217     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3218     |              Local Mobility Anchor Address ...                |
3219 
3220 */
3221 static int
dissect_pmip6_opt_lmaa(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3222 dissect_pmip6_opt_lmaa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3223 {
3224     proto_tree* opt_tree;
3225     proto_item* ti;
3226     int option_len = tvb_reported_length(tvb)-2;
3227     int offset = 2;
3228     guint8 opt_code;
3229 
3230     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_lmaa, ett_mip6_opt_lmaa, &ti, option_len, MIP6_LMAA_MIN_LEN);
3231 
3232     opt_code = tvb_get_guint8(tvb,offset);
3233     proto_tree_add_item(opt_tree, hf_mip6_lmaa_opt_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3234     offset += 1;
3235 
3236     proto_tree_add_item(opt_tree, hf_mip6_lmaa_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3237     offset += 1;
3238 
3239     if (opt_code == 1) {
3240         /* Ipv6 Addr */
3241         proto_tree_add_item(opt_tree, hf_mip6_lmaa_ipv6, tvb, offset, 16, ENC_NA);
3242         proto_item_append_text(ti, ": %s", tvb_ip6_to_str(pinfo->pool, tvb,offset));
3243     }else if (opt_code == 2) {
3244         /* IPv4 addr */
3245         proto_tree_add_item(opt_tree, hf_mip6_lmaa_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
3246         proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb,offset));
3247 
3248     }
3249 
3250     return tvb_captured_length(tvb);
3251 }
3252 
3253 static int
dissect_pmip6_opt_recap(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3254 dissect_pmip6_opt_recap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3255 {
3256     proto_tree* opt_tree;
3257     proto_item* ti;
3258     int option_len = tvb_reported_length(tvb)-2;
3259     int offset = 2;
3260 
3261     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_recap, ett_mip6_opt_recap, &ti, option_len, MIP6_RECAP_LEN);
3262 
3263     proto_tree_add_item(opt_tree, hf_mip6_opt_recap_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3264 
3265     return tvb_captured_length(tvb);
3266 }
3267 
3268 static int
dissect_pmip6_opt_redir(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3269 dissect_pmip6_opt_redir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3270 {
3271     proto_tree* opt_tree;
3272     proto_item* ti;
3273     int option_len = tvb_reported_length(tvb)-2;
3274     int offset = 2;
3275     guint16 flag;
3276 
3277     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_redir, ett_mip6_opt_redir, &ti, option_len, MIP6_REDIR_MIN_LEN);
3278 
3279     proto_tree_add_item(opt_tree, hf_mip6_opt_redir_k, tvb, offset, 2, ENC_BIG_ENDIAN);
3280     proto_tree_add_item(opt_tree, hf_mip6_opt_redir_n, tvb, offset, 2, ENC_BIG_ENDIAN);
3281     proto_tree_add_item(opt_tree, hf_mip6_opt_redir_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3282     flag = tvb_get_ntohs(tvb ,offset);
3283     offset += 2;
3284 
3285     if (flag & MIP6_REDIR_FLAG_K) {
3286         proto_tree_add_item(opt_tree, hf_mip6_opt_redir_addr_r2LMA_ipv6, tvb, offset, 16, ENC_NA);
3287         offset += 16;
3288     }
3289 
3290     if (flag & MIP6_REDIR_FLAG_N) {
3291         proto_tree_add_item(opt_tree, hf_mip6_opt_redir_addr_r2LMA_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
3292         /*offset += 4;*/
3293     }
3294 
3295     return tvb_captured_length(tvb);
3296 }
3297 
3298 static int
dissect_pmip6_opt_load_inf(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3299 dissect_pmip6_opt_load_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3300 {
3301     proto_tree* opt_tree;
3302     proto_item* ti;
3303     int option_len = tvb_reported_length(tvb)-2;
3304     int offset = 2;
3305 
3306     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);
3307 
3308     proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
3309     offset += 2;
3310     proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_sessions_in_use, tvb, offset, 4, ENC_BIG_ENDIAN);
3311     offset += 4;
3312     proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_maximum_sessions, tvb, offset, 4, ENC_BIG_ENDIAN);
3313     offset += 4;
3314     proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_used_capacity, tvb, offset, 4, ENC_BIG_ENDIAN);
3315     offset += 4;
3316     proto_tree_add_item(opt_tree, hf_mip6_opt_load_inf_maximum_capacity, tvb, offset, 4, ENC_BIG_ENDIAN);
3317 
3318     return tvb_captured_length(tvb);
3319 }
3320 
3321 static int
dissect_pmip6_opt_alt_ip4(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3322 dissect_pmip6_opt_alt_ip4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3323 {
3324     proto_tree* opt_tree;
3325     proto_item* ti;
3326     int option_len = tvb_reported_length(tvb)-2;
3327     int offset = 2;
3328 
3329     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);
3330 
3331     proto_tree_add_item(opt_tree, hf_mip6_opt_alt_ip4, tvb, offset, 4, ENC_BIG_ENDIAN);
3332 
3333     return tvb_captured_length(tvb);
3334 }
3335 /* RFC 6602
3336     The type value for this option is 50.
3337 
3338      0                   1                   2                   3
3339      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
3340     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3341     |      Type     |   Length      |  Sub-type   |    Reserved     |
3342     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3343     |                  Mobile Node Group Identifier                 |
3344     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3345 
3346  */
3347 
3348 static int
dissect_pmip6_opt_mng(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3349 dissect_pmip6_opt_mng(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3350 {
3351     proto_tree* opt_tree;
3352     proto_item* ti;
3353     int option_len = tvb_reported_length(tvb)-2;
3354     int offset = 2;
3355     proto_item *item;
3356     guint32     mng_id;
3357 
3358     opt_tree = mip6_fixed_option_header(tree, pinfo, tvb, proto_mip6_option_mng, ett_mip6_opt_mng, &ti, option_len, MIP6_MNG_LEN);
3359 
3360     proto_tree_add_item(opt_tree, hf_mip6_opt_mng_sub_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3361     offset++;
3362     proto_tree_add_item(opt_tree, hf_mip6_opt_mng_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3363     offset++;
3364     item = proto_tree_add_item_ret_uint(opt_tree, hf_mip6_opt_mng_mng_id, tvb, offset, 4, ENC_BIG_ENDIAN, &mng_id);
3365     if (mng_id == 1) {
3366         proto_item_append_text(item, " - ALL-SESSIONS");
3367     }
3368 
3369     return tvb_captured_length(tvb);
3370 }
3371 
3372 /*
3373 11.1.  MAG IPv6 Address
3374 
3375    The MAG IPv6 address mobility option contains the IPv6 address of a
3376    MAG involved in localized routing.  The MAG IPv6 address option has
3377    an alignment requirement of 8n+4.
3378 
3379      0                   1                   2                   3
3380      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
3381     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3382     |      Type     |   Length      |   Reserved    | Address Length|
3383     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3384     |                                                               |
3385     +                                                               +
3386     |                                                               |
3387     +                       MAG IPv6 Address                        +
3388     |                                                               |
3389     +                                                               +
3390     |                                                               |
3391     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3392 */
3393 static int
dissect_pmip6_opt_mag_ipv6(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3394 dissect_pmip6_opt_mag_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3395 {
3396     proto_tree* opt_tree;
3397     proto_item* ti;
3398     int option_len = tvb_reported_length(tvb)-2;
3399     int offset = 2;
3400 
3401     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);
3402 
3403     proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
3404     offset++;
3405     proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
3406     offset++;
3407     proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address, tvb, offset, 16, ENC_NA);
3408 
3409     return tvb_captured_length(tvb);
3410 }
3411 
3412 /*
3413     0                   1                   2                   3
3414     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
3415    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3416    |      Type     |   Length      |
3417    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3418                   ...      ANI Sub-option(s) ...                   ~
3419    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3420 
3421 3.1.  Format of the Access Network Identifier Sub-Option
3422 
3423    The Access Network Identifier sub-options are used for carrying
3424    information elements related to the access network to which the
3425    mobile node is attached.  These sub-options can be included in the
3426    Access Network Identifier option defined in Section 3.  The format of
3427    this sub-option is as follows:
3428 
3429     0                   1                   2                   3
3430     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
3431    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3432    |    ANI Type   | ANI Length    |         Option Data           ~
3433    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3434 
3435    ANI Type:  8-bit unsigned integer indicating the type of the Access
3436       Network Identifier sub-option.  This specification defines the
3437       following types:
3438 
3439       0 -  Reserved
3440 
3441       1 -  Network-Identifier sub-option
3442 
3443       2 -  Geo-Location sub-option
3444 
3445       3 -  Operator-Identifier sub-option
3446 
3447 */
3448 
3449 static const value_string mmip6_opt_acc_net_id_sub_opt_vals[] = {
3450     {  0,    "Reserved"},
3451     {  1,    "Network-Identifier"},
3452     {  2,    "Geo-Location"},
3453     {  3,    "Operator-Identifier"},
3454     {  0,    NULL}
3455 };
3456 
3457 static const true_false_string mip6_opt_acc_net_id_sub_opt_e_bit_value = {
3458     "UTF-8",
3459     "Encoding is undefined"
3460 };
3461 
3462 static const value_string mip6_opt_acc_net_id_sub_opt_op_id_type[] = {
3463     {  0,    "Reserved"},
3464     {  1,    "Private Enterprise Number (PEN)"},
3465     {  2,    "Realm of the operator"},
3466     {  0,    NULL}
3467 };
3468 
3469 static float
degrees_convert_fixed_to_float(guint value)3470 degrees_convert_fixed_to_float(guint value)
3471 {
3472     if (!value)
3473         return 0;
3474 
3475     /*
3476      * RFC 6757 section 3.1.2:
3477      *
3478      * "A 24-bit {latitude,longitude} degree value encoded as a two's
3479      * complement, fixed point number with 9 whole bits."
3480      *
3481      * "9 whole bits" presumably includes the sign bit; 1 sign bit
3482      * plus 8 more bits supports values between -256 and 255, which
3483      * is sufficient to cover -180 to 180.  9 bits plus a sign bit
3484      * would waste a bit.
3485      *
3486      * So we have 1 sign bit plus 8 bits of integral value, followed
3487      * by a binary point, followed by 15 bits of fractional value.
3488      * That means that to get the value, we treat the fixed-point
3489      * number as an integer and divide it by 2^15 = 32768.
3490      */
3491 
3492     /* Sign-extend to 32 bits */
3493     if (value & 0x800000) {
3494         value |= 0xFF000000;
3495     }
3496 
3497     /* Cast to a signed value, and divide by 32768; do a floating-point divide */
3498     return ((float)(gint)value) / 32768.0f;
3499 }
3500 
3501 static void
degrees_base_custom(gchar * str,guint degrees)3502 degrees_base_custom(gchar *str, guint degrees)
3503 {
3504     g_snprintf(str, ITEM_LABEL_LENGTH, "%f", degrees_convert_fixed_to_float(degrees) );
3505 }
3506 
3507 static int
dissect_pmip6_opt_acc_net_id(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3508 dissect_pmip6_opt_acc_net_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3509 {
3510     proto_tree* opt_tree;
3511     proto_item *ti;
3512     proto_tree *subopt_tree;
3513     gint16 sub_opt_len;
3514     guint8 sub_opt, e_bit, net_name_len, ap_name_len;
3515     const guint8 *ap_name;
3516     int option_len = tvb_reported_length(tvb)-2;
3517     int offset = 2;
3518     gint offset_end = tvb_reported_length(tvb);
3519 
3520     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);
3521 
3522     while(offset < offset_end) {
3523         ti = proto_tree_add_item(opt_tree, hf_mip6_opt_acc_net_id_sub, tvb, offset, 2, ENC_NA);
3524         subopt_tree = proto_item_add_subtree(ti, ett_mip6_sub_opt_acc_net_id);
3525 
3526         proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt, tvb, offset, 1, ENC_BIG_ENDIAN);
3527         sub_opt = tvb_get_guint8(tvb,offset);
3528         offset++;
3529 
3530         proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3531         sub_opt_len = tvb_get_guint8(tvb,offset);
3532         offset++;
3533 
3534         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);
3535         proto_item_set_len(ti, sub_opt_len+2);
3536 
3537         switch(sub_opt){
3538         case 1: /* Network-Identifier */
3539             /*
3540                 0                   1                   2                   3
3541                 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
3542                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3543                | ANI Type=1    |  ANI Length   |E|   Reserved  | Net-Name Len  |
3544                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3545                |                     Network Name (e.g., SSID or PLMNID)       ~
3546                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3547                | AP-Name Len   |        Access-Point Name                      ~
3548                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3549             */
3550             e_bit = tvb_get_guint8(tvb,offset);
3551             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_e_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
3552             offset++;
3553 
3554             net_name_len = tvb_get_guint8(tvb,offset);
3555             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_net_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3556             offset++;
3557 
3558             if(e_bit == 0x80){
3559                 const guint8* name;
3560                 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);
3561                 proto_item_append_text(ti, " Network Name: %s", name);
3562             }else{
3563                 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);
3564             };
3565             offset = offset+net_name_len;
3566 
3567             ap_name_len = tvb_get_guint8(tvb,offset);
3568             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_ap_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3569             offset++;
3570 
3571             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);
3572             proto_item_append_text(ti, " AP Name: %s", ap_name);
3573 
3574             offset = offset+ap_name_len;
3575             break;
3576 
3577         case 2: /* Geo-Location */
3578             /*
3579                 0                   1                   2                   3
3580                 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
3581                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3582                |  ANI Type=2   | ANI Length=6  |       Latitude Degrees
3583                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3584                                |              Longitude Degrees                |
3585                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3586             */
3587             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees, tvb, offset, 3, ENC_BIG_ENDIAN);
3588             offset +=3;
3589 
3590             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees, tvb, offset, 3, ENC_BIG_ENDIAN);
3591             offset +=3;
3592             break;
3593 
3594         case 3: /* Operator-Identifier */
3595             /*
3596                 0                   1                   2                   3
3597                 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
3598                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3599                | ANI Type=3    |    ANI Length   |   Op-ID Type  |
3600                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3601                                         Operator-Identifier                    ~
3602                +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3603             */
3604             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_op_id_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3605             offset += 1;
3606 
3607             proto_tree_add_item(subopt_tree, hf_mip6_opt_acc_net_id_sub_opt_op_id, tvb, offset, sub_opt_len - 1, ENC_NA);
3608             offset = offset + sub_opt_len - 1;
3609 
3610             break;
3611         default:
3612             proto_tree_add_expert(subopt_tree, pinfo, &ei_mip6_ani_type_not_dissected, tvb, offset, sub_opt_len);
3613             offset = offset + sub_opt_len;
3614             break;
3615         }
3616     }
3617 
3618     return tvb_captured_length(tvb);
3619 }
3620 
3621 /* 55 Delegated Mobile Network Prefix Option [RFC7148]
3622 
3623     0                   1                   2                   3
3624     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
3625     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3626     |      Type     |   Length      |V|  Reserved   | Prefix Length |
3627     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3628     |                                                               |
3629     +                                                               +
3630     |                                                               |
3631     .                                                               .
3632     +           IPv4 or IPv6 Delegated Mobile Network Prefix        +
3633     |                         (DMNP)                                |
3634     +                                                               +
3635     |                                                               |
3636     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3637 */
3638 
3639 static int
dissect_mip6_opt_dmnp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)3640 dissect_mip6_opt_dmnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3641 {
3642     proto_tree* opt_tree;
3643     proto_item* ti;
3644     int option_len = tvb_reported_length(tvb)-2;
3645     int offset = 2;
3646     guint8 prefix_len;
3647 
3648     opt_tree = mip6_var_option_header(tree, pinfo, tvb, proto_mip6_option_dmnp, ett_mip6_opt_dmnp, &ti, option_len, MIP6_DMNP_MIN_LEN);
3649 
3650     proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_v_flag, tvb,
3651                         offset, 1, ENC_BIG_ENDIAN);
3652     proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_reserved, tvb,
3653                         offset, 1, ENC_BIG_ENDIAN);
3654 
3655     offset++;
3656     proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_prefix_len, tvb,
3657                         offset, 1, ENC_BIG_ENDIAN);
3658     prefix_len = tvb_get_guint8(tvb, offset);
3659 
3660     offset++;
3661 
3662     switch (option_len) {
3663     case 6:
3664         /* IPv4 Prefix */
3665         proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_dmnp_ipv4, tvb,
3666                             offset, 4, ENC_BIG_ENDIAN);
3667         proto_item_append_text(ti, ": %s/%u",
3668                                tvb_ip_to_str(pinfo->pool, tvb, offset), prefix_len);
3669             break;
3670 
3671     case 18:
3672         /* IPv6 Prefix */
3673         proto_tree_add_item(opt_tree, hf_mip6_opt_dmnp_dmnp_ipv6, tvb,
3674                             offset, 16, ENC_NA);
3675         proto_item_append_text(ti, ": %s/%u",
3676                                tvb_ip6_to_str(pinfo->pool, tvb, offset), prefix_len);
3677         break;
3678 
3679     default:
3680         proto_tree_add_expert(opt_tree, pinfo, &ei_mip6_opt_len_invalid,
3681                               tvb, offset, -1);
3682         break;
3683     }
3684 
3685     return tvb_captured_length(tvb);
3686 }
3687 
3688 /* Like "dissect_ip_tcp_options()", but assumes the length of an option
3689  * *doesn't* include the type and length bytes.  The option parsers,
3690  * however, are passed a length that *does* include them.
3691  */
3692 static void
dissect_mipv6_options(tvbuff_t * tvb,int offset,guint length,int eol,packet_info * pinfo,proto_tree * opt_tree)3693 dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
3694               int eol, packet_info *pinfo, proto_tree *opt_tree)
3695 {
3696     guchar          opt;
3697     const char     *name;
3698     guint           len;
3699     dissector_handle_t option_dissector;
3700     tvbuff_t       *next_tvb;
3701     proto_item     *ti;
3702     proto_tree     *unknown_tree;
3703 
3704     while ((gint)length > 0) {
3705         opt = tvb_get_guint8(tvb, offset);
3706         --length;      /* account for type byte */
3707 
3708         if (opt == MIP6_PAD1) {
3709           /* We assume that the only option with no length is Pad1 option,
3710              so that we can treat unknown options as having a minimum length of 2,
3711              and at least be able to move on to the next option by using the length in the option. */
3712 
3713             proto_tree_add_item(opt_tree, proto_mip6_option_pad1, tvb, offset, 1, ENC_NA);
3714             offset += 1;
3715         } else {
3716             option_dissector = dissector_get_uint_handle(mip6_option_table, opt);
3717             if (option_dissector == NULL) {
3718                 name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
3719             } else {
3720                 name = dissector_handle_get_short_name(option_dissector);
3721             }
3722 
3723             /* Option has a length. Is it in the packet? */
3724             if (length == 0) {
3725                 /* Bogus - packet must at least include
3726                  * option code byte and length byte!
3727                  */
3728                 proto_tree_add_expert_format(opt_tree, pinfo, &ei_mip6_opt_len_invalid, tvb, offset, 1,
3729                         "%s (length byte past end of options)", name);
3730                 return;
3731             }
3732 
3733             len = tvb_get_guint8(tvb, offset + 1);  /* Size specified in option */
3734             --length;    /* account for length byte */
3735 
3736             if (len > length) {
3737                 /* Bogus - option goes past the end of the header. */
3738                 proto_tree_add_expert_format(opt_tree, pinfo, &ei_mip6_opt_len_invalid, tvb, offset, length,
3739                         "%s (option length = %u byte%s says option goes past end of options)",
3740                         name, len, plurality(len, "", "s"));
3741                 return;
3742             }
3743 
3744             if (option_dissector == NULL) {
3745                 unknown_tree = proto_tree_add_subtree(opt_tree, tvb, offset, len+2, ett_mip6_opt_unknown, &ti, name);
3746                 proto_tree_add_item(unknown_tree, hf_mip6_mobility_opt, tvb, offset, 1, ENC_BIG_ENDIAN);
3747                 proto_tree_add_item(unknown_tree, hf_mip6_opt_len, tvb, 1, 1, ENC_NA);
3748 
3749                 expert_add_info(pinfo, ti, &ei_mip6_ie_not_dissected);
3750             } else {
3751                 next_tvb = tvb_new_subset_length(tvb, offset, len+2);
3752                 call_dissector(option_dissector, next_tvb, pinfo, opt_tree);
3753             }
3754 
3755             length -= len;
3756             offset += (len + 2);
3757         }
3758 
3759         if (opt == eol)
3760             break;
3761     }
3762 }
3763 
3764 /* Function to dissect mobility options */
3765 static int
dissect_mip6_options(tvbuff_t * tvb,proto_tree * mip6_tree,int offset,int len,packet_info * pinfo)3766 dissect_mip6_options(tvbuff_t *tvb, proto_tree *mip6_tree, int offset, int len,
3767              packet_info *pinfo)
3768 {
3769     proto_tree *opts_tree;
3770 
3771     opts_tree = proto_tree_add_subtree(mip6_tree, tvb, offset, len, ett_mip6, NULL, "Mobility Options");
3772 
3773     dissect_mipv6_options(tvb, offset, len, -1, pinfo, opts_tree);
3774 
3775     return len;
3776 }
3777 
3778 /* Function that dissects the whole MIPv6 packet */
3779 static int
dissect_mip6(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)3780 dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3781 {
3782     proto_tree *mip6_tree, *root_tree;
3783     guint8      type, pproto;
3784     guint       len, offset = 0, start_offset = offset;
3785     proto_item *ti, *header_item;
3786     tvbuff_t   *next_tvb;
3787 
3788     /* Make entries in Protocol column and Info column on summary display */
3789     col_set_str(pinfo->cinfo, COL_PROTOCOL, "MIPv6");
3790     col_clear(pinfo->cinfo, COL_INFO);
3791 
3792     len = (tvb_get_guint8(tvb, MIP6_HLEN_OFF) + 1) * 8;
3793     pproto = tvb_get_guint8(tvb, MIP6_PROTO_OFF);
3794 
3795     root_tree = p_ipv6_pinfo_select_root(pinfo, tree);
3796     p_ipv6_pinfo_add_len(pinfo, len);
3797 
3798     ti = proto_tree_add_item(root_tree, proto_mip6, tvb, 0, len, ENC_NA);
3799     mip6_tree = proto_item_add_subtree(ti, ett_mip6);
3800 
3801     /* Process header fields */
3802     proto_tree_add_item(mip6_tree, hf_mip6_proto, tvb,
3803             MIP6_PROTO_OFF, 1, ENC_BIG_ENDIAN);
3804 
3805     header_item = proto_tree_add_uint_format_value(mip6_tree, hf_mip6_hlen, tvb,
3806                 MIP6_HLEN_OFF, 1,
3807                 tvb_get_guint8(tvb, MIP6_HLEN_OFF),
3808                 "%u (%u bytes)",
3809                 tvb_get_guint8(tvb, MIP6_HLEN_OFF),
3810                 len);
3811 
3812     proto_tree_add_item(mip6_tree, hf_mip6_mhtype, tvb,
3813             MIP6_TYPE_OFF, 1, ENC_BIG_ENDIAN);
3814 
3815     proto_tree_add_item(mip6_tree, hf_mip6_reserved, tvb,
3816             MIP6_RES_OFF, 1, ENC_BIG_ENDIAN);
3817 
3818     proto_tree_add_checksum(mip6_tree, tvb, MIP6_CSUM_OFF, hf_mip6_csum,
3819             -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
3820 
3821     /* Process mobility header */
3822     type = tvb_get_guint8(tvb, MIP6_TYPE_OFF);
3823     col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_ext(type, &mip6_mh_types_ext, "Unknown Mobility Header (%u)"));
3824     switch (type) {
3825     case MIP6_BRR:
3826         /* 0 Binding Refresh Request */
3827         offset = dissect_mip6_brr(tvb, mip6_tree, pinfo);
3828         break;
3829     case MIP6_HOTI:
3830         /* 1 Home Test Init */
3831         offset = dissect_mip6_hoti(tvb, mip6_tree, pinfo);
3832         break;
3833     case MIP6_MHCOTI:
3834         /* 2 Care-of Test Init */
3835         offset = dissect_mip6_coti(tvb, mip6_tree, pinfo);
3836         break;
3837     case MIP6_HOT:
3838         /* 3 Home Test */
3839         offset = dissect_mip6_hot(tvb, mip6_tree, pinfo);
3840         break;
3841     case MIP6_MHCOT:
3842         /* 4 Care-of Test */
3843         offset = dissect_mip6_cot(tvb, mip6_tree, pinfo);
3844         break;
3845     case MIP6_BU:
3846         /* 5 Binding Update */
3847         pinfo->link_dir = P2P_DIR_UL;
3848         offset = dissect_mip6_bu(tvb, mip6_tree, pinfo);
3849         if (proto_nemo == 1) {
3850             col_set_str(pinfo->cinfo, COL_PROTOCOL, "NEMO");
3851         }
3852         break;
3853     case MIP6_BA:
3854         /* 6 Binding Acknowledgement */
3855         pinfo->link_dir = P2P_DIR_DL;
3856         offset = dissect_mip6_ba(tvb, mip6_tree, pinfo);
3857         if (proto_nemo == 1) {
3858             col_set_str(pinfo->cinfo, COL_PROTOCOL, "NEMO");
3859         }
3860         break;
3861     case MIP6_BE:
3862         /* 7 Binding Error */
3863         offset = dissect_mip6_be(tvb, mip6_tree, pinfo);
3864         break;
3865     case MIP6_FBU:
3866         /* 8 Fast Binding Update */
3867         offset = dissect_fmip6_fbu(tvb, mip6_tree, pinfo);
3868         break;
3869     case MIP6_FBACK:
3870         /* 9 Fast Binding Acknowledgment */
3871         offset = dissect_fmip6_fback(tvb, mip6_tree, pinfo);
3872         break;
3873     case MIP6_FNA:
3874         /* 10 Fast Neighbor Advertisement */
3875         offset = dissect_fmip6_fna(tvb, mip6_tree, pinfo);
3876         break;
3877     case MIP6_EMH:
3878         /* 11 Experimental Mobility Header RFC5096 */
3879         if (len > 8) {
3880             proto_tree_add_item(mip6_tree, hf_mip6_opt_em_data, tvb, offset+MIP6_DATA_OFF, len-MIP6_DATA_OFF, ENC_NA);
3881         }
3882         offset = len;
3883         break;
3884     case MIP6_HAS:
3885         /* 12 Home Agent Switch */
3886         offset = dissect_mip6_has(tvb, mip6_tree, pinfo);
3887         break;
3888     case MIP6_HB:
3889         /* 13 Heartbeat */
3890         offset = dissect_mip6_hb(tvb, mip6_tree, pinfo);
3891         break;
3892     case MIP6_HI:
3893         /* 14 Handover Initiate RFC5568 */
3894         offset = dissect_mip6_hi(tvb, mip6_tree, pinfo);
3895         break;
3896     case MIP6_HAck:
3897         /* 14 Handover Acknowledge*/
3898         offset = dissect_mip6_hack(tvb, mip6_tree, pinfo);
3899         break;
3900     case MIP6_BR:
3901         /* 16 Binding Revocation Indication / Acknowledge */
3902         offset = dissect_pmip6_bri(tvb, mip6_tree, pinfo);
3903         break;
3904     case MIP6_LRI:
3905         /* 17 Localized Routing Initiation */
3906         offset = dissect_pmip6_lri(tvb, mip6_tree, pinfo, offset);
3907         break;
3908     case MIP6_LRA:
3909         /* 18 Localized Routing Acknowledgment */
3910         offset = dissect_pmip6_lra(tvb, mip6_tree, pinfo, offset);
3911         break;
3912     default:
3913         offset = dissect_mip6_unknown(tvb, mip6_tree, pinfo);
3914         break;
3915     }
3916 
3917     /* Process mobility options */
3918     if (offset < len) {
3919         if (len < (offset - start_offset)) {
3920             expert_add_info(pinfo, header_item, &ei_mip6_bogus_header_length);
3921             return offset;
3922         }
3923         len -= (offset - start_offset);
3924         dissect_mip6_options(tvb, mip6_tree, offset, len, pinfo);
3925     }
3926 
3927     if ((type == MIP6_FNA) && (pproto == IP_PROTO_IPV6)) {
3928         col_set_str(pinfo->cinfo, COL_INFO, "Fast Neighbor Advertisement[Fast Binding Update]");
3929         next_tvb = tvb_new_subset_remaining(tvb, len + 8);
3930         ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip6 *)data);
3931     }
3932 
3933     if ((type == MIP6_FBACK) && (pproto == IP_PROTO_AH)) {
3934         col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgment");
3935         next_tvb = tvb_new_subset_remaining(tvb, len + offset);
3936         ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip6 *)data);
3937     }
3938 
3939     return tvb_captured_length(tvb);
3940 }
3941 
3942 /* Register the protocol with Wireshark */
3943 void
proto_register_mip6(void)3944 proto_register_mip6(void)
3945 {
3946     /* Setup list of header fields */
3947     static hf_register_info hf[] = {
3948 
3949     { &hf_mip6_proto,
3950       { "Payload protocol", "mip6.proto",
3951         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0,
3952         NULL, HFILL }
3953     },
3954     { &hf_mip6_hlen,
3955         { "Header length", "mip6.hlen",
3956                 FT_UINT8, BASE_DEC, NULL, 0,
3957                 NULL, HFILL }
3958     },
3959     { &hf_mip6_mhtype,
3960       { "Mobility Header Type", "mip6.mhtype",
3961         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mh_types_ext, 0,
3962         NULL, HFILL }
3963     },
3964     { &hf_mip6_reserved,
3965       { "Reserved", "mip6.reserved",
3966         FT_UINT8, BASE_HEX, NULL, 0,
3967         NULL, HFILL }
3968     },
3969     { &hf_mip6_csum,
3970       { "Checksum", "mip6.csum",
3971         FT_UINT16, BASE_HEX, NULL, 0,
3972         "Header Checksum", HFILL }
3973     },
3974 
3975     { &hf_mip6_hoti_cookie,
3976       { "Home Init Cookie", "mip6.hoti.cookie",
3977         FT_UINT64, BASE_HEX, NULL, 0,
3978         NULL, HFILL }
3979     },
3980 
3981     { &hf_mip6_coti_cookie,
3982       { "Care-of Init Cookie", "mip6.coti.cookie",
3983         FT_UINT64, BASE_HEX, NULL, 0,
3984         NULL, HFILL }
3985     },
3986 
3987     { &hf_mip6_hot_nindex,
3988       { "Home Nonce Index", "mip6.hot.nindex",
3989         FT_UINT16, BASE_DEC, NULL, 0,
3990         NULL, HFILL }
3991     },
3992     { &hf_mip6_hot_cookie,
3993       { "Home Init Cookie", "mip6.hot.cookie",
3994         FT_UINT64, BASE_HEX, NULL, 0,
3995         NULL, HFILL }
3996     },
3997     { &hf_mip6_hot_token,
3998       { "Home Keygen Token", "mip6.hot.token",
3999         FT_UINT64, BASE_HEX, NULL, 0,
4000         NULL, HFILL }
4001     },
4002 
4003     { &hf_mip6_cot_nindex,
4004       { "Care-of Nonce Index", "mip6.cot.nindex",
4005         FT_UINT16, BASE_DEC, NULL, 0,
4006         NULL, HFILL }
4007     },
4008     { &hf_mip6_cot_cookie,
4009       { "Care-of Init Cookie", "mip6.cot.cookie",
4010         FT_UINT64, BASE_HEX, NULL, 0,
4011         NULL, HFILL }
4012     },
4013 #if 0
4014     { &hf_mip6_cot_token,
4015       { "Care-of Keygen Token", "mip6.cot.token",
4016         FT_UINT64, BASE_HEX, NULL, 0,
4017         NULL, HFILL }
4018     },
4019 #endif
4020 
4021     { &hf_mip6_bu_seqnr,
4022       { "Sequence number", "mip6.bu.seqnr",
4023         FT_UINT16, BASE_DEC, NULL, 0,
4024         NULL, HFILL }
4025     },
4026     { &hf_mip6_bu_a_flag,
4027       { "Acknowledge (A) flag", "mip6.bu.a_flag",
4028         FT_BOOLEAN, 16, TFS(&mip6_bu_a_flag_value), 0x8000,
4029         NULL, HFILL }
4030     },
4031     { &hf_mip6_bu_h_flag,
4032       { "Home Registration (H) flag", "mip6.bu.h_flag",
4033         FT_BOOLEAN, 16, TFS(&mip6_bu_h_flag_value), 0x4000,
4034         NULL, HFILL }
4035     },
4036     { &hf_mip6_bu_l_flag,
4037       { "Link-Local Compatibility (L) flag", "mip6.bu.l_flag",
4038         FT_BOOLEAN, 16, TFS(&mip6_bu_l_flag_value), 0x2000,
4039         "Home Registration (H) flag", HFILL }
4040     },
4041     { &hf_mip6_bu_k_flag,
4042       { "Key Management Compatibility (K) flag", "mip6.bu.k_flag",
4043         FT_BOOLEAN, 16, TFS(&mip6_bu_k_flag_value), 0x1000,
4044         NULL, HFILL }
4045     },
4046     { &hf_mip6_bu_m_flag,
4047       { "MAP Registration Compatibility (M) flag", "mip6.bu.m_flag",
4048         FT_BOOLEAN, 16, TFS(&mip6_bu_m_flag_value), 0x0800,
4049         NULL, HFILL }
4050     },
4051     { &hf_mip6_nemo_bu_r_flag,
4052       { "Mobile Router (R) flag", "mip6.nemo.bu.r_flag",
4053         FT_BOOLEAN, 16, TFS(&mip6_nemo_bu_r_flag_value), 0x0400,
4054         NULL, HFILL }
4055     },
4056     { &hf_pmip6_bu_p_flag,
4057       { "Proxy Registration (P) flag", "mip6.bu.p_flag",
4058         FT_BOOLEAN, 16, TFS(&pmip6_bu_p_flag_value), 0x0200,
4059         NULL, HFILL }
4060     },
4061     { &hf_mip6_bu_f_flag,
4062       { "Forcing UDP encapsulation (F) flag", "mip6.bu.f_flag",
4063         FT_BOOLEAN, 16, TFS(&mip6_bu_f_flag_value), 0x0100,
4064         NULL, HFILL }
4065     },
4066     { &hf_pmip6_bu_t_flag,
4067       { "TLV-header format (T) flag", "mip6.bu.t_flag",
4068         FT_BOOLEAN, 16, TFS(&pmip6_bu_t_flag_value), 0x0080,
4069         NULL, HFILL }
4070     },
4071     { &hf_pmip6_bu_b_flag,
4072       { "Bulk-Binding-Update flag (B)", "mip6.bu.b_flag",
4073         FT_BOOLEAN, 16, TFS(&pmip6_bu_b_flag_value), 0x0040,
4074         NULL, HFILL }
4075     },
4076     { &hf_mip6_bu_lifetime,
4077       { "Lifetime", "mip6.bu.lifetime",
4078         FT_UINT16, BASE_DEC, NULL, 0,
4079         NULL, HFILL }
4080     },
4081 
4082     { &hf_mip6_ba_status,
4083       { "Status", "mip6.ba.status",
4084         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_ba_status_value_ext, 0,
4085         "Binding Acknowledgement status", HFILL }
4086     },
4087     { &hf_mip6_ba_k_flag,
4088       { "Key Management Compatibility (K) flag", "mip6.ba.k_flag",
4089         FT_BOOLEAN, 8, TFS(&mip6_bu_k_flag_value), 0x80,
4090         NULL, HFILL }
4091     },
4092     { &hf_mip6_nemo_ba_r_flag,
4093       { "Mobile Router (R) flag", "mip6.nemo.ba.r_flag",
4094         FT_BOOLEAN, 8, TFS(&mip6_nemo_bu_r_flag_value), 0x40,
4095         NULL, HFILL }
4096     },
4097     { &hf_pmip6_ba_p_flag,
4098       { "Proxy Registration (P) flag", "mip6.ba.p_flag",
4099         FT_BOOLEAN, 8, TFS(&pmip6_bu_p_flag_value), 0x20,
4100         NULL, HFILL }
4101     },
4102     { &hf_pmip6_ba_t_flag,
4103       { "TLV-header format (T) flag", "mip6.ba.t_flag",
4104         FT_BOOLEAN, 8, TFS(&pmip6_bu_t_flag_value), 0x10,
4105         NULL, HFILL }
4106     },
4107     { &hf_pmip6_ba_b_flag,
4108       { "Bulk-Binding-Update flag (B)", "mip6.ba.b_flag",
4109         FT_BOOLEAN, 8, TFS(&pmip6_ba_b_flag_value), 0x08,
4110         NULL, HFILL }
4111     },
4112 
4113     { &hf_mip6_ba_seqnr,
4114       { "Sequence number", "mip6.ba.seqnr",
4115         FT_UINT16, BASE_DEC, NULL, 0,
4116         NULL, HFILL }
4117     },
4118     { &hf_mip6_ba_lifetime,
4119       { "Lifetime", "mip6.ba.lifetime",
4120         FT_UINT16, BASE_DEC, NULL, 0,
4121         NULL, HFILL }
4122     },
4123 
4124     { &hf_mip6_be_status,
4125       { "Status", "mip6.be.status",
4126         FT_UINT8, BASE_DEC, VALS(mip6_be_status_value), 0,
4127         "Binding Error status", HFILL }
4128     },
4129     { &hf_mip6_be_haddr,
4130       { "Home Address", "mip6.be.haddr",
4131         FT_IPv6, BASE_NONE, NULL, 0,
4132         NULL, HFILL }
4133     },
4134 
4135     { &hf_fmip6_fbu_seqnr,
4136       { "Sequence number", "mip6.fbu.seqnr",
4137         FT_UINT16, BASE_DEC, NULL, 0,
4138         NULL, HFILL }
4139     },
4140     { &hf_fmip6_fbu_a_flag,
4141       { "Acknowledge (A) flag", "mip6.fbu.a_flag",
4142         FT_BOOLEAN, 8, TFS(&fmip6_fbu_a_flag_value), 0x80,
4143         NULL, HFILL }
4144     },
4145     { &hf_fmip6_fbu_h_flag,
4146       { "Home Registration (H) flag", "mip6.fbu.h_flag",
4147         FT_BOOLEAN, 8, TFS(&fmip6_fbu_h_flag_value), 0x40,
4148         NULL, HFILL }
4149     },
4150     { &hf_fmip6_fbu_l_flag,
4151       { "Link-Local Compatibility (L) flag", "mip6.fbu.l_flag",
4152         FT_BOOLEAN, 8, TFS(&fmip6_fbu_l_flag_value), 0x20,
4153         "Home Registration (H) flag", HFILL }
4154     },
4155     { &hf_fmip6_fbu_k_flag,
4156       { "Key Management Compatibility (K) flag", "mip6.fbu.k_flag",
4157         FT_BOOLEAN, 8, TFS(&fmip6_fbu_k_flag_value), 0x10,
4158         NULL, HFILL }
4159     },
4160     { &hf_fmip6_fbu_lifetime,
4161       { "Lifetime", "mip6.fbu.lifetime",
4162         FT_UINT16, BASE_DEC, NULL, 0,
4163         NULL, HFILL }
4164     },
4165 
4166     { &hf_fmip6_fback_status,
4167       { "Status", "mip6.fback.status",
4168         FT_UINT8, BASE_DEC, VALS(fmip6_fback_status_value), 0,
4169         "Fast Binding Acknowledgement status", HFILL }
4170     },
4171     { &hf_fmip6_fback_k_flag,
4172       { "Key Management Compatibility (K) flag", "mip6.fback.k_flag",
4173         FT_BOOLEAN, 8, TFS(&fmip6_fbu_k_flag_value), 0x80,
4174         NULL, HFILL }
4175     },
4176     { &hf_fmip6_fback_seqnr,
4177       { "Sequence number", "mip6.fback.seqnr",
4178         FT_UINT16, BASE_DEC, NULL, 0,
4179         NULL, HFILL }
4180     },
4181     { &hf_fmip6_fback_lifetime,
4182       { "Lifetime", "mip6.fback.lifetime",
4183         FT_UINT16, BASE_DEC, NULL, 0,
4184         NULL, HFILL }
4185     },
4186     { &hf_mip6_has_num_addrs,
4187       { "Number of Addresses", "mip6.has.num_addrs",
4188         FT_UINT8, BASE_DEC, NULL, 0,
4189         NULL, HFILL }
4190     },
4191     { &hf_mip6_has_reserved,
4192       { "Reserved", "mip6.has.reserved",
4193         FT_UINT8, BASE_HEX, NULL, 0,
4194         NULL, HFILL }
4195     },
4196     { &hf_mip6_has_address,
4197       { "Address", "mip6.has.address",
4198         FT_IPv6, BASE_NONE, NULL, 0,
4199         "Home Agent Address", HFILL }
4200     },
4201     { &hf_mip6_hb_u_flag,
4202       { "Unsolicited (U) flag", "mip6.hb.u_flag",
4203         FT_BOOLEAN, 8, TFS(&mip6_hb_u_flag_value), 0x02,
4204         NULL, HFILL }
4205     },
4206     { &hf_mip6_hb_r_flag,
4207       { "Response (R) flag", "mip6.hb.r_flag",
4208         FT_BOOLEAN, 8, TFS(&mip6_hb_r_flag_value), 0x01,
4209         NULL, HFILL }
4210     },
4211     { &hf_mip6_hb_seqnr,
4212       { "Sequence number", "mip6.hb.seqnr",
4213         FT_UINT32, BASE_DEC, NULL, 0,
4214         NULL, HFILL }
4215     },
4216     { &hf_mip6_hi_seqnr,
4217       { "Sequence number", "mip6.hi.seqnr",
4218         FT_UINT16, BASE_DEC, NULL, 0,
4219         NULL, HFILL }
4220     },
4221     { &hf_mip6_hi_s_flag,
4222       { "Assigned address configuration flag (S) flag", "mip6.hi.s_flag",
4223         FT_BOOLEAN, 8, NULL, 0x80,
4224         NULL, HFILL }
4225     },
4226     { &hf_mip6_hi_u_flag,
4227       { "Buffer flag (U) flag", "mip6.hi.u_flag",
4228         FT_BOOLEAN, 8, NULL, 0x40,
4229         NULL, HFILL }
4230     },
4231     { &hf_mip6_hi_code,
4232       { "Code", "mip6.hi.code",
4233         FT_UINT8, BASE_DEC, NULL, 0,
4234         NULL, HFILL }
4235     },
4236     { &hf_mip6_hack_seqnr,
4237       { "Sequence number", "mip6.hack.seqnr",
4238         FT_UINT16, BASE_DEC, NULL, 0,
4239         NULL, HFILL }
4240     },
4241     { &hf_mip6_hack_code,
4242       { "Code", "mip6.hack.code",
4243         FT_UINT8, BASE_DEC, NULL, 0,
4244         NULL, HFILL }
4245     },
4246     { &hf_mip6_opt_3gpp_reserved,
4247       { "Reserved", "mip6.3gpp.reserved",
4248         FT_UINT8, BASE_DEC, NULL, 0xfe,
4249         NULL, HFILL }
4250     },
4251     { &hf_mip6_opt_3gpp_flag_m,
4252       { "M flag", "mip6.3gpp.flag.m",
4253         FT_BOOLEAN, 8, NULL, 0x01,
4254         NULL, HFILL }
4255     },
4256     { &hf_mip6_opt_3gpp_spec_pmipv6_err_code,
4257       { "3GPP Specific PMIPv6 Error Code", "mip6.3gpp.spec_pmipv6_err_code",
4258         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
4259         "GTPv2 Cause values", HFILL }
4260     },
4261     { &hf_mip6_opt_3gpp_pdn_gw_ipv4_addr,
4262       { "PDN GW IPv4 address", "mip6.3gpp.pdn_gw_ipv4_addr",
4263         FT_IPv4, BASE_NONE, NULL, 0,
4264         NULL, HFILL }
4265     },
4266     { &hf_mip6_opt_3gpp_pdn_gw_ipv6_addr,
4267       { "PDN GW IPv6 address", "mip6.3gpp.pdn_gw_ipv6_addr",
4268         FT_IPv6, BASE_NONE, NULL, 0,
4269         NULL, HFILL }
4270     },
4271     { &hf_mip6_opt_3gpp_dhcpv4_addr_all_proc_ind,
4272       { "DHCPv4 Address Allocation Procedure Indication", "mip6.3gpp.dhcpv4_addr_all_proc_ind",
4273         FT_UINT8, BASE_DEC, NULL, 0x0,
4274         NULL, HFILL }
4275     },
4276     { &hf_mip6_opt_3gpp_pdn_type,
4277       { "PDN type", "mip6.3gpp.pdn_type",
4278         FT_UINT8, BASE_DEC, NULL, 0x0,
4279         NULL, HFILL }
4280     },
4281     { &hf_mip6_opt_3gpp_pdn_ind_cause,
4282       { "Cause", "mip6.3gpp.pdn_ind_cause",
4283         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
4284         "GTPv2 Cause values", HFILL }
4285     },
4286     { &hf_mip6_opt_3gpp_chg_id,
4287       { "Charging ID", "mip6.3gpp.chg_id",
4288         FT_UINT32, BASE_DEC, NULL, 0x0,
4289         NULL, HFILL }
4290     },
4291     { &hf_mip6_opt_3gpp_charging_characteristic,
4292       {"Charging Characteristic", "mip6.3gpp.charging_characteristic",
4293         FT_UINT16, BASE_HEX, NULL, 0xffff,
4294         NULL, HFILL}
4295       },
4296     { &hf_mip6_opt_3gpp_mei,
4297       {"Mobile Equipment Identity (MEI)", "mip6.3gpp.mei",
4298         FT_STRING, BASE_NONE, NULL, 0,
4299         NULL, HFILL}
4300     },
4301     { &hf_mip6_opt_3gpp_msisdn,
4302       {"MSISDN", "mip6.3gpp.msisdn",
4303         FT_STRING, BASE_NONE, NULL, 0,
4304         NULL, HFILL}
4305     },
4306     { &hf_mip6_opt_3gpp_apn_rest,
4307       { "APN Restriction", "mip6.3gpp.apn_rest",
4308         FT_UINT8, BASE_DEC, NULL, 0x0,
4309         NULL, HFILL }
4310     },
4311     { &hf_mip6_opt_3gpp_max_apn_rest,
4312       { "Maximum APN Restriction", "mip6.3gpp.max_apn_rest",
4313         FT_UINT8, BASE_DEC, NULL, 0x0,
4314         NULL, HFILL }
4315     },
4316     { &hf_mip6_opt_3gpp_imsi,
4317       {"Unauthenticated IMSI", "mip6.3gpp.imsi",
4318         FT_STRING, BASE_NONE, NULL, 0,
4319         NULL, HFILL}
4320     },
4321     { &hf_mip6_opt_3gpp_pdn_conn_id,
4322       { "PDN Connection ID", "mip6.3gpp.pdn_conn_id",
4323         FT_UINT8, BASE_DEC, NULL, 0x0f,
4324         NULL, HFILL }
4325     },
4326     { &hf_hf_mip6_opt_3gpp_lapi,
4327         {"LAPI (Low Access Priority Indication)", "mip6.3gpp.lapi",
4328         FT_BOOLEAN, 8, NULL, 0x01,
4329         NULL, HFILL}
4330     },
4331 
4332     { &hf_mip6_bra_interval,
4333       { "Refresh interval", "mip6.bra.interval",
4334         FT_UINT16, BASE_DEC, NULL, 0,
4335         NULL, HFILL }
4336     },
4337 
4338     { &hf_mip6_acoa_acoa,
4339       { "Alternate care-of address", "mip6.acoa.acoa",
4340         FT_IPv6, BASE_NONE, NULL, 0,
4341         NULL, HFILL }
4342     },
4343 
4344     { &hf_mip6_ni_hni,
4345       { "Home nonce index", "mip6.ni.hni",
4346         FT_UINT16, BASE_DEC, NULL, 0,
4347         NULL, HFILL }
4348     },
4349     { &hf_mip6_ni_cni,
4350       { "Care-of nonce index", "mip6.ni.cni",
4351         FT_UINT16, BASE_DEC, NULL, 0,
4352         NULL, HFILL }
4353     },
4354 
4355     { &hf_mip6_bad_auth,
4356       { "Authenticator", "mip6.bad.auth",
4357         FT_BYTES, BASE_NONE, NULL, 0,
4358         NULL, HFILL }
4359     },
4360 
4361     { &hf_fmip6_lla,
4362       { "Link-layer address", "mip6.lla",
4363         FT_BYTES, SEP_COLON, NULL, 0,
4364         NULL, HFILL }
4365     },
4366 
4367     { &hf_fmip6_lla_optcode,
4368       { "Option-Code", "mip6.lla.optcode",
4369         FT_UINT8, BASE_DEC, VALS(fmip6_lla_optcode_value), 0,
4370         NULL, HFILL }
4371     },
4372 
4373     { &hf_mip6_nemo_mnp_pfl,
4374       { "Mobile Network Prefix Length", "mip6.nemo.mnp.pfl",
4375         FT_UINT8, BASE_DEC, NULL, 0,
4376         NULL, HFILL }
4377     },
4378 
4379     { &hf_mip6_nemo_mnp_mnp,
4380       { "Mobile Network Prefix", "mip6.nemo.mnp.mnp",
4381         FT_IPv6, BASE_NONE, NULL, 0,
4382         NULL, HFILL }
4383     },
4384 
4385 
4386     { &hf_mip6_mnid_subtype,
4387       { "Subtype", "mip6.mnid.subtype",
4388         FT_UINT8, BASE_DEC, VALS(mip6_mnid_subtype_value), 0,
4389         NULL, HFILL }
4390     },
4391     { &hf_mip6_mnid_identifier,
4392       { "Identifier", "mip6.mnid.identifier",
4393         FT_STRING, BASE_NONE, NULL, 0x0,
4394         NULL, HFILL }
4395     },
4396     { &hf_mip6_opt_auth_sub_type,
4397       { "Subtype", "mip6.auth.subtype",
4398         FT_UINT8, BASE_DEC, VALS(mip6_auth_subtype_value), 0,
4399         NULL, HFILL }
4400     },
4401     { &hf_mip6_opt_auth_mobility_spi,
4402       { "Mobility SPI", "mip6.auth.mobility_spi",
4403         FT_UINT32, BASE_DEC, NULL, 0,
4404         NULL, HFILL }
4405     },
4406     { &hf_mip6_opt_auth_auth_data,
4407       { "Authentication Data", "mip6.auth.auth_data",
4408         FT_BYTES, BASE_NONE, NULL, 0,
4409         NULL, HFILL }
4410     },
4411     { &hf_mip6_opt_mseg_id_timestamp,
4412       { "Timestamp", "mip6.mseg_id.timestamp",
4413         FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0,
4414         NULL, HFILL }
4415     },
4416     { &hf_mip6_opt_cgar_cga_par,
4417       { "CGA Parameters", "mip6.cgar.cga_par",
4418         FT_BYTES, BASE_NONE, NULL, 0,
4419         NULL, HFILL }
4420     },
4421     { &hf_mip6_opt_sign_sign,
4422       { "CGA Parameters", "mip6.sign.sign",
4423         FT_BYTES, BASE_NONE, NULL, 0,
4424         NULL, HFILL }
4425     },
4426     { &hf_mip6_opt_phkt_phkt,
4427       { "Permanent Home Keygen Token", "mip6.phkt.phkt",
4428         FT_BYTES, BASE_NONE, NULL, 0,
4429         NULL, HFILL }
4430     },
4431     { &hf_mip6_opt_mocot_co_keygen_tok,
4432       { "Care-of Keygen Token", "mip6.mocot.co_keygen_tok",
4433         FT_BYTES, BASE_NONE, NULL, 0,
4434         NULL, HFILL }
4435     },
4436     { &hf_mip6_opt_dnsu_status,
4437       { "Status", "mip6.dnsu.status",
4438         FT_UINT8, BASE_DEC, VALS(mip6_dnsu_status_values), 0,
4439         NULL, HFILL }
4440     },
4441     { &hf_mip6_opt_dnsu_flag_r,
4442       { "R flag", "mip6.dnsu.flag.r",
4443         FT_BOOLEAN, 8, TFS(&mip6_dnsu_r_flag_value), 0x80,
4444         NULL, HFILL }
4445     },
4446     { &hf_mip6_opt_dnsu_mn_id,
4447       { "MN identity (FQDN)", "mip6.dnsu.mn_id",
4448         FT_BYTES, BASE_NONE, NULL, 0,
4449         NULL, HFILL }
4450     },
4451     { &hf_mip6_opt_em_data,
4452       { "Data", "mip6.em.data",
4453         FT_BYTES, BASE_NONE, NULL, 0,
4454         NULL, HFILL }
4455     },
4456     { &hf_mip6_vsm_vid,
4457       { "Vendor Id", "mip6.vsm.vendorId",
4458         FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x0,
4459         NULL, HFILL }
4460     },
4461     { &hf_mip6_vsm_subtype,
4462       { "Subtype", "mip6.vsm.subtype",
4463         FT_UINT8, BASE_DEC, VALS(mip6_vsm_subtype_value), 0,
4464         NULL, HFILL }
4465     },
4466     { &hf_mip6_vsm_subtype_3gpp,
4467       { "Subtype", "mip6.vsm.subtype",
4468         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_vsm_subtype_3gpp_value_ext, 0,
4469         NULL, HFILL }
4470     },
4471     { &hf_mip6_opt_ss_identifier,
4472       { "Identifier", "mip6.ss.identifier",
4473         FT_STRING, BASE_NONE, NULL, 0x0,
4474         NULL, HFILL }
4475     },
4476     { &hf_mip6_opt_badff_spi,
4477       { "SPI", "mip6.badff.spi",
4478         FT_UINT32, BASE_DEC, NULL, 0x0,
4479         NULL, HFILL }
4480     },
4481     { &hf_mip6_opt_badff_auth,
4482       { "Authenticator", "mip6.badff.auth",
4483         FT_BYTES, BASE_NONE, NULL, 0x0,
4484         NULL, HFILL }
4485     },
4486     { &hf_pmip6_hi_hi,
4487       { "Handoff Indicator", "mip6.hi",
4488         FT_UINT8, BASE_DEC, VALS(pmip6_hi_opttype_value), 0,
4489         NULL, HFILL }
4490     },
4491     { &hf_pmip6_hi_reserved,
4492       { "Reserved", "mip6.hi.reserved",
4493         FT_UINT8, BASE_DEC, NULL, 0,
4494         NULL, HFILL }
4495     },
4496     { &hf_pmip6_att_reserved,
4497       { "Reserved", "mip6.att.reserved",
4498         FT_UINT8, BASE_DEC, NULL, 0,
4499         NULL, HFILL }
4500     },
4501     { &hf_pmip6_att_att,
4502       { "Access Technology Type", "mip6.att",
4503         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &pmip6_att_att_value_ext, 0,
4504         NULL, HFILL }
4505     },
4506     { &hf_mip6_opt_mnlli_reserved,
4507       { "Reserved", "mip6.mnlli.reserved",
4508         FT_UINT16, BASE_DEC, NULL, 0xffff,
4509         NULL, HFILL }
4510     },
4511     { &hf_mip6_opt_mnlli_lli,
4512       { "Link-layer Identifier", "mip6.mnlli.lli",
4513         FT_BYTES, BASE_NONE, NULL, 0x0,
4514         NULL, HFILL }
4515     },
4516     { &hf_pmip6_timestamp,
4517       { "Timestamp", "mip6.timestamp_tmp",
4518         FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0,
4519         NULL, HFILL }
4520     },
4521     { &hf_pmip6_opt_lila_lla,
4522       { "Link-local Address", "mip6.lila_lla",
4523         FT_IPv6, BASE_NONE, NULL, 0x0,
4524         NULL, HFILL }
4525     },
4526     { &hf_pmip6_rc,
4527       { "Restart Counter", "mip6.rc",
4528         FT_UINT32, BASE_DEC, NULL, 0x0,
4529         NULL, HFILL}
4530     },
4531     { &hf_mip6_ipv4ha_preflen,
4532       { "Prefix-len", "mip6.ipv4ha.preflen",
4533         FT_UINT8, BASE_DEC, NULL, 0xfc,
4534         NULL, HFILL}
4535     },
4536 
4537     { &hf_mip6_ipv4ha_p_flag,
4538       { "mobile network prefix (P) flag", "mip6.ipv4ha.p_flag",
4539         FT_BOOLEAN, 16, TFS(&mip6_ipv4ha_p_flag_value), 0x0200,
4540         NULL, HFILL }
4541     },
4542 
4543     { &hf_mip6_ipv4ha_ha,
4544       { "IPv4 Home Address", "mip6.ipv4ha.ha",
4545         FT_IPv4, BASE_NONE, NULL, 0x0,
4546         NULL, HFILL }
4547     },
4548     { &hf_mip6_ipv4ha_reserved,
4549       { "Reserved", "mip6.ipv4ha.reserved",
4550         FT_UINT8, BASE_HEX, NULL, 0x0,
4551         NULL, HFILL }
4552     },
4553     { &hf_mip6_ipv4aa_status,
4554       { "Status", "mip6.ipv4aa.sts",
4555         FT_UINT8, BASE_DEC, VALS(pmip6_ipv4aa_status_values), 0x0,
4556         NULL, HFILL}
4557     },
4558     { &hf_mip6_opt_natd_f_flag,
4559       { "(F) flag", "mip6.natd.f_flag",
4560         FT_BOOLEAN, 16, TFS(&mip6_natd_f_flag_value), 0x8000,
4561         NULL, HFILL }
4562     },
4563     { &hf_mip6_opt_natd_reserved,
4564       { "Reserved", "mip6.natd.reserved",
4565         FT_UINT16, BASE_DEC, NULL, 0x7fff,
4566         NULL, HFILL }
4567     },
4568     { &hf_mip6_opt_natd_refresh_t,
4569       { "Refresh time", "mip6.natd.refresh_t",
4570         FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0x0,
4571         NULL, HFILL }
4572     },
4573     { &hf_mip6_opt_ipv4coa_reserved,
4574       { "Reserved", "mip6.ipv4coa.reserved",
4575         FT_UINT16, BASE_DEC, NULL, 0xffff,
4576         NULL, HFILL }
4577     },
4578     { &hf_mip6_opt_ipv4coa_addr,
4579       { "IPv4 Care-of address", "mip6.ipv4coa.addr",
4580         FT_IPv4, BASE_NONE, NULL, 0,
4581         NULL, HFILL }
4582     },
4583     { &hf_pmip6_gre_key,
4584       { "GRE Key", "mip6.gre_key",
4585         FT_UINT32, BASE_DEC, NULL, 0x0,
4586         NULL, HFILL}
4587     },
4588 
4589     { &hf_mip6_opt_mhipv6ap_opt_code,
4590       { "Option-Code", "mip6.mhipv6ap.opt_code",
4591         FT_UINT8, BASE_DEC, NULL, 0,
4592         NULL, HFILL }
4593     },
4594     { &hf_mip6_opt_mhipv6ap_prefix_l,
4595       { "Prefix Length", "mip6.mhipv6ap.len",
4596         FT_UINT8, BASE_DEC, NULL, 0,
4597         NULL, HFILL }
4598     },
4599     { &hf_mip6_opt_mhipv6ap_ipv6_address,
4600       { "IPv6 Address", "mip6.mhipv6ap.ipv6_address",
4601         FT_IPv6, BASE_NONE, NULL, 0,
4602         NULL, HFILL }
4603     },
4604     { &hf_mip6_opt_mhipv6ap_ipv6_address_prefix,
4605       { "IPv6 Address/Prefix", "mip6.mhipv6ap.ipv6_address_prefix",
4606         FT_STRING, BASE_NONE, NULL, 0,
4607         NULL, HFILL }
4608     },
4609     { &hf_mip6_opt_bi_bid,
4610       { "Binding ID (BID)", "mip6.bi.bid",
4611         FT_UINT16, BASE_DEC, NULL, 0,
4612         NULL, HFILL }
4613     },
4614     { &hf_mip6_opt_bi_status,
4615       { "Status", "mip6.bi.status",
4616         FT_UINT8, BASE_DEC, NULL, 0,
4617         NULL, HFILL }
4618     },
4619     { &hf_mip6_bi_h_flag,
4620       { "Simultaneous Home and Foreign Binding (H)", "mip6.bi.h_flag",
4621         FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x80,
4622         NULL, HFILL }
4623     },
4624     { &hf_mip6_bi_coa_ipv4,
4625       { "IPv4 care-of address (CoA)", "mip6.bi.coa_ipv4",
4626         FT_IPv4, BASE_NONE, NULL, 0x0,
4627         NULL, HFILL }
4628     },
4629     { &hf_mip6_bi_coa_ipv6,
4630       { "IPv6 care-of address (CoA)", "mip6.bi.coa_ipv6",
4631         FT_IPv6, BASE_NONE, NULL, 0x0,
4632         NULL, HFILL }
4633     },
4634     { &hf_mip6_binding_refresh_request,
4635       { "Binding Refresh Request", "mip6.binding_refresh_request",
4636         FT_BYTES, BASE_NONE, NULL, 0x0,
4637         NULL, HFILL }
4638     },
4639     { &hf_mip6_unknown_type_data,
4640       { "Message Data", "mip6.unknown_type_data",
4641         FT_BYTES, BASE_NONE, NULL, 0x0,
4642         NULL, HFILL }
4643     },
4644     { &hf_mip6_fast_neighbor_advertisement,
4645       { "Fast Neighbor Advertisement", "mip6.fast_neighbor_advertisement",
4646         FT_BYTES, BASE_NONE, NULL, 0x0,
4647         NULL, HFILL }
4648     },
4649     { &hf_mip6_vsm_data,
4650       { "Data", "mip6.vsm.data",
4651         FT_BYTES, BASE_NONE, NULL, 0x0,
4652         NULL, HFILL }
4653     },
4654     { &hf_mip6_vsm_req_data,
4655       { "Req-Data", "mip6.vsm.req_data",
4656         FT_BYTES, BASE_NONE, NULL, 0x0,
4657         NULL, HFILL }
4658     },
4659     { &hf_mip6_opt_padn,
4660       { "PadN", "mip6.padn",
4661         FT_BYTES, BASE_NONE, NULL, 0x0,
4662         NULL, HFILL }
4663     },
4664     { &hf_mip6_ipv4dra_reserved,
4665       { "Reserved", "mip6.ipv4dra.reserved",
4666         FT_UINT16, BASE_DEC, NULL, 0,
4667         NULL, HFILL }
4668     },
4669     { &hf_mip6_ipv4dra_dra,
4670       { "IPv4 Default-Router Address", "mip6.ipv4dra.dra",
4671         FT_IPv4, BASE_NONE, NULL, 0x0,
4672         NULL, HFILL }
4673     },
4674     { &hf_mip6_ipv4dsm_reserved,
4675       { "Reserved", "mip6.ipv4dsm.reserved",
4676         FT_UINT16, BASE_DEC, NULL, 0xfffe,
4677         NULL, HFILL }
4678     },
4679     { &hf_mip6_ipv4dsm_s_flag,
4680       { "DHCP Support Mode (S)", "mip6.ipv4dsm.s_flag",
4681         FT_BOOLEAN, 16, TFS(&mip6_ipv4dsm_s_flag_value), 0x0001,
4682         NULL, HFILL }
4683     },
4684 
4685     { &hf_mip6_cr_reserved,
4686       { "Reserved", "mip6.cr.reserved",
4687         FT_UINT16, BASE_DEC, NULL, 0x0,
4688         NULL, HFILL }
4689     },
4690 
4691     { &hf_mip6_cr_req_type,
4692       { "Req-type", "mip6.cr.req_type",
4693         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mobility_options_ext, 0,
4694         NULL, HFILL }
4695     },
4696     { &hf_mip6_cr_req_length,
4697       { "Req-length", "mip6.cr.req_length",
4698         FT_UINT8, BASE_DEC, NULL, 0,
4699         NULL, HFILL }
4700     },
4701     { &hf_mip6_lmaa_opt_code,
4702       { "Option-Code", "mip6.lmaa.opt_code",
4703         FT_UINT8, BASE_DEC, NULL, 0,
4704         NULL, HFILL }
4705     },
4706     { &hf_mip6_lmaa_reserved,
4707       { "Reserved", "mip6.lmaa.reserved",
4708         FT_UINT8, BASE_DEC, NULL, 0,
4709         NULL, HFILL }
4710     },
4711     { &hf_mip6_lmaa_ipv4,
4712       { "Local Mobility Anchor Address", "mip6.lmaa.ipv4",
4713         FT_IPv4, BASE_NONE, NULL, 0x0,
4714         NULL, HFILL }
4715     },
4716     { &hf_mip6_lmaa_ipv6,
4717       { "Local Mobility Anchor Address", "mip6.lmaa.ipv6",
4718         FT_IPv6, BASE_NONE, NULL, 0x0,
4719         NULL, HFILL }
4720     },
4721     { &hf_mip6_mobility_opt,
4722       { "Mobility Option", "mip6.mobility_opt",
4723         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_mobility_options_ext, 0,
4724         NULL, HFILL }
4725     },
4726     { &hf_mip6_opt_len,
4727       { "Length", "mip6.mobility_opt.len",
4728         FT_UINT8, BASE_DEC, NULL, 0,
4729         NULL, HFILL }
4730     },
4731     { &hf_pmip6_bri_brtype,
4732       { "B.R. Type", "mip6.bri_br.type",
4733         FT_UINT8, BASE_DEC, NULL, 0x0,
4734         NULL, HFILL }
4735     },
4736 
4737     { &hf_pmip6_bri_rtrigger,
4738       { "R. Trigger", "mip6.bri_r.trigger",
4739         FT_UINT8, BASE_DEC, VALS(pmip6_bri_rtrigger), 0x0,
4740         NULL, HFILL }
4741     },
4742 
4743     { &hf_pmip6_bri_status,
4744       { "Status", "mip6.bri_status",
4745         FT_UINT8, BASE_DEC, VALS(pmip6_bri_status), 0x0,
4746         NULL, HFILL }
4747     },
4748 
4749     { &hf_pmip6_bri_seqnr,
4750       { "Sequence Number", "mip6.bri_seqnr",
4751         FT_UINT16, BASE_DEC, NULL, 0x0,
4752         NULL, HFILL }
4753     },
4754 
4755     { &hf_pmip6_bri_ip_flag,
4756       { "Proxy Binding (P) Flag", "mip6.bri_ip",
4757         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000,
4758         NULL, HFILL }
4759     },
4760 
4761     { &hf_pmip6_bri_iv_flag,
4762       { "IPv4 HoA Binding Only (V) Flag", "mip6.bri_iv",
4763         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
4764         NULL, HFILL }
4765     },
4766 
4767     { &hf_pmip6_bri_ig_flag,
4768       { "Global (G) Flag", "mip6.bri_ig",
4769         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x2000,
4770         NULL, HFILL }
4771     },
4772 
4773     { &hf_pmip6_bri_ap_flag,
4774       { "Proxy Binding (P) Flag", "mip6.bri_ap",
4775         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000,
4776         NULL, HFILL }
4777     },
4778     { &hf_pmip6_bri_av_flag,
4779       { "IPv4 HoA Binding Only (V) Flag", "mip6.bri_av",
4780         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
4781         NULL, HFILL }
4782     },
4783 
4784     { &hf_pmip6_bri_ag_flag,
4785       { "Global (G) Flag", "mip6.bri_ag",
4786         FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x2000,
4787         NULL, HFILL }
4788     },
4789 
4790     { &hf_pmip6_bri_res,
4791       { "Reserved", "mip6.bri_res",
4792         FT_UINT16, BASE_HEX, NULL, 0x1FFF,
4793         "Must be zero", HFILL }
4794     },
4795 
4796     { &hf_pmip6_lri_sequence,
4797       { "Sequence", "mip6.lri.sequence",
4798         FT_UINT16, BASE_DEC, NULL, 0x0,
4799         "A monotonically increasing integer", HFILL }
4800     },
4801 
4802     { &hf_pmip6_lri_reserved,
4803       { "Reserved", "mip6.lri.reserved",
4804         FT_UINT16, BASE_HEX, NULL, 0x0,
4805         "This field is unused and MUST be set to zero", HFILL }
4806     },
4807 
4808     { &hf_pmip6_lri_lifetime,
4809       { "Lifetime", "mip6.lri.lifetime",
4810         FT_UINT16, BASE_HEX, NULL, 0x0,
4811         "The requested time, in seconds", HFILL }
4812     },
4813 
4814     { &hf_pmip6_lra_sequence,
4815       { "Sequence", "mip6.lra.sequence",
4816         FT_UINT16, BASE_DEC, NULL, 0x0,
4817         "A monotonically increasing integer", HFILL }
4818     },
4819 
4820     { &hf_pmip6_lra_u,
4821       { "unsolicited", "mip6.lri.unsolicited",
4822         FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
4823         "When set to 1, the LRA message is sent unsolicited", HFILL }
4824     },
4825 
4826     { &hf_pmip6_lra_reserved,
4827       { "Reserved", "mip6.lra.reserved",
4828         FT_UINT8, BASE_HEX, NULL, 0x7F,
4829         "This field is unused and MUST be set to zero", HFILL }
4830     },
4831 
4832     { &hf_pmip6_lra_status,
4833       { "Status", "mip6.lra.status",
4834         FT_UINT8, BASE_DEC, VALS(pmip6_lra_status_vals), 0x0,
4835         "Indicating the result of processing the Localized Routing Acknowledgment message.", HFILL }
4836     },
4837 
4838     { &hf_pmip6_lra_lifetime,
4839       { "Lifetime", "mip6.lra.lifetime",
4840         FT_UINT16, BASE_HEX, NULL, 0x0,
4841         "The requested time, in seconds", HFILL }
4842     },
4843 
4844     { &hf_mip6_opt_recap_reserved,
4845       { "Reserved", "mip6.recap.reserved",
4846         FT_UINT16, BASE_HEX, NULL, 0x0,
4847         "Must be zero", HFILL }
4848     },
4849 
4850     { &hf_mip6_opt_redir_k,
4851       { "K", "mip6.redir.k",
4852         FT_BOOLEAN, 16, NULL, MIP6_REDIR_FLAG_K,
4853         "bit is set (1) if the Optional IPv6 r2LMA Address is included in the mobility option", HFILL }
4854     },
4855     { &hf_mip6_opt_redir_n,
4856       { "N", "mip6.redir.n",
4857         FT_BOOLEAN, 16, NULL, MIP6_REDIR_FLAG_N,
4858         "bit is set (1) if the Optional IPv4 r2LMA Address is included in the mobility option", HFILL }
4859     },
4860     { &hf_mip6_opt_redir_reserved,
4861       { "Reserved", "mip6.redir.reserved",
4862         FT_UINT16, BASE_HEX, NULL, MIP6_REDIR_FLAG_RSV,
4863         "Must be zero", HFILL }
4864     },
4865     { &hf_mip6_opt_redir_addr_r2LMA_ipv6,
4866       { "IPv6 r2LMA Address", "mip6.redir.addr_r2lma_ipv6",
4867         FT_IPv6, BASE_NONE, NULL, 0x0,
4868         NULL, HFILL }
4869     },
4870     { &hf_mip6_opt_redir_addr_r2LMA_ipv4,
4871       { "IPv4 r2LMA Address", "mip6.redir.addr_r2lma_ipv4",
4872         FT_IPv4, BASE_NONE, NULL, 0x0,
4873         NULL, HFILL }
4874     },
4875 
4876     { &hf_mip6_opt_load_inf_priority,
4877       { "Priority", "mip6.load_inf.priority",
4878         FT_UINT16, BASE_DEC, NULL, 0x0,
4879         NULL, HFILL }
4880     },
4881     { &hf_mip6_opt_load_inf_sessions_in_use,
4882       { "Sessions in Use", "mip6.load_inf.sessions_in_use",
4883         FT_UINT32, BASE_DEC, NULL, 0x0,
4884         NULL, HFILL }
4885     },
4886     { &hf_mip6_opt_load_inf_maximum_sessions,
4887       { "Maximum Sessions", "mip6.load_inf.maximum_sessions",
4888         FT_UINT32, BASE_DEC, NULL, 0x0,
4889         NULL, HFILL }
4890     },
4891     { &hf_mip6_opt_load_inf_used_capacity,
4892       { "Used Capacity", "mip6.load_inf.used_capacity",
4893         FT_UINT32, BASE_DEC, NULL, 0x0,
4894         NULL, HFILL }
4895     },
4896     { &hf_mip6_opt_load_inf_maximum_capacity,
4897       { "Maximum Capacity", "mip6.load_inf.maximum_capacity",
4898         FT_UINT32, BASE_DEC, NULL, 0x0,
4899         NULL, HFILL }
4900     },
4901 
4902     { &hf_mip6_opt_alt_ip4,
4903       { "Alternate IPv4 Care-of Address", "mip6.alt_ip4",
4904         FT_IPv4, BASE_NONE, NULL, 0x0,
4905         NULL, HFILL }
4906     },
4907 
4908     { &hf_mip6_opt_mng_sub_type,
4909       { "Sub Type", "mip6.mng.sub_type",
4910         FT_UINT8, BASE_DEC, VALS(mip6_mng_id_type_vals), 0x0,
4911         NULL, HFILL }
4912     },
4913 
4914     { &hf_mip6_opt_mng_reserved,
4915       { "Reserved", "mip6.mng.reserved",
4916         FT_UINT8, BASE_DEC, NULL, 0x0,
4917         NULL, HFILL }
4918     },
4919 
4920     { &hf_mip6_opt_mng_mng_id,
4921       { "Mobile Node Group Identifier", "mip6.mng.mng_id",
4922         FT_UINT32, BASE_DEC, NULL, 0x0,
4923         NULL, HFILL }
4924     },
4925 
4926     { &hf_mip6_opt_mag_ipv6_reserved,
4927       { "Reserved", "mip6.mag_ipv6.reserved",
4928         FT_UINT8, BASE_HEX, NULL, 0x0,
4929         NULL, HFILL }
4930     },
4931 
4932     { &hf_mip6_opt_mag_ipv6_address_length,
4933       { "Address Length", "mip6.mag_ipv6.address_length",
4934         FT_UINT8, BASE_DEC, NULL, 0x0,
4935         "This field MUST be set to 128", HFILL }
4936     },
4937 
4938     { &hf_mip6_opt_mag_ipv6_address,
4939       { "Address", "mip6.mag_ipv6.address",
4940         FT_IPv6, BASE_NONE, NULL, 0x0,
4941         NULL, HFILL }
4942     },
4943 
4944     { &hf_mip6_opt_acc_net_id_sub,
4945       { "ANI", "mip6.acc_net_id",
4946         FT_NONE, BASE_NONE, NULL, 0x0,
4947         NULL, HFILL }
4948     },
4949 
4950 
4951     { &hf_mip6_opt_acc_net_id_sub_opt,
4952       { "ANI Type", "mip6.acc_net_id.ani",
4953         FT_UINT8, BASE_DEC, VALS(mmip6_opt_acc_net_id_sub_opt_vals), 0x0,
4954         NULL, HFILL }
4955     },
4956 
4957     { &hf_mip6_opt_acc_net_id_sub_opt_len,
4958       { "Length", "mip6.acc_net_id.sub_opt_len",
4959         FT_UINT8, BASE_DEC, NULL, 0x0,
4960         NULL, HFILL }
4961     },
4962 
4963     { &hf_mip6_opt_acc_net_id_sub_opt_e_bit,
4964       { "E(Encoding)", "mip6.acc_net_id.e_bit",
4965         FT_BOOLEAN, 8, TFS(&mip6_opt_acc_net_id_sub_opt_e_bit_value), 0x80,
4966         NULL, HFILL }
4967     },
4968 
4969     { &hf_mip6_opt_acc_net_id_sub_opt_net_name_len,
4970       { "Net-Name Length", "mip6.acc_net_id.net_name_len",
4971         FT_UINT8, BASE_DEC, NULL, 0x0,
4972         NULL, HFILL }
4973     },
4974 
4975     { &hf_mip6_opt_acc_net_id_sub_opt_net_name,
4976       { "Network Name", "mip6.acc_net_id.net_name",
4977         FT_STRING, BASE_NONE, NULL, 0x0,
4978         NULL, HFILL }
4979     },
4980 
4981     { &hf_mip6_opt_acc_net_id_sub_opt_net_name_data,
4982       { "Network Name", "mip6.acc_net_id.net_name_data",
4983         FT_BYTES, BASE_NONE, NULL, 0x0,
4984         "Network Name with undefined format", HFILL }
4985     },
4986 
4987     { &hf_mip6_opt_acc_net_id_sub_opt_ap_name_len,
4988       { "AP-Name Length", "mip6.acc_net_id.ap_name_len",
4989         FT_UINT8, BASE_DEC, NULL, 0x0,
4990         NULL, HFILL }
4991     },
4992 
4993     { &hf_mip6_opt_acc_net_id_sub_opt_ap_name,
4994       { "Access-Point Name", "mip6.acc_net_id.ap_name",
4995         FT_STRING, BASE_NONE, NULL, 0x0,
4996         NULL, HFILL }
4997     },
4998 
4999     { &hf_mip6_opt_acc_net_id_sub_opt_geo_latitude_degrees,
5000       { "Latitude Degrees", "mip6.acc_net_id.geo.latitude_degrees",
5001         FT_INT24, BASE_CUSTOM, CF_FUNC(degrees_base_custom), 0x0,
5002         NULL, HFILL }
5003     },
5004 
5005     { &hf_mip6_opt_acc_net_id_sub_opt_geo_longitude_degrees,
5006       { "Longitude Degrees", "mip6.acc_net_id.geo.longitude_degrees",
5007         FT_INT24, BASE_CUSTOM, CF_FUNC(degrees_base_custom), 0x0,
5008         NULL, HFILL }
5009     },
5010 
5011     { &hf_mip6_opt_acc_net_id_sub_opt_op_id_type,
5012       { "Op-ID Type", "mip6.acc_net_id.op_id.type",
5013         FT_UINT8, BASE_DEC, VALS(mip6_opt_acc_net_id_sub_opt_op_id_type), 0x0,
5014         NULL, HFILL }
5015     },
5016 
5017     { &hf_mip6_opt_acc_net_id_sub_opt_op_id,
5018       { "Op-ID", "mip6.acc_net_id.op_id",
5019         FT_BYTES, BASE_NONE, NULL, 0x0,
5020         NULL, HFILL }
5021     },
5022 
5023     { &hf_mip6_opt_dmnp_v_flag,
5024       { "IPv4 Prefix (V) flag", "mip6.dmnp.v_flag",
5025         FT_BOOLEAN, 8, TFS(&mip6_dmnp_v_flag_value), 0x80,
5026         NULL, HFILL }
5027     },
5028 
5029     { &hf_mip6_opt_dmnp_reserved,
5030       { "Reserved", "mip6.dmnp.reserved",
5031         FT_UINT8, BASE_DEC, NULL, 0x7F,
5032         NULL, HFILL }
5033     },
5034 
5035     { &hf_mip6_opt_dmnp_prefix_len,
5036       { "Prefix Length", "mip6.dmnp.prefix_len",
5037         FT_UINT8, BASE_DEC, NULL, 0,
5038         NULL, HFILL }
5039     },
5040     { &hf_mip6_opt_dmnp_dmnp_ipv4,
5041       { "IPv4 Delegated Mobile Network Prefix", "mip6.dmnp.dmnp_ipv4",
5042         FT_IPv4, BASE_NONE, NULL, 0,
5043         NULL, HFILL }
5044     },
5045     { &hf_mip6_opt_dmnp_dmnp_ipv6,
5046       { "IPv6 Delegated Mobile Network Prefix", "mip6.dmnp.dmnp_ipv6",
5047         FT_IPv6, BASE_NONE, NULL, 0,
5048         NULL, HFILL }
5049     },
5050 
5051 };
5052 
5053     /* Setup protocol subtree array */
5054     static gint *ett[] = {
5055         &ett_mip6,
5056         &ett_mip6_opts,
5057         &ett_mip6_opt_pad1,
5058         &ett_mip6_opt_padn,
5059         &ett_mip6_opt_bra,
5060         &ett_mip6_opt_acoa,
5061         &ett_mip6_opt_ni,
5062         &ett_mip6_opt_bad,
5063         &ett_fmip6_opt_lla,
5064         &ett_mip6_nemo_opt_mnp,
5065         &ett_mip6_opt_mnid,
5066         &ett_mip6_opt_auth,
5067         &ett_mip6_opt_mesgid,
5068         &ett_mip6_opt_cgapr,
5069         &ett_mip6_opt_cgar,
5070         &ett_mip6_opt_sign,
5071         &ett_mip6_opt_phkt,
5072         &ett_mip6_opt_mocoti,
5073         &ett_mip6_opt_mocot,
5074         &ett_mip6_opt_dnsu,
5075         &ett_mip6_opt_em,
5076         &ett_mip6_opt_vsm,
5077         &ett_mip6_opt_ssm,
5078         &ett_mip6_opt_badff,
5079         &ett_mip6_opt_unknown,
5080         &ett_pmip6_opt_hnp,
5081         &ett_pmip6_opt_hi,
5082         &ett_pmip6_opt_att,
5083         &ett_pmip6_opt_mnlli,
5084         &ett_pmip6_opt_lla,
5085         &ett_pmip6_opt_ts,
5086         &ett_pmip6_opt_rc,
5087         &ett_mip6_opt_ipv4ha,
5088         &ett_mip6_opt_ipv4aa,
5089         &ett_mip6_opt_natd,
5090         &ett_mip6_opt_ipv4coa,
5091         &ett_pmip6_opt_grek,
5092         &ett_pmip6_opt_mhipv6ap,
5093         &ett_pmip6_opt_bi,
5094         &ett_mip6_opt_ipv4hareq,
5095         &ett_mip6_opt_ipv4harep,
5096         &ett_mip6_opt_ipv4dra,
5097         &ett_mip6_opt_ipv4dsm,
5098         &ett_mip6_opt_cr,
5099         &ett_mip6_opt_lmaa,
5100         &ett_mip6_opt_recap,
5101         &ett_mip6_opt_redir,
5102         &ett_mip6_opt_load_inf,
5103         &ett_mip6_opt_alt_ip4,
5104         &ett_mip6_opt_mng,
5105         &ett_mip6_opt_mag_ipv6,
5106         &ett_mip6_opt_acc_net_id,
5107         &ett_mip6_sub_opt_acc_net_id,
5108         &ett_mip6_opt_dmnp,
5109     };
5110 
5111     static ei_register_info ei[] = {
5112         { &ei_mip6_ie_not_dissected, { "mip6.ie_not_dissected", PI_UNDECODED, PI_NOTE, "IE data not dissected yet", EXPFILL }},
5113         { &ei_mip6_ani_type_not_dissected, { "mip6.acc_net_id.ani.unknown", PI_UNDECODED, PI_NOTE, "ANI Type not dissect yet", EXPFILL }},
5114         { &ei_mip6_opt_len_invalid, { "mip6.opt.len.invalid", PI_PROTOCOL, PI_WARN, "Invalid length for option", EXPFILL }},
5115         { &ei_mip6_vsm_data_not_dissected, { "mip6.vsm.data_not_dissected", PI_UNDECODED, PI_NOTE, "Data (Not dissected yet)", EXPFILL }},
5116         { &ei_mip6_bogus_header_length, { "mip6.bogus_header_length", PI_PROTOCOL, PI_WARN, "Bogus header length", EXPFILL }},
5117     };
5118 
5119     expert_module_t* expert_mip6;
5120 
5121     /* Register the protocol name and description */
5122     proto_mip6 = proto_register_protocol("Mobile IPv6", "MIPv6", "mipv6");
5123 
5124     /* Register the dissector by name */
5125     mip6_handle = register_dissector("mip6", dissect_mip6, proto_mip6);
5126 
5127     /* Required function calls to register the header fields and subtrees used */
5128     proto_register_field_array(proto_mip6, hf, array_length(hf));
5129     proto_register_subtree_array(ett, array_length(ett));
5130     expert_mip6 = expert_register_protocol(proto_mip6);
5131     expert_register_field_array(expert_mip6, ei, array_length(ei));
5132 
5133     mip6_vsm_dissector_table = register_dissector_table("mip6.vsm", "Mobile IPv6 vendor specific option", proto_mip6, FT_UINT32, BASE_DEC);
5134     mip6_option_table = register_dissector_table("mip6.option", "MIPv6 Options", proto_mip6, FT_UINT8, BASE_DEC);
5135 
5136     /* Register MIPv6 options as their own protocols so we can get the name of the option */
5137     proto_mip6_option_pad1 = proto_register_protocol_in_name_only("MIPv6 Option - Pad1", "Pad1", "mip6.options.pad1", proto_mip6, FT_BYTES);
5138     proto_mip6_option_padn = proto_register_protocol_in_name_only("MIPv6 Option - PadN", "PadN", "mip6.options.padn", proto_mip6, FT_BYTES);
5139     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);
5140     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);
5141     proto_mip6_option_ni = proto_register_protocol_in_name_only("MIPv6 Option - Nonce Indices", "Nonce Indices", "mip6.options.ni", proto_mip6, FT_BYTES);
5142     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);
5143     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);
5144     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);
5145     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);
5146     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);
5147     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);
5148     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);
5149     proto_mip6_option_cgar = proto_register_protocol_in_name_only("MIPv6 Option - CGA Parameters", "CGA Parameters", "mip6.options.cgar", proto_mip6, FT_BYTES);
5150     proto_mip6_option_sign = proto_register_protocol_in_name_only("MIPv6 Option - Signature", "Signature", "mip6.options.sign", proto_mip6, FT_BYTES);
5151     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);
5152     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);
5153     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);
5154     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);
5155     proto_mip6_option_em = proto_register_protocol_in_name_only("MIPv6 Option - Experimental", "Experimental", "mip6.options.em", proto_mip6, FT_BYTES);
5156     proto_mip6_option_vsm = proto_register_protocol_in_name_only("MIPv6 Option - Vendor Specific", "Vendor Specific", "mip6.options.vsm", proto_mip6, FT_BYTES);
5157     proto_mip6_option_ssm = proto_register_protocol_in_name_only("MIPv6 Option - Service Selection", "Service Selection", "mip6.options.ssm", proto_mip6, FT_BYTES);
5158     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);
5159     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);
5160     proto_mip6_option_hi = proto_register_protocol_in_name_only("MIPv6 Option - Handoff Indicator", "Handoff Indicator", "mip6.options.hi", proto_mip6, FT_BYTES);
5161     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);
5162     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);
5163     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);
5164     proto_mip6_option_ts = proto_register_protocol_in_name_only("MIPv6 Option - Timestamp", "Timestamp", "mip6.options.ts", proto_mip6, FT_BYTES);
5165     proto_mip6_option_rc = proto_register_protocol_in_name_only("MIPv6 Option - Restart Counter", "Restart Counter", "mip6.options.rc", proto_mip6, FT_BYTES);
5166     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);
5167     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);
5168     proto_mip6_option_natd = proto_register_protocol_in_name_only("MIPv6 Option - NAT Detection", "NAT Detection", "mip6.options.natd", proto_mip6, FT_BYTES);
5169     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);
5170     proto_mip6_option_grek = proto_register_protocol_in_name_only("MIPv6 Option - GRE Key", "GRE Key", "mip6.options.grek", proto_mip6, FT_BYTES);
5171     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);
5172     proto_mip6_option_bi = proto_register_protocol_in_name_only("MIPv6 Option - Binding Identifier", "Binding Identifier", "mip6.options.bi", proto_mip6, FT_BYTES);
5173     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);
5174     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);
5175     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);
5176     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);
5177     proto_mip6_option_cr = proto_register_protocol_in_name_only("MIPv6 Option - Context Request", "Context Request", "mip6.options.cr", proto_mip6, FT_BYTES);
5178     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);
5179     proto_mip6_option_recap = proto_register_protocol_in_name_only("MIPv6 Option - Redirect-Capability", "Redirect-Capability", "mip6.options.recap", proto_mip6, FT_BYTES);
5180     proto_mip6_option_redir = proto_register_protocol_in_name_only("MIPv6 Option - Redirect", "Redirect", "mip6.options.redir", proto_mip6, FT_BYTES);
5181     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);
5182     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);
5183     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);
5184     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);
5185     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);
5186     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);
5187 }
5188 
5189 void
proto_reg_handoff_mip6(void)5190 proto_reg_handoff_mip6(void)
5191 {
5192     dissector_add_uint("ip.proto", IP_PROTO_MIPV6_OLD, mip6_handle);
5193     dissector_add_uint("ip.proto", IP_PROTO_MIPV6, mip6_handle);
5194 
5195     /* Add support for PMIPv6 control messages over IPV4 */
5196     dissector_add_uint_with_preference("udp.port", UDP_PORT_PMIP6_CNTL, mip6_handle);
5197     ip_dissector_table = find_dissector_table("ip.proto");
5198 
5199     dissector_add_uint("mip6.vsm", VENDOR_THE3GPP, create_dissector_handle(dissect_mip6_opt_vsm_3gpp, proto_mip6));
5200 
5201 
5202     /* Create dissection function handles for all MIPv6 options */
5203     dissector_add_uint("mip6.option", MIP6_PADN, create_dissector_handle( dissect_mip6_opt_padn, proto_mip6_option_padn ));
5204     dissector_add_uint("mip6.option", MIP6_BRA, create_dissector_handle( dissect_mip6_opt_bra, proto_mip6_option_bra ));
5205     dissector_add_uint("mip6.option", MIP6_ACOA, create_dissector_handle( dissect_mip6_opt_acoa, proto_mip6_option_acoa ));
5206     dissector_add_uint("mip6.option", MIP6_NI, create_dissector_handle( dissect_mip6_opt_ni, proto_mip6_option_ni ));
5207     dissector_add_uint("mip6.option", MIP6_AUTD, create_dissector_handle( dissect_mip6_opt_bad, proto_mip6_option_bad_auth ));
5208     dissector_add_uint("mip6.option", MIP6_MNP, create_dissector_handle( dissect_mip6_nemo_opt_mnp, proto_mip6_option_mnp ));
5209     dissector_add_uint("mip6.option", MIP6_MHLLA, create_dissector_handle( dissect_fmip6_opt_lla, proto_mip6_option_mhlla ));
5210     dissector_add_uint("mip6.option", MIP6_MNID, create_dissector_handle( dissect_mip6_opt_mnid, proto_mip6_option_mnid ));
5211     dissector_add_uint("mip6.option", MIP6_AUTH, create_dissector_handle( dissect_mip6_opt_auth, proto_mip6_option_auth ));
5212     dissector_add_uint("mip6.option", MIP6_MESGID, create_dissector_handle( dissect_mip6_opt_mseg_id, proto_mip6_option_mseg_id ));
5213     dissector_add_uint("mip6.option", MIP6_CGAPR, create_dissector_handle( dissect_mip6_opt_cgapr, proto_mip6_option_cgapr ));
5214     dissector_add_uint("mip6.option", MIP6_CGAR, create_dissector_handle( dissect_mip6_opt_cgar, proto_mip6_option_cgar ));
5215     dissector_add_uint("mip6.option", MIP6_SIGN, create_dissector_handle( dissect_mip6_opt_sign, proto_mip6_option_sign ));
5216     dissector_add_uint("mip6.option", MIP6_PHKT, create_dissector_handle( dissect_mip6_opt_phkt, proto_mip6_option_phkt ));
5217     dissector_add_uint("mip6.option", MIP6_MOCOTI, create_dissector_handle( dissect_mip6_opt_coti, proto_mip6_option_coti ));
5218     dissector_add_uint("mip6.option", MIP6_MOCOT, create_dissector_handle( dissect_mip6_opt_mocot, proto_mip6_option_cot ));
5219     dissector_add_uint("mip6.option", MIP6_DNSU, create_dissector_handle( dissect_mip6_opt_dnsu, proto_mip6_option_dnsu ));
5220     dissector_add_uint("mip6.option", MIP6_EM, create_dissector_handle( dissect_mip6_opt_em, proto_mip6_option_em ));
5221     dissector_add_uint("mip6.option", MIP6_VSM, create_dissector_handle( dissect_mip6_opt_vsm, proto_mip6_option_vsm ));
5222     dissector_add_uint("mip6.option", MIP6_SSM, create_dissector_handle( dissect_mip6_opt_ssm, proto_mip6_option_ssm ));
5223     dissector_add_uint("mip6.option", MIP6_BADFF, create_dissector_handle( dissect_mip6_opt_badff, proto_mip6_option_badff ));
5224     dissector_add_uint("mip6.option", MIP6_HNP, create_dissector_handle( dissect_mip6_opt_hnp, proto_mip6_option_hnp ));
5225     dissector_add_uint("mip6.option", MIP6_MOHI, create_dissector_handle( dissect_pmip6_opt_hi, proto_mip6_option_hi ));
5226     dissector_add_uint("mip6.option", MIP6_ATT, create_dissector_handle( dissect_pmip6_opt_att, proto_mip6_option_att ));
5227     dissector_add_uint("mip6.option", MIP6_MNLLI, create_dissector_handle( dissect_pmip6_opt_mnlli, proto_mip6_option_mnlli ));
5228     dissector_add_uint("mip6.option", MIP6_LLA, create_dissector_handle( dissect_pmip6_opt_lla, proto_mip6_option_lla ));
5229     dissector_add_uint("mip6.option", MIP6_TS, create_dissector_handle( dissect_pmip6_opt_ts, proto_mip6_option_ts ));
5230     dissector_add_uint("mip6.option", MIP6_RC, create_dissector_handle( dissect_pmip6_opt_rc, proto_mip6_option_rc ));
5231     dissector_add_uint("mip6.option", MIP6_IPV4HA, create_dissector_handle( dissect_pmip6_opt_ipv4ha, proto_mip6_option_ipv4ha ));
5232     dissector_add_uint("mip6.option", MIP6_IPV4AA, create_dissector_handle( dissect_pmip6_opt_ipv4aa, proto_mip6_option_ipv4aa ));
5233     dissector_add_uint("mip6.option", MIP6_NATD, create_dissector_handle( dissect_pmip6_opt_natd, proto_mip6_option_natd ));
5234     dissector_add_uint("mip6.option", MIP6_IPV4COA, create_dissector_handle( dissect_pmip6_opt_ipv4coa, proto_mip6_option_ipv4coa ));
5235     dissector_add_uint("mip6.option", MIP6_GREK, create_dissector_handle( dissect_pmip6_opt_grek, proto_mip6_option_grek ));
5236     dissector_add_uint("mip6.option", MIP6_MHIPV6AP, create_dissector_handle( dissect_pmip6_opt_mhipv6ap, proto_mip6_option_mhipv6ap ));
5237     dissector_add_uint("mip6.option", MIP6_BI, create_dissector_handle( dissect_pmip6_opt_bi, proto_mip6_option_bi ));
5238     dissector_add_uint("mip6.option", MIP6_IPV4HAREQ, create_dissector_handle( dissect_pmip6_opt_ipv4hareq, proto_mip6_option_ipv4hareq ));
5239     dissector_add_uint("mip6.option", MIP6_IPV4HAREP, create_dissector_handle( dissect_pmip6_opt_ipv4harep, proto_mip6_option_ipv4harep ));
5240     dissector_add_uint("mip6.option", MIP6_IPV4DRA, create_dissector_handle( dissect_pmip6_opt_ipv4dra, proto_mip6_option_ipv4dra ));
5241     dissector_add_uint("mip6.option", MIP6_IPV4DSM, create_dissector_handle( dissect_pmip6_opt_ipv4dsm, proto_mip6_option_ipv4dsm ));
5242     dissector_add_uint("mip6.option", MIP6_CR, create_dissector_handle( dissect_pmip6_opt_cr, proto_mip6_option_cr ));
5243     dissector_add_uint("mip6.option", MIP6_LMAA, create_dissector_handle( dissect_pmip6_opt_lmaa, proto_mip6_option_lmaa ));
5244     dissector_add_uint("mip6.option", MIP6_RECAP, create_dissector_handle( dissect_pmip6_opt_recap, proto_mip6_option_recap ));
5245     dissector_add_uint("mip6.option", MIP6_REDIR, create_dissector_handle( dissect_pmip6_opt_redir, proto_mip6_option_redir ));
5246     dissector_add_uint("mip6.option", MIP6_LOAD_INF, create_dissector_handle( dissect_pmip6_opt_load_inf, proto_mip6_option_load_inf ));
5247     dissector_add_uint("mip6.option", MIP6_ALT_IP4_CO, create_dissector_handle( dissect_pmip6_opt_alt_ip4, proto_mip6_option_alt_ip4 ));
5248     dissector_add_uint("mip6.option", MIP6_MNG, create_dissector_handle( dissect_pmip6_opt_mng, proto_mip6_option_mng ));
5249     dissector_add_uint("mip6.option", MIP6_MAG_IPv6, create_dissector_handle( dissect_pmip6_opt_mag_ipv6, proto_mip6_option_mag_ipv6 ));
5250     dissector_add_uint("mip6.option", MIP6_ACC_NET_ID, create_dissector_handle( dissect_pmip6_opt_acc_net_id, proto_mip6_option_acc_net_id ));
5251     dissector_add_uint("mip6.option", MIP6_DMNP, create_dissector_handle( dissect_mip6_opt_dmnp, proto_mip6_option_dmnp ));
5252 }
5253 
5254 /*
5255  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
5256  *
5257  * Local variables:
5258  * c-basic-offset: 4
5259  * tab-width: 8
5260  * indent-tabs-mode: nil
5261  * End:
5262  *
5263  * vi: set shiftwidth=4 tabstop=8 expandtab:
5264  * :indentSize=4:tabSize=8:noTabs=true:
5265  */
5266