HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-mip.c
blobebe5a5c703d5c929e68e33f076cbde95c6bfee9b
1 /* packet-mip.c
2 * Routines for Mobile IP dissection
3 * Copyright 2000, Stefan Raab <sraab@cisco.com>
4 * Copyright 2007, Ville Nuorvala <Ville.Nuorvala@secgo.com>
5 * Copyright 2009, Ohuchi Munenori <ohuchi_at_iij.ad.jp>
6 * Copyright 2010, Yi Ren <yi_ren1@agilent.com>
8 * $Id$
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "config.h"
31 #include <glib.h>
33 #include <epan/packet.h>
34 #include <epan/to_str.h>
35 #include <epan/sminmpec.h>
37 void proto_register_mip(void);
38 void proto_reg_handoff_mip(void);
40 static dissector_table_t mip_nvse_ext_dissector_table;
42 /* Initialize the protocol and registered fields */
43 static int proto_mip = -1;
44 static int hf_mip_type = -1;
45 static int hf_mip_flags = -1;
46 static int hf_mip_s = -1;
47 static int hf_mip_b = -1;
48 static int hf_mip_d = -1;
49 static int hf_mip_m = -1;
50 static int hf_mip_g = -1;
51 static int hf_mip_v = -1;
52 static int hf_mip_t = -1;
53 static int hf_mip_x = -1;
54 static int hf_mip_code = -1;
55 static int hf_mip_life = -1;
56 static int hf_mip_homeaddr = -1;
57 static int hf_mip_haaddr = -1;
58 static int hf_mip_coa = -1;
59 static int hf_mip_ident = -1;
60 static int hf_mip_ext_type = -1;
61 static int hf_mip_gaext_stype = -1;
62 static int hf_mip_ext_len = -1;
63 static int hf_mip_ext = -1;
64 static int hf_mip_aext_spi = -1;
65 static int hf_mip_aext_auth = -1;
66 static int hf_mip_next_nai = -1;
67 static int hf_mip_rext_flags = -1;
68 static int hf_mip_rext_i = -1;
69 static int hf_mip_rext_reserved = -1;
70 static int hf_mip_rext_tstamp = -1;
71 static int hf_mip_rev_reserved = -1;
72 static int hf_mip_rev_a = -1;
73 static int hf_mip_rev_i = -1;
74 /* static int hf_mip_rev_reserved2 = -1; */
75 static int hf_mip_ack_reserved = -1;
76 static int hf_mip_ack_i = -1;
77 /* static int hf_mip_ack_reserved2 = -1; */
78 static int hf_mip_hda = -1;
79 static int hf_mip_fda = -1;
80 static int hf_mip_revid = -1;
81 static int hf_mip_dhaext_stype = -1;
82 static int hf_mip_dhaext_addr = -1;
83 static int hf_mip_mstrext_stype = -1;
84 static int hf_mip_mstrext_text = -1;
85 static int hf_mip_nattt_nexthdr = -1;
86 static int hf_mip_nattt_reserved = -1;
87 static int hf_mip_utrqext_stype = -1;
88 static int hf_mip_utrqext_reserved1 = -1;
89 static int hf_mip_utrqext_flags = -1;
90 static int hf_mip_utrqext_f = -1;
91 static int hf_mip_utrqext_r = -1;
92 static int hf_mip_utrqext_reserved2 = -1;
93 static int hf_mip_utrqext_encap_type = -1;
94 static int hf_mip_utrqext_reserved3 = -1;
95 static int hf_mip_utrpext_stype = -1;
96 static int hf_mip_utrpext_code = -1;
97 static int hf_mip_utrpext_flags = -1;
98 static int hf_mip_utrpext_f = -1;
99 static int hf_mip_utrpext_reserved = -1;
100 static int hf_mip_utrpext_keepalive = -1;
101 static int hf_mip_pmipv4nonskipext_stype = -1;
102 static int hf_mip_pmipv4nonskipext_pernodeauthmethod = -1;
103 static int hf_mip_pmipv4skipext_stype = -1;
104 static int hf_mip_pmipv4skipext_interfaceid = -1;
105 static int hf_mip_pmipv4skipext_deviceid_type = -1;
106 static int hf_mip_pmipv4skipext_deviceid_id = -1;
107 static int hf_mip_pmipv4skipext_subscriberid_type = -1;
108 static int hf_mip_pmipv4skipext_subscriberid_id = -1;
109 static int hf_mip_pmipv4skipext_accesstechnology_type = -1;
110 static int hf_mip_cvse_reserved = -1;
111 static int hf_mip_cvse_vendor_org_id = -1;
112 static int hf_mip_cvse_verizon_cvse_type = -1;
113 static int hf_mip_cvse_3gpp2_cvse_type = -1;
114 static int hf_mip_cvse_3gpp2_grekey = -1;
115 static int hf_mip_cvse_vendor_cvse_type = -1;
116 static int hf_mip_cvse_vendor_cvse_value = -1;
117 static int hf_mip_nvse_reserved = -1;
118 static int hf_mip_nvse_vendor_org_id = -1;
119 static int hf_mip_nvse_vendor_nvse_type = -1;
120 static int hf_mip_nvse_vendor_nvse_value = -1;
121 static int hf_mip_nvse_3gpp2_type = -1;
122 static int hf_mip_nvse_3gpp2_type17_entity = -1;
123 static int hf_mip_nvse_3gpp2_type16_value = -1;
124 static int hf_mip_nvse_3gpp2_type17_subtype1 = -1;
125 static int hf_mip_nvse_3gpp2_type17_subtype2 = -1;
126 static int hf_mip_nvse_3gpp2_type17_length = -1;
127 static int hf_mip_nvse_3gpp2_type17_prim_dns = -1;
128 static int hf_mip_nvse_3gpp2_type17_sec_dns = -1;
130 /* Initialize the subtree pointers */
131 static gint ett_mip = -1;
132 static gint ett_mip_flags = -1;
133 static gint ett_mip_ext = -1;
134 static gint ett_mip_exts = -1;
135 static gint ett_mip_pmipv4_ext = -1;
137 /* Port used for Mobile IP */
138 #define UDP_PORT_MIP 434
140 /* http://www.iana.org/assignments/mobileip-numbers */
141 typedef enum {
142 MIP_REGISTRATION_REQUEST = 1,
143 MIP_REGISTRATION_REPLY = 3,
144 MIP_NATT_TUNNEL_DATA = 4,
145 MIP_REGISTRATION_REVOCATION = 7,
146 MIP_REGISTRATION_REVOCATION_ACK = 15,
147 MIP_HANDOFF_REQEST = 16,
148 MIP_HANDOFF_REPLY = 17,
149 MIP_REGIONAL_REG_REQ = 18,
150 MIP_REGIONAL_REG_REP = 19,
151 MIP_FAST_BINDING_UPD = 20,
152 MIP_FAST_BINDING_ACK = 21,
153 MIP_EXPERIMENTAL_MESSAGE = 255
154 } mipMessageTypes;
156 static const value_string mip_types[] = {
157 {MIP_REGISTRATION_REQUEST, "Registration Request"},
158 {MIP_REGISTRATION_REPLY, "Registration Reply"},
159 {MIP_NATT_TUNNEL_DATA, "NAT Traversal Tunnel Data"},
160 {MIP_REGISTRATION_REVOCATION, "Registration Revocation"},
161 {MIP_REGISTRATION_REVOCATION_ACK, "Registration Revocation Acknowledgement"},
162 {MIP_HANDOFF_REQEST, "NAT Traversal Tunnel Data"},
163 {MIP_HANDOFF_REPLY, "NAT Traversal Tunnel Data"},
164 {MIP_REGIONAL_REG_REQ, "NAT Traversal Tunnel Data"},
165 {MIP_REGIONAL_REG_REP, "NAT Traversal Tunnel Data"},
166 {MIP_FAST_BINDING_UPD, "NAT Traversal Tunnel Data"},
167 {MIP_FAST_BINDING_ACK, "NAT Traversal Tunnel Data"},
168 {MIP_EXPERIMENTAL_MESSAGE, "Message for Experimental Use"},
169 {0, NULL}
172 static const value_string mip_reply_codes[]= {
173 {0, "Reg Accepted"},
174 {1, "Reg Accepted, but Simultaneous Bindings Unsupported"},
175 {64, "Reg Deny (FA)- Unspecified Reason"},
176 {65, "Reg Deny (FA)- Administratively Prohibited"},
177 {66, "Reg Deny (FA)- Insufficient Resources"},
178 {67, "Reg Deny (FA)- MN Failed Authentication"},
179 {68, "Reg Deny (FA)- HA Failed Authentication"},
180 {69, "Reg Deny (FA)- Requested Lifetime too Long"},
181 {70, "Reg Deny (FA)- Poorly Formed Request"},
182 {71, "Reg Deny (FA)- Poorly Formed Reply"},
183 {72, "Reg Deny (FA)- Requested Encapsulation Unavailable"},
184 {73, "Reg Deny (FA)- VJ Compression Unavailable"},
185 {74, "Reg Deny (FA)- Requested Reverse Tunnel Unavailable"},
186 {75, "Reg Deny (FA)- Reverse Tunnel Is Mandatory and 'T' Bit Not Set"},
187 {76, "Reg Deny (FA)- Mobile Node Too Distant"},
188 {77, "Reg Deny (FA)- Invalid Care-of Address"},
189 {78, "Reg Deny (FA)- Registration Timeout"},
190 {79, "Reg Deny (FA)- Delivery Style Not Supported"},
191 {80, "Reg Deny (FA)- Home Network Unreachable"},
192 {81, "Reg Deny (FA)- HA Host Unreachable"},
193 {82, "Reg Deny (FA)- HA Port Unreachable"},
194 {88, "Reg Deny (FA)- HA Unreachable"},
195 {89, "Reg Deny (FA)- Vendor-specific Reason"},
196 {90, "Reg Deny (FA)- Non-zero HA Address Required"},
197 {96, "Reg Deny (FA)(NAI) - Non-zero Home Address Required"},
198 {97, "Reg Deny (FA)(NAI) - Missing NAI"},
199 {98, "Reg Deny (FA)(NAI) - Missing Home Agent"},
200 {99, "Reg Deny (FA)(NAI) - Missing Home Address"},
201 {100, "Reg Deny (FA)- Unable to Interpret CVSE Sent by MN"},
202 {101, "Reg Deny (FA)- Unable to Interpret CVSE Sent by HA"},
203 {104, "Reg Deny (FA)- Unknown Challenge"},
204 {105, "Reg Deny (FA)- Missing Challenge"},
205 {106, "Reg Deny (FA)- Stale Challenge"},
206 {107, "Reg Deny (FA)- Missing MN-FA Key Generation Nonce Reply Extension"},
207 {108, "Reg Deny (FA)- MN Failed AAA Authentication"},
208 {109, "Reg Deny (FA)- HA Sent Wrong Challenge in Reply"},
209 {127, "Reg Deny (FA)- Error Code for Experimental Use"},
210 {128, "Reg Deny (HA)- Unspecified"},
211 {129, "Reg Deny (HA)- Administratively Prohibited"},
212 {130, "Reg Deny (HA)- Insufficient Resources"},
213 {131, "Reg Deny (HA)- MN Failed Authentication"},
214 {132, "Reg Deny (HA)- FA Failed Authentication"},
215 {133, "Reg Deny (HA)- Registration ID Mismatch"},
216 {134, "Reg Deny (HA)- Poorly Formed Request"},
217 {135, "Reg Deny (HA)- Too Many Simultaneous Bindings"},
218 {136, "Reg Deny (HA)- Unknown HA Address"},
219 {137, "Reg Deny (HA)- Requested Reverse Tunnel Unavailable"},
220 {138, "Reg Deny (HA)- Reverse Tunnel Is Mandatory and 'T' Bit Not Set"},
221 {139, "Reg Deny (HA)- Requested Encapsulation Unavailable"},
222 {140, "Reg Deny (HA)- Unable to Interpret CVSE Sent by MN"},
223 {141, "Reg Deny (HA)- Unable to Interpret CVSE Sent by FA"},
224 {142, "Reg Deny (HA)- UDP Encapsulation Unavailable"},
225 {143, "Reg Deny (HA)- Register with Redirected HA"},
226 {144, "Reg Deny (HA)- MN Failed AAA Authentication"},
227 {149, "Reg Deny (HA)- PMIP_UNSUPPORTED"}, /* draft-leung-mip4-proxy-mode */
228 {150, "Reg Deny (HA)- PMIP_DISALLOWED"}, /* draft-leung-mip4-proxy-mode */
229 {192, "Reg Deny (HA)- Error Code for Experimental Use"},
230 {0, NULL}
233 static const value_string mip_nattt_nexthdr[]= {
234 {4, "IP Header"},
235 {47, "GRE Header"},
236 {55, "Minimal IP Encapsulation Header"},
237 {0, NULL}
240 typedef enum {
241 MH_AUTH_EXT = 32,
242 MF_AUTH_EXT = 33,
243 FH_AUTH_EXT = 34,
244 GEN_AUTH_EXT = 36, /* RFC 3012 */
245 OLD_CVSE_EXT = 37, /* RFC 3115 */
246 CVSE_EXT = 38, /* RFC 3115 */
247 UDP_TUN_REP_EXT = 44, /* RFC 3519 */
248 MIP_FA_ERROR_EXT = 45, /* [RFC4636] */
249 MIP_GFA_IP_ADDR_EXT = 46, /* [RFC4857] */
250 PMIPv4_NON_SKIP_EXT = 47, /* [RFC5563] */
251 MN_NAI_EXT = 131, /* RFC 2794 */
252 MF_CHALLENGE_EXT = 132, /* RFC 3012 */
253 OLD_NVSE_EXT = 133, /* RFC 3115 */
254 NVSE_EXT = 134, /* RFC 3115 */
255 REV_SUPP_EXT = 137, /* RFC 3543 */
256 DYN_HA_EXT = 139, /* RFC 4433 */
257 UDP_TUN_REQ_EXT = 144, /* RFC 3519 */
258 MSG_STR_EXT = 145,
259 PMIPv4_SKIP_EXT = 147, /* draft-leung-mip4-proxy-mode */
260 SKIP_EXP_EXT = 255, /* RFC 4064 */
261 GRE_KEY_EXT = 0x0401
262 } MIP_EXTS;
264 static const value_string mip_ext_types[]= {
265 {MH_AUTH_EXT, "Mobile-Home Authentication Extension"},
266 {MF_AUTH_EXT, "Mobile-Foreign Authentication Extension"},
267 {FH_AUTH_EXT, "Foreign-Home Authentication Extension"},
268 {GEN_AUTH_EXT, "Generalized Mobile-IP Authentication Extension"},
269 {OLD_CVSE_EXT, "Critical Vendor/Organization Specific Extension"},
270 {CVSE_EXT, "Critical Vendor/Organization Specific Extension"},
271 {UDP_TUN_REP_EXT, "UDP Tunnel Reply Extension"},
272 {MIP_FA_ERROR_EXT, "FA Error Extension"},
273 {MIP_GFA_IP_ADDR_EXT, "GFA IP Address Extension"},
274 {PMIPv4_NON_SKIP_EXT, "Proxy Mobile IPv4 Non-skippable Extension"},
275 {128, "Deprecated (2001 Aug 31)"},
276 {129, "SKIP Firewall Traversal Extension"}, /*[RFC2356]*/
277 {130, "Encapsulating Delivery Style Extension"}, /*[RFC3024]*/
278 {MN_NAI_EXT, "Mobile Node NAI Extension"},
279 {MF_CHALLENGE_EXT, "MN-FA Challenge Extension"},
280 {OLD_NVSE_EXT, "Normal Vendor/Organization Specific Extension"},
281 {NVSE_EXT, "Normal Vendor/Organization Specific Extension"},
282 {136, "NAI Carrying Extension"}, /*[RFC3846]*/
283 {REV_SUPP_EXT, "Revocation Support Extension"},
284 {138, "Generalized Link Layer Address Registration Extension"}, /*[RFC4881]*/
285 {DYN_HA_EXT, "Dynamic HA Extension"},
286 {140, "Hierarchical Foreign Agent Extension"}, /*[RFC4857]*/
287 {141, "Replay Protection Style"}, /*[RFC4857]*/
288 {142, "Regional Registration Lifetime Extension"}, /*[RFC4857]*/
289 {UDP_TUN_REQ_EXT, "UDP Tunnel Request Extension"},
290 {MSG_STR_EXT, "Message String Extension"},
291 {PMIPv4_SKIP_EXT, "Proxy Mobile IPv4 Skippable Extension"},
292 {148, "Mobile Network Extension"}, /*[RFC5177]*/
293 {149, "Trusted Networks Configured (TNC) Extension"}, /*[RFC5265]*/
294 {150, "Reserved"},
295 {151, "Service Selection Extension"}, /*[RFC5446]*/
296 {152, "Dual Stack (DSMIPv4) Extension"}, /*[RFC5454]*/
297 {SKIP_EXP_EXT, "Skippable Extension for Experimental use"},
298 {0, NULL}
301 static const value_string mip_gaext_stypes[]= {
302 {1, "MN-AAA Authentication"},
303 {2, "FA-FA Authentication"},
304 {3, "MN-GFA Authentication"},
305 {4, "MN-PAR Auth Extension"},
306 {0, NULL}
309 /* UDP Tunnel Reply Extension: */
310 static const value_string mip_utrpext_stypes[]= {
311 {0, "Regular UDP Tunnel Reply Extension"},
312 {0, NULL}
315 /* Dynamic HA Extension subtypes */
316 static const value_string mip_dhaext_stypes[]= {
317 {1, "Requested HA Extension"},
318 {2, "Redirected HA Extension"},
319 {0, NULL}
322 static const value_string mip_mstrext_stypes[]= {
323 {1, "HA Extension"},
324 {2, "FA Extension"},
325 {0, NULL}
328 static const value_string mip_utrqext_stypes[]= {
329 {0, ""},
330 {0, NULL}
333 static const value_string mip_utrqext_encap_types[]= {
334 {4, "IP Header"},
335 {47, "GRE Header"},
336 {55, "Minimal IP Encapsulation Header"},
337 {0, NULL}
341 static const value_string mip_utrpext_codes[]= {
342 {0, "Will do Tunneling"},
343 {64, "Tunneling Declined, Reason Unspecified"},
344 {0, NULL}
347 static const value_string mip_pmipv4nonskipext_stypes[]= {
348 {0, "Unknown"},
349 {1, "Per-Node Authentication Method"},
350 {0, NULL}
353 /* PMIPv4 Per-Node Authentication Method Types */
354 static const value_string mip_pmipv4nonskipext_pernodeauthmethod_types[]= {
355 {0, "Reserved"},
356 {1, "FA-HA Authentication"},
357 {2, "IPSec Authentication"},
358 {0, NULL}
361 #define PMIPv4_SKIPEXT_STYPE_INTERFACE_ID (1)
362 #define PMIPv4_SKIPEXT_STYPE_DEVICE_ID (2)
363 #define PMIPv4_SKIPEXT_STYPE_SUBSCRIBER_ID (3)
364 #define PMIPv4_SKIPEXT_STYPE_ACCESS_TECHNOLOGY (4)
365 static const value_string mip_pmipv4skipext_stypes[]= {
366 {0, "Unknown"},
367 {PMIPv4_SKIPEXT_STYPE_INTERFACE_ID, "Interface ID"},
368 {PMIPv4_SKIPEXT_STYPE_DEVICE_ID, "Device ID"},
369 {PMIPv4_SKIPEXT_STYPE_SUBSCRIBER_ID, "Subscriber ID"},
370 {PMIPv4_SKIPEXT_STYPE_ACCESS_TECHNOLOGY, "Access Technology Type"},
371 {0, NULL}
374 /* PMIPv4 Device ID Types */
375 static const value_string mip_pmipv4skipext_deviceid_types[]= {
376 {0, "Reserved"},
377 {1, "Ethernet MAC address"},
378 {2, "Mobile Equipment Identifier (MEID)"},
379 {3, "International Mobile Equipment Identity (IMEI)"},
380 {4, "Electronic Serial Number (ESN)"},
381 {0, NULL}
384 /* PMIPv4 Subscriber ID Types */
385 static const value_string mip_pmipv4skipext_subscriberid_types[]= {
386 {0, "Reserved"},
387 {1, "International Mobile Subscriber Identity (IMSI)"},
388 {0, NULL}
391 /* Access Technology Types */
392 static const value_string mip_pmipv4skipext_accesstechnology_types[]= {
393 {0, "Reserved"},
394 {1, "802.3"},
395 {2, "802.11a/b/g"},
396 {3, "802.16e"},
397 {4, "802.16m"},
398 {5, "3GPP EUTRAN/LTE"},
399 {6, "3GPP UTRAN/GERAN"},
400 {7, "3GPP2 1xRTT/HRPD"},
401 {8, "3GPP2 UMB"},
402 {0, NULL}
405 static const value_string mip_cvse_verizon_cvse_types[]= {
406 {0, "Reserved"},
407 {1, "MIP Key Request"},
408 {2, "MIP Key Data"},
409 {3, "AAA Authenticator"},
410 {4, "Public Key Invalid"},
411 {0, NULL}
414 /*http://www.3gpp2.org/public_html/X/VSA-VSE.cfm*/
415 #if 0
416 static const value_string mip_cvse_3gpp2_cvse_types[]= {
417 {257, "Accounting/Radius"},
418 {258, "Accounting/Diameter"},
419 {513, "Accounting/Diameter"},
420 {769, "Data Available Indicator/Data Ready to Send"},
421 {1025,"GRE Key"},
422 {1281, "Binding Type Extension"},
423 {1537, "GRE Tunnel Endpoint Extension"},
424 {0, NULL}
426 #endif
429 static const value_string mip_nvse_3gpp2_type_vals[]= {
430 {16, "PPP Link Indicator"}, /* X.S0011-003-C v1.0 */
431 {17, "DNS server IP address"},
432 {0, NULL}
435 static const value_string mip_nvse_3gpp2_type17_entity_vals[]= {
436 {0, "Unknown"},
437 {1, "HAAA"},
438 {2, "VAAA"},
439 {3, "HA"},
440 {0, NULL}
443 static const value_string mip_nvse_3gpp2_type17_vals[]= {
444 {0, "main service instance"},
445 {1, "negotiate PPP"},
446 {2, "do not negotiate PPP"},
447 {0, NULL}
450 static dissector_handle_t ip_handle;
452 /* Code to dissect 3GPP2 extensions */
454 static int
455 dissect_mip_priv_ext_3gpp2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
457 int offset = 0;
458 guint16 type;
459 int length = tvb_reported_length(tvb);
461 type = tvb_get_ntohs(tvb,offset);
462 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type, tvb, offset, 2, ENC_BIG_ENDIAN);
463 offset+=2;
465 switch(type){
466 case 16: /* PPP Link Indicato X.S0011-003-C v1.0 */
467 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type16_value, tvb, offset, 2, ENC_BIG_ENDIAN);
468 break;
469 case 17: /* DNS server IP address X.S0011-002-C v3.0*/
470 /* Entity-Type */
471 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_entity, tvb, offset, 1, ENC_BIG_ENDIAN);
472 offset++;
473 /* Sub-Type1 */
474 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_subtype1, tvb, offset, 1, ENC_BIG_ENDIAN);
475 offset++;
476 /* Length */
477 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_length, tvb, offset, 1, ENC_BIG_ENDIAN);
478 offset++;
479 /* DNS server IP address */
480 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_prim_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
481 offset+=4;
482 /* Sub-Type2 */
483 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_subtype2, tvb, offset, 1, ENC_BIG_ENDIAN);
484 offset++;
485 /* Length */
486 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_length, tvb, offset, 1, ENC_BIG_ENDIAN);
487 offset++;
488 /* DNS server IP address.*/
489 proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_sec_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
490 break;
491 default:
492 proto_tree_add_text(tree, tvb, offset, -1, " Data not dissected yet");
493 break;
496 return length;
499 /* Code to dissect extensions */
500 static void
501 dissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo)
503 proto_item *ti;
504 proto_tree *exts_tree=NULL;
505 proto_tree *ext_tree;
506 proto_tree *tf;
507 proto_tree *ext_flags_tree;
508 proto_tree *tp;
509 proto_tree *pmipv4_tree;
510 gint ext_len;
511 guint8 ext_type;
512 guint8 ext_subtype=0;
513 guint8 pmipv4skipext_subscriberid_type;
514 guint16 flags;
515 gint hdrLen;
516 guint32 cvse_vendor_id;
517 guint16 cvse_3gpp2_type;
518 int cvse_local_offset= 0;
519 int nvse_local_offset= 0;
521 /* None of this really matters if we don't have a tree */
522 if (!tree) return;
524 /* Add our tree, if we have extensions */
525 ti = proto_tree_add_text(tree, tvb, offset, -1, "Extensions");
526 exts_tree = proto_item_add_subtree(ti, ett_mip_exts);
528 /* And, handle each extension */
529 while (tvb_reported_length_remaining(tvb, offset) > 0) {
531 /* Get our extension info */
532 ext_type = tvb_get_guint8(tvb, offset);
533 if (ext_type == GEN_AUTH_EXT || ext_type == PMIPv4_NON_SKIP_EXT) {
535 * Very nasty . . breaks normal extensions, since the length is
536 * in the wrong place :(
538 ext_subtype = tvb_get_guint8(tvb, offset + 1);
539 ext_len = tvb_get_ntohs(tvb, offset + 2);
540 hdrLen = 4;
542 else if(ext_type==CVSE_EXT){
544 * CVSE also breaks since it added reserved field before
545 * the length field
547 ext_len = tvb_get_ntohs(tvb, offset + 2);
548 hdrLen = 4;
550 else {
551 ext_len = tvb_get_guint8(tvb, offset + 1);
552 hdrLen = 2;
555 ti = proto_tree_add_text(exts_tree, tvb, offset, ext_len + hdrLen,
556 "Extension: %s",
557 val_to_str(ext_type, mip_ext_types,
558 "Unknown Extension %u"));
559 ext_tree = proto_item_add_subtree(ti, ett_mip_ext);
561 proto_tree_add_uint(ext_tree, hf_mip_ext_type, tvb, offset, 1, ext_type);
562 offset++;
563 if (ext_type != GEN_AUTH_EXT &&
564 ext_type != PMIPv4_NON_SKIP_EXT &&
565 ext_type != CVSE_EXT) {
566 /* Another nasty hack since GEN_AUTH_EXT and PMIPv4_NON_SKIP_EXT broke everything */
567 proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 1, ext_len);
568 offset++;
571 switch (ext_type) {
572 case MH_AUTH_EXT:
573 case MF_AUTH_EXT:
574 case FH_AUTH_EXT:
575 /* All these extensions look the same. 4 byte SPI followed by a key */
576 proto_tree_add_item(ext_tree, hf_mip_aext_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
577 proto_tree_add_item(ext_tree, hf_mip_aext_auth, tvb, offset+4, ext_len-4, ENC_NA);
578 break;
579 case MN_NAI_EXT:
580 proto_tree_add_item(ext_tree, hf_mip_next_nai, tvb, offset,
581 ext_len, ENC_ASCII|ENC_NA);
582 break;
584 case GEN_AUTH_EXT: /* RFC 3012 */
586 * Very nasty . . breaks normal extensions, since the length is
587 * in the wrong place :(
589 proto_tree_add_uint(ext_tree, hf_mip_gaext_stype, tvb, offset, 1, ext_subtype);
590 offset++;
591 proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 2, ext_len);
592 offset+=2;
593 /* SPI */
594 proto_tree_add_item(ext_tree, hf_mip_aext_spi, tvb, offset, 4, ENC_BIG_ENDIAN);
595 /* Key */
596 proto_tree_add_item(ext_tree, hf_mip_aext_auth, tvb, offset + 4,
597 ext_len - 4, ENC_NA);
599 break;
600 case REV_SUPP_EXT: /* RFC 3543 */
601 /* flags */
602 flags = tvb_get_ntohs(tvb, offset);
603 tf = proto_tree_add_uint(ext_tree, hf_mip_rext_flags, tvb, offset, 2, flags);
604 ext_flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
605 proto_tree_add_boolean(ext_flags_tree, hf_mip_rext_i, tvb, offset, 2, flags);
607 /* reserved */
608 proto_tree_add_uint(ext_flags_tree, hf_mip_rext_reserved, tvb, offset, 2, flags);
609 /* registration revocation timestamp */
610 proto_tree_add_item(ext_tree, hf_mip_rext_tstamp, tvb, offset + 2, 4, ENC_BIG_ENDIAN);
611 break;
612 case DYN_HA_EXT: /* RFC 4433 */
613 /* subtype */
614 proto_tree_add_item(ext_tree, hf_mip_dhaext_stype, tvb, offset, 1, ENC_BIG_ENDIAN);
615 /* Home Agent */
616 proto_tree_add_item(ext_tree, hf_mip_dhaext_addr, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
617 break;
618 case MSG_STR_EXT:
619 /* sub-type */
620 proto_tree_add_item(ext_tree, hf_mip_mstrext_stype, tvb, offset, 1, ENC_BIG_ENDIAN);
622 /* text */
623 proto_tree_add_item(ext_tree, hf_mip_mstrext_text, tvb, offset + 1, ext_len-1, ENC_ASCII|ENC_NA);
624 break;
625 case UDP_TUN_REQ_EXT: /* RFC 3519 */
626 /* sub-type */
627 proto_tree_add_item(ext_tree, hf_mip_utrqext_stype, tvb, offset, 1, ENC_BIG_ENDIAN);
629 /* reserved 1 */
630 proto_tree_add_item(ext_tree, hf_mip_utrqext_reserved1, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
632 /* flags */
633 flags = tvb_get_guint8(tvb, offset + 2);
634 tf = proto_tree_add_uint(ext_tree, hf_mip_utrqext_flags, tvb, offset + 2, 1, flags);
635 ext_flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
636 proto_tree_add_boolean(ext_flags_tree, hf_mip_utrqext_f, tvb, offset + 2, 1, flags);
637 proto_tree_add_boolean(ext_flags_tree, hf_mip_utrqext_r, tvb, offset + 2, 1, flags);
639 /* reserved 2 */
640 proto_tree_add_uint(ext_flags_tree, hf_mip_utrqext_reserved2, tvb, offset + 2, 1, flags);
641 /* encapsulation */
642 proto_tree_add_item(ext_tree, hf_mip_utrqext_encap_type, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
644 /* reserved 3 */
645 proto_tree_add_item(ext_tree, hf_mip_utrqext_reserved3, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
646 break;
647 case UDP_TUN_REP_EXT: /* RFC 3519 */
648 /* sub-type */
649 proto_tree_add_item(ext_tree, hf_mip_utrpext_stype, tvb, offset, 1, ENC_BIG_ENDIAN);
651 /* code */
652 proto_tree_add_item(ext_tree, hf_mip_utrpext_code, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
654 /* flags */
655 flags = tvb_get_ntohs(tvb, offset+2);
656 tf = proto_tree_add_uint(ext_tree, hf_mip_utrpext_flags, tvb, offset + 2, 2, flags);
657 ext_flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
658 proto_tree_add_boolean(ext_flags_tree, hf_mip_utrpext_f, tvb, offset + 2, 2, flags);
660 /* reserved */
661 proto_tree_add_uint(ext_flags_tree, hf_mip_utrpext_reserved, tvb, offset + 2, 2, flags);
663 /* keepalive interval */
664 proto_tree_add_item(ext_tree, hf_mip_utrpext_keepalive, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
665 break;
666 case PMIPv4_NON_SKIP_EXT: /* draft-leung-mip4-proxy-mode */
667 /* sub-type */
668 proto_tree_add_uint(ext_tree, hf_mip_pmipv4nonskipext_stype, tvb, offset, 1, ext_subtype);
669 offset++;
670 /* len */
671 proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 2, ext_len);
672 offset+=2;
673 if(ext_subtype == 1){
674 /* Sub-type == 1 : PMIPv4 Per-Node Authentication Method */
675 proto_tree_add_item(ext_tree, hf_mip_pmipv4nonskipext_pernodeauthmethod, tvb, offset, 1, ENC_BIG_ENDIAN);
677 break;
678 case PMIPv4_SKIP_EXT: /* draft-leung-mip4-proxy-mode */
679 /* sub-type */
680 ext_subtype = tvb_get_guint8(tvb, offset);
681 tp = proto_tree_add_text(ext_tree, tvb, offset, ext_len,
682 "PMIPv4 Sub-Type: %s",
683 val_to_str(ext_subtype, mip_pmipv4skipext_stypes, "Unknown Sub-Type %u"));
684 pmipv4_tree = proto_item_add_subtree(tp, ett_mip_pmipv4_ext);
685 proto_tree_add_uint(pmipv4_tree, hf_mip_pmipv4skipext_stype, tvb, offset, 1, ext_subtype);
687 if (ext_subtype == PMIPv4_SKIPEXT_STYPE_INTERFACE_ID) {
688 proto_tree_add_item(pmipv4_tree, hf_mip_pmipv4skipext_interfaceid, tvb, offset + 1, ext_len-1, ENC_NA);
689 } else if (ext_subtype == PMIPv4_SKIPEXT_STYPE_DEVICE_ID) {
690 proto_tree_add_item(pmipv4_tree, hf_mip_pmipv4skipext_deviceid_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
691 proto_tree_add_item(pmipv4_tree, hf_mip_pmipv4skipext_deviceid_id, tvb, offset + 2, ext_len - 2, ENC_NA);
692 } else if (ext_subtype == PMIPv4_SKIPEXT_STYPE_SUBSCRIBER_ID) {
693 pmipv4skipext_subscriberid_type = tvb_get_guint8(tvb, offset + 1);
694 proto_tree_add_uint(pmipv4_tree, hf_mip_pmipv4skipext_subscriberid_type, tvb, offset + 1, 1, pmipv4skipext_subscriberid_type);
695 if (pmipv4skipext_subscriberid_type == 1) {
696 proto_tree_add_item(pmipv4_tree, hf_mip_pmipv4skipext_subscriberid_id, tvb, offset + 2, ext_len - 2, ENC_NA);
698 } else if (ext_subtype == PMIPv4_SKIPEXT_STYPE_ACCESS_TECHNOLOGY) {
699 proto_tree_add_item(pmipv4_tree, hf_mip_pmipv4skipext_accesstechnology_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
701 break;
703 case OLD_CVSE_EXT: /* RFC 3115 */
704 case CVSE_EXT: /* RFC 3115 */
706 * Very nasty . . breaks normal extensions, since the length is
707 * in the wrong place :(
709 proto_tree_add_item(ext_tree, hf_mip_cvse_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
710 offset++;
711 proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 2, ext_len);
712 offset+=2;
713 /* Vendor/Org ID */
714 /*Vendor ID & cvse type & cvse value are included in ext_len, so do not increment offset for them here.*/
715 cvse_local_offset = offset;
716 proto_tree_add_item(ext_tree, hf_mip_cvse_vendor_org_id, tvb, cvse_local_offset, 4, ENC_BIG_ENDIAN);
717 cvse_vendor_id = tvb_get_ntohl(tvb, cvse_local_offset);
718 cvse_local_offset+=4;
719 /*Vendor CVSE Type*/
720 if( cvse_vendor_id == VENDOR_VERIZON ){
721 /*Verizon CVSE type*/
722 proto_tree_add_item(ext_tree, hf_mip_cvse_verizon_cvse_type, tvb, cvse_local_offset, 2, ENC_BIG_ENDIAN);
723 }else if( cvse_vendor_id == VENDOR_THE3GPP2 ){
724 /*THE3GPP2 CVSE type*/
725 cvse_3gpp2_type = tvb_get_ntohs(tvb, cvse_local_offset);
726 /* THE3GPP2 CVSE Value */
727 if(cvse_3gpp2_type == GRE_KEY_EXT){
728 proto_tree_add_item(ext_tree, hf_mip_cvse_3gpp2_grekey, tvb, cvse_local_offset, ext_len - 6, ENC_NA);
730 }else{
731 /*CVSE Type of Other vendor, just show raw numbers currently*/
732 proto_tree_add_item(ext_tree, hf_mip_cvse_vendor_cvse_type, tvb, cvse_local_offset, 2, ENC_BIG_ENDIAN);
733 /* Vendor CVSE Type+Vendor/Org ID = 6 bytes*/
734 proto_tree_add_item(ext_tree, hf_mip_cvse_vendor_cvse_value, tvb, cvse_local_offset, ext_len - 6, ENC_NA);
736 break;
738 case OLD_NVSE_EXT: /* RFC 3115 */
739 case NVSE_EXT: /* RFC 3115 */
741 guint32 nvse_vendor_org_id;
742 tvbuff_t *next_tvb;
744 proto_tree_add_item(ext_tree, hf_mip_nvse_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
746 /* Vendor/Org ID */
747 /*Vendor ID & nvse type & nvse value are included in ext_len, so do not increment offset for them here.*/
748 nvse_local_offset = offset + hdrLen;
749 nvse_vendor_org_id = tvb_get_ntohl(tvb, nvse_local_offset);
750 proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_org_id, tvb, nvse_local_offset, 4, ENC_BIG_ENDIAN);
751 nvse_local_offset+=4;
753 next_tvb = tvb_new_subset(tvb, nvse_local_offset, ext_len-6, ext_len-6);
754 if (!dissector_try_uint(mip_nvse_ext_dissector_table, nvse_vendor_org_id, next_tvb, pinfo, ext_tree)){
756 /*Vendor NVSE Type*/
757 proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_nvse_type, tvb, nvse_local_offset, 2, ENC_BIG_ENDIAN);
758 nvse_local_offset+=2;
760 /* Vendor-NVSE-Value */
761 proto_tree_add_item(ext_tree, hf_mip_nvse_vendor_nvse_value, tvb, nvse_local_offset, ext_len - 8, ENC_NA);
764 break;
766 case MF_CHALLENGE_EXT: /* RFC 3012 */
767 /* The default dissector is good here. The challenge is all hex anyway. */
768 default:
769 proto_tree_add_item(ext_tree, hf_mip_ext, tvb, offset, ext_len, ENC_NA);
770 break;
771 } /* ext type */
773 offset += ext_len;
774 } /* while data remaining */
776 } /* dissect_mip_extensions */
778 /* Code to actually dissect the packets */
779 static void
780 dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
782 /* Set up structures we will need to add the protocol subtree and manage it */
783 proto_item *ti;
784 proto_tree *mip_tree=NULL;
785 proto_item *tf;
786 proto_tree *flags_tree;
787 guint8 type;
788 guint16 flags;
789 gint offset=0;
790 tvbuff_t *next_tvb;
792 /* Make entries in Protocol column and Info column on summary display */
794 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MobileIP");
795 col_clear(pinfo->cinfo, COL_INFO);
797 type = tvb_get_guint8(tvb, offset);
798 switch (type) {
799 case MIP_REGISTRATION_REQUEST:
800 col_add_fstr(pinfo->cinfo, COL_INFO,
801 "Reg Request: HoA=%s HA=%s CoA=%s",
802 tvb_ip_to_str(tvb, 4),
803 tvb_ip_to_str(tvb, 8),
804 tvb_ip_to_str(tvb, 12));
806 if (tree) {
807 ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
808 mip_tree = proto_item_add_subtree(ti, ett_mip);
810 /* type */
811 proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
812 offset++;
814 /* flags */
815 flags = tvb_get_guint8(tvb, offset);
816 tf = proto_tree_add_uint(mip_tree, hf_mip_flags, tvb, offset, 1, flags);
817 flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
818 proto_tree_add_boolean(flags_tree, hf_mip_s, tvb, offset, 1, flags);
819 proto_tree_add_boolean(flags_tree, hf_mip_b, tvb, offset, 1, flags);
820 proto_tree_add_boolean(flags_tree, hf_mip_d, tvb, offset, 1, flags);
821 proto_tree_add_boolean(flags_tree, hf_mip_m, tvb, offset, 1, flags);
822 proto_tree_add_boolean(flags_tree, hf_mip_g, tvb, offset, 1, flags);
823 proto_tree_add_boolean(flags_tree, hf_mip_v, tvb, offset, 1, flags);
824 proto_tree_add_boolean(flags_tree, hf_mip_t, tvb, offset, 1, flags);
825 proto_tree_add_boolean(flags_tree, hf_mip_x, tvb, offset, 1, flags);
826 offset++;
828 /* lifetime */
829 proto_tree_add_item(mip_tree, hf_mip_life, tvb, offset, 2, ENC_BIG_ENDIAN);
830 offset += 2;
832 /* home address */
833 proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
834 offset += 4;
836 /* home agent address */
837 proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
838 offset += 4;
840 /* Care of Address */
841 proto_tree_add_item(mip_tree, hf_mip_coa, tvb, offset, 4, ENC_BIG_ENDIAN);
842 offset += 4;
844 /* Identifier - assumed to be an NTP time here */
845 proto_tree_add_item(mip_tree, hf_mip_ident, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
846 offset += 8;
848 } /* if tree */
849 break;
850 case MIP_REGISTRATION_REPLY:
851 col_add_fstr(pinfo->cinfo, COL_INFO,
852 "Reg Reply: HoA=%s HA=%s, Code=%u",
853 tvb_ip_to_str(tvb, 4),
854 tvb_ip_to_str(tvb, 8),
855 tvb_get_guint8(tvb,1));
857 if (tree) {
858 /* Add Subtree */
859 ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
860 mip_tree = proto_item_add_subtree(ti, ett_mip);
862 /* Type */
863 proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
864 offset++;
866 /* Reply Code */
867 proto_tree_add_item(mip_tree, hf_mip_code, tvb, offset, 1, ENC_BIG_ENDIAN);
868 offset++;
870 /* Registration Lifetime */
871 proto_tree_add_item(mip_tree, hf_mip_life, tvb, offset, 2, ENC_BIG_ENDIAN);
872 offset += 2;
874 /* Home address */
875 proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
876 offset += 4;
878 /* Home Agent Address */
879 proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
880 offset += 4;
882 /* Identifier - assumed to be an NTP time here */
883 proto_tree_add_item(mip_tree, hf_mip_ident, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
884 offset += 8;
885 } /* if tree */
886 break;
887 case MIP_NATT_TUNNEL_DATA:
888 col_add_fstr(pinfo->cinfo, COL_INFO, "Tunnel Data: Next Header=%u",
889 tvb_get_guint8(tvb,1));
891 if (tree) {
892 /* Add Subtree */
893 ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
894 mip_tree = proto_item_add_subtree(ti, ett_mip);
896 /* Type */
897 proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
898 offset++;
900 /* Next Header */
901 proto_tree_add_item(mip_tree, hf_mip_nattt_nexthdr, tvb, offset, 1, ENC_BIG_ENDIAN);
902 offset++;
904 /* reserved */
905 proto_tree_add_item(mip_tree, hf_mip_nattt_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
906 offset += 2;
907 } /* if tree */
908 else {
909 offset += 4;
911 /* encapsulated payload */
912 next_tvb = tvb_new_subset_remaining(tvb, offset);
913 call_dissector(ip_handle, next_tvb, pinfo, mip_tree);
914 offset = tvb_reported_length(tvb);
915 break;
916 case MIP_REGISTRATION_REVOCATION:
917 col_add_fstr(pinfo->cinfo, COL_INFO,
918 "Reg Revocation: HoA=%s HDA=%s FDA=%s",
919 tvb_ip_to_str(tvb, 4),
920 tvb_ip_to_str(tvb, 8),
921 tvb_ip_to_str(tvb, 12));
923 if (tree) {
924 ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
925 mip_tree = proto_item_add_subtree(ti, ett_mip);
927 /* type */
928 proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
929 offset++;
931 /* reserved */
932 proto_tree_add_item(mip_tree, hf_mip_rev_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
933 offset++;
935 /* flags */
936 flags = tvb_get_ntohs(tvb, offset);
937 tf = proto_tree_add_uint(mip_tree, hf_mip_flags, tvb, offset, 2, flags);
938 flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
939 proto_tree_add_boolean(flags_tree, hf_mip_rev_a, tvb, offset, 2, flags);
940 proto_tree_add_boolean(flags_tree, hf_mip_rev_i, tvb, offset, 2, flags);
942 /* reserved */
943 proto_tree_add_uint(flags_tree, hf_mip_rev_reserved, tvb, offset, 2, flags);
944 offset += 2;
946 /* home address */
947 proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
948 offset += 4;
950 /* home domain address */
951 proto_tree_add_item(mip_tree, hf_mip_hda, tvb, offset, 4, ENC_BIG_ENDIAN);
952 offset += 4;
954 /* foreign domain address */
955 proto_tree_add_item(mip_tree, hf_mip_fda, tvb, offset, 4, ENC_BIG_ENDIAN);
956 offset += 4;
958 /* revocation identifier */
959 proto_tree_add_item(mip_tree, hf_mip_revid, tvb, offset, 4, ENC_BIG_ENDIAN);
960 offset += 4;
961 } /* if tree */
962 break;
963 case MIP_REGISTRATION_REVOCATION_ACK:
964 col_add_fstr(pinfo->cinfo, COL_INFO, "Reg Revocation Ack: HoA=%s",
965 tvb_ip_to_str(tvb, 4));
967 if (tree) {
968 ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
969 mip_tree = proto_item_add_subtree(ti, ett_mip);
971 /* type */
972 proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
973 offset++;
975 /* reserved */
976 proto_tree_add_item(mip_tree, hf_mip_ack_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
977 offset++;
979 /* flags */
980 flags = tvb_get_ntohs(tvb, offset);
981 tf = proto_tree_add_uint(mip_tree, hf_mip_flags, tvb, offset, 2, flags);
982 flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
983 proto_tree_add_boolean(flags_tree, hf_mip_ack_i, tvb, offset, 2, flags);
985 /* reserved */
986 proto_tree_add_uint(flags_tree, hf_mip_ack_reserved, tvb, offset, 2, flags);
987 offset += 2;
989 /* home address */
990 proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
991 offset += 4;
993 /* revocation identifier */
994 proto_tree_add_item(mip_tree, hf_mip_revid, tvb, offset, 4, ENC_BIG_ENDIAN);
995 offset += 4;
996 } /* if tree */
997 break;
998 } /* End switch */
1000 if (tree) {
1001 if (tvb_reported_length_remaining(tvb, offset) > 0)
1002 dissect_mip_extensions(tvb, offset, mip_tree, pinfo);
1004 } /* dissect_mip */
1006 /* Register the protocol with Wireshark */
1007 void proto_register_mip(void)
1010 /* Setup list of header fields */
1011 static hf_register_info hf[] = {
1012 { &hf_mip_type,
1013 { "Message Type", "mip.type",
1014 FT_UINT8, BASE_DEC, VALS(mip_types), 0,
1015 "Mobile IP Message type.", HFILL }
1017 { &hf_mip_flags,
1018 {"Flags", "mip.flags",
1019 FT_UINT8, BASE_HEX, NULL, 0x0,
1020 NULL, HFILL}
1022 { &hf_mip_s,
1023 {"Simultaneous Bindings", "mip.s",
1025 FT_BOOLEAN, 8, NULL, 128,
1026 "Simultaneous Bindings Allowed", HFILL }
1028 { &hf_mip_b,
1029 {"Broadcast Datagrams", "mip.b",
1030 FT_BOOLEAN, 8, NULL, 64,
1031 "Broadcast Datagrams requested", HFILL }
1033 { &hf_mip_d,
1034 { "Co-located Care-of Address", "mip.d",
1035 FT_BOOLEAN, 8, NULL, 32,
1036 "MN using Co-located Care-of address", HFILL }
1038 { &hf_mip_m,
1039 {"Minimal Encapsulation", "mip.m",
1040 FT_BOOLEAN, 8, NULL, 16,
1041 "MN wants Minimal encapsulation", HFILL }
1043 { &hf_mip_g,
1044 {"GRE", "mip.g",
1045 FT_BOOLEAN, 8, NULL, 8,
1046 "MN wants GRE encapsulation", HFILL }
1048 { &hf_mip_v,
1049 { "Van Jacobson", "mip.v",
1050 FT_BOOLEAN, 8, NULL, 4,
1051 NULL, HFILL }
1053 { &hf_mip_t,
1054 { "Reverse Tunneling", "mip.t",
1055 FT_BOOLEAN, 8, NULL, 2,
1056 "Reverse tunneling requested", HFILL }
1058 { &hf_mip_x,
1059 { "Reserved", "mip.x",
1060 FT_BOOLEAN, 8, NULL, 1,
1061 NULL, HFILL }
1063 { &hf_mip_code,
1064 { "Reply Code", "mip.code",
1065 FT_UINT8, BASE_DEC, VALS(mip_reply_codes), 0,
1066 "Mobile IP Reply code.", HFILL }
1068 { &hf_mip_life,
1069 { "Lifetime", "mip.life",
1070 FT_UINT16, BASE_DEC, NULL, 0,
1071 "Mobile IP Lifetime.", HFILL }
1073 { &hf_mip_homeaddr,
1074 { "Home Address", "mip.homeaddr",
1075 FT_IPv4, BASE_NONE, NULL, 0,
1076 "Mobile Node's home address.", HFILL }
1079 { &hf_mip_haaddr,
1080 { "Home Agent", "mip.haaddr",
1081 FT_IPv4, BASE_NONE, NULL, 0,
1082 "Home agent IP Address.", HFILL }
1084 { &hf_mip_coa,
1085 { "Care of Address", "mip.coa",
1086 FT_IPv4, BASE_NONE, NULL, 0,
1087 "Care of Address.", HFILL }
1089 { &hf_mip_ident,
1090 { "Identification", "mip.ident",
1091 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0,
1092 "MN Identification.", HFILL }
1094 { &hf_mip_ext_type,
1095 { "Extension Type", "mip.ext.type",
1096 FT_UINT8, BASE_DEC, VALS(mip_ext_types), 0,
1097 "Mobile IP Extension Type.", HFILL }
1099 { &hf_mip_gaext_stype,
1100 { "Gen Auth Ext SubType", "mip.ext.auth.subtype",
1101 FT_UINT8, BASE_DEC, VALS(mip_gaext_stypes), 0,
1102 "Mobile IP Auth Extension Sub Type.", HFILL }
1104 { &hf_mip_ext_len,
1105 { "Extension Length", "mip.ext.len",
1106 FT_UINT16, BASE_DEC, NULL, 0,
1107 "Mobile IP Extension Length.", HFILL }
1109 { &hf_mip_ext,
1110 { "Extension", "mip.extension",
1111 FT_BYTES, BASE_NONE, NULL, 0,
1112 NULL, HFILL }
1114 { &hf_mip_aext_spi,
1115 { "SPI", "mip.auth.spi",
1116 FT_UINT32, BASE_HEX, NULL, 0,
1117 "Authentication Header Security Parameter Index.", HFILL }
1119 { &hf_mip_aext_auth,
1120 { "Authenticator", "mip.auth.auth",
1121 FT_BYTES, BASE_NONE, NULL, 0,
1122 "Authenticator.", HFILL }
1124 { &hf_mip_next_nai,
1125 { "NAI", "mip.nai",
1126 FT_STRING, BASE_NONE, NULL, 0,
1127 NULL, HFILL }
1129 { &hf_mip_rext_flags,
1130 {"Rev Ext Flags", "mip.ext.rev.flags",
1131 FT_UINT16, BASE_HEX, NULL, 0x0,
1132 "Revocation Support Extension Flags", HFILL}
1134 { &hf_mip_rext_i,
1135 { "'I' bit Support", "mip.ext.rev.i",
1136 FT_BOOLEAN, 16, NULL, 32768,
1137 "Agent supports Inform bit in Revocation", HFILL }
1139 { &hf_mip_rext_reserved,
1140 { "Reserved", "mip.ext.rev.reserved",
1141 FT_UINT16, BASE_HEX, NULL, 0x7fff,
1142 NULL, HFILL }
1144 { &hf_mip_rext_tstamp,
1145 { "Timestamp", "mip.ext.rev.tstamp",
1146 FT_UINT32, BASE_DEC, NULL, 0,
1147 "Revocation Timestamp of Sending Agent", HFILL }
1149 { &hf_mip_rev_reserved,
1150 { "Reserved", "mip.rev.reserved",
1151 FT_UINT8, BASE_HEX, NULL, 0x0,
1152 NULL, HFILL}
1154 { &hf_mip_rev_a,
1155 { "Home Agent", "mip.rev.a",
1156 FT_BOOLEAN, 16, NULL, 32768,
1157 "Revocation sent by Home Agent", HFILL }
1159 { &hf_mip_rev_i,
1160 { "Inform", "mip.rev.i",
1161 FT_BOOLEAN, 16, NULL, 16384,
1162 "Inform Mobile Node", HFILL }
1164 #if 0
1165 { &hf_mip_rev_reserved2,
1166 { "Reserved", "mip.rev.reserved2",
1167 FT_UINT16, BASE_HEX, NULL, 0x3fff,
1168 NULL, HFILL}},
1169 #endif
1170 { &hf_mip_hda,
1171 { "Home Domain Address", "mip.rev.hda",
1172 FT_IPv4, BASE_NONE, NULL, 0,
1173 "Revocation Home Domain IP Address", HFILL }
1175 { &hf_mip_fda,
1176 { "Foreign Domain Address", "mip.rev.fda",
1177 FT_IPv4, BASE_NONE, NULL, 0,
1178 "Revocation Foreign Domain IP Address", HFILL }
1180 { &hf_mip_revid,
1181 { "Revocation Identifier", "mip.revid",
1182 FT_UINT32, BASE_DEC, NULL, 0,
1183 "Revocation Identifier of Initiating Agent", HFILL }
1185 { &hf_mip_ack_reserved,
1186 { "Reserved", "mip.ack.reserved",
1187 FT_UINT8, BASE_HEX, NULL, 0x0,
1188 NULL, HFILL}
1190 { &hf_mip_ack_i,
1191 { "Inform", "mip.ack.i",
1192 FT_BOOLEAN, 16, NULL, 32768,
1193 "Inform Mobile Node", HFILL }
1195 #if 0
1196 { &hf_mip_ack_reserved2,
1197 { "Reserved", "mip.ack.reserved2",
1198 FT_UINT16, BASE_HEX, NULL, 0x7fff,
1199 NULL, HFILL}},
1200 #endif
1201 { &hf_mip_dhaext_stype,
1202 { "DynHA Ext SubType", "mip.ext.dynha.subtype",
1203 FT_UINT8, BASE_DEC, VALS(mip_dhaext_stypes), 0,
1204 "Dynamic HA Extension Sub-type", HFILL }
1206 { &hf_mip_dhaext_addr,
1207 { "DynHA Home Agent", "mip.ext.dynha.ha",
1208 FT_IPv4, BASE_NONE, NULL, 0,
1209 "Dynamic Home Agent IP Address", HFILL }
1211 { &hf_mip_mstrext_stype,
1212 { "MsgStr Ext SubType", "mip.ext.msgstr.subtype",
1213 FT_UINT8, BASE_DEC, VALS(mip_mstrext_stypes), 0,
1214 "Message String Extension Sub-type", HFILL }
1216 { &hf_mip_mstrext_text,
1217 { "MsgStr Text", "mip.ext.msgstr.text",
1218 FT_STRING, BASE_NONE, NULL, 0,
1219 "Message String Extension Text", HFILL }
1221 { &hf_mip_nattt_nexthdr,
1222 { "NATTT NextHeader", "mip.nattt.nexthdr",
1223 FT_UINT8, BASE_DEC, VALS(mip_nattt_nexthdr), 0,
1224 "NAT Traversal Tunnel Next Header.", HFILL }
1226 { &hf_mip_nattt_reserved,
1227 { "Reserved", "mip.nattt.reserved",
1228 FT_UINT16, BASE_HEX, NULL , 0x0,
1229 NULL, HFILL }
1231 { &hf_mip_utrqext_stype,
1232 { "UDP TunReq Ext SubType", "mip.ext.utrq.subtype",
1233 FT_UINT8, BASE_DEC, VALS(mip_utrqext_stypes), 0,
1234 "UDP Tunnel Request Extension Sub-type", HFILL }
1236 { &hf_mip_utrqext_reserved1,
1237 { "Reserved 1", "mip.ext.utrq.reserved1",
1238 FT_UINT8, BASE_HEX, NULL, 0x0,
1239 NULL, HFILL }
1241 { &hf_mip_utrqext_flags,
1242 { "UDP TunReq Ext Flags", "mip.ext.utrq.flags",
1243 FT_UINT8, BASE_HEX, NULL, 0x0,
1244 "UDP Tunnel Request Extension Flags", HFILL }
1246 { &hf_mip_utrqext_f,
1247 { "Req Forced", "mip.ext.utrq.f",
1248 FT_BOOLEAN, 8, NULL, 128,
1249 "MN wants to Force UDP Tunneling", HFILL }
1251 { &hf_mip_utrqext_r,
1252 { "FA Registration Required", "mip.ext.utrq.r",
1253 FT_BOOLEAN, 8, NULL, 64,
1254 "Registration through FA Required", HFILL }
1256 { &hf_mip_utrqext_reserved2,
1257 { "Reserved 2", "mip.ext.utrq.reserved2",
1258 FT_UINT8, BASE_HEX, NULL, 0x3f,
1259 NULL, HFILL }
1261 { &hf_mip_utrqext_encap_type,
1262 { "UDP Encap Type", "mip.ext.utrq.encaptype",
1263 FT_UINT8, BASE_DEC, VALS(mip_utrqext_encap_types), 0,
1264 "UDP Encapsulation Type", HFILL }
1266 { &hf_mip_utrqext_reserved3,
1267 { "Reserved 3", "mip.ext.utrq.reserved3",
1268 FT_UINT16, BASE_HEX, NULL, 0x0,
1269 NULL, HFILL }
1271 { &hf_mip_utrpext_stype,
1272 { "UDP TunRep Ext SubType", "mip.ext.utrp.subtype",
1273 FT_UINT8, BASE_DEC, VALS(mip_utrpext_stypes), 0,
1274 "UDP Tunnel Reply Extension Sub-type", HFILL }
1276 { &hf_mip_utrpext_code,
1277 { "UDP TunRep Code", "mip.ext.utrp.code",
1278 FT_UINT8, BASE_DEC, VALS(mip_utrpext_codes), 0,
1279 "UDP Tunnel Reply Code", HFILL }
1281 { &hf_mip_utrpext_flags,
1282 { "UDP TunRep Ext Flags", "mip.ext.utrp.flags",
1283 FT_UINT16, BASE_HEX, NULL, 0x0,
1284 "UDP Tunnel Request Extension Flags", HFILL }
1286 { &hf_mip_utrpext_f,
1287 { "Rep Forced", "mip.ext.utrp.f",
1288 FT_BOOLEAN, 16, NULL, 32768,
1289 "HA wants to Force UDP Tunneling", HFILL }
1291 { &hf_mip_utrpext_reserved,
1292 { "Reserved", "mip.ext.utrp.reserved",
1293 FT_UINT16, BASE_HEX, NULL, 0x7fff,
1294 NULL, HFILL }
1296 { &hf_mip_utrpext_keepalive,
1297 { "Keepalive Interval", "mip.ext.utrp.keepalive",
1298 FT_UINT16, BASE_DEC, NULL, 0,
1299 "NAT Keepalive Interval", HFILL }
1301 { &hf_mip_pmipv4nonskipext_stype,
1302 { "Sub-type", "mip.ext.pmipv4nonskipext.subtype",
1303 FT_UINT8, BASE_DEC, VALS(mip_pmipv4nonskipext_stypes), 0,
1304 "PMIPv4 Skippable Extension Sub-type", HFILL }
1306 { &hf_mip_pmipv4nonskipext_pernodeauthmethod,
1307 { "Per-Node Authentication Method", "mip.ext.pmipv4nonskipext.pernodeauthmethod",
1308 FT_UINT8, BASE_DEC, VALS(mip_pmipv4nonskipext_pernodeauthmethod_types), 0,
1309 NULL, HFILL }
1311 { &hf_mip_pmipv4skipext_stype,
1312 { "Sub-type", "mip.ext.pmipv4skipext.subtype",
1313 FT_UINT8, BASE_DEC, VALS(mip_pmipv4skipext_stypes), 0,
1314 "PMIPv4 Non-skippable Extension Sub-type", HFILL }
1316 { &hf_mip_pmipv4skipext_interfaceid,
1317 { "Interface ID", "mip.ext.pmipv4skipext.interfaceid",
1318 FT_BYTES, BASE_NONE, NULL, 0,
1319 NULL, HFILL }
1321 { &hf_mip_pmipv4skipext_deviceid_type,
1322 { "ID-Type", "mip.ext.pmipv4skipext.deviceid_type",
1323 FT_UINT8, BASE_DEC, VALS(mip_pmipv4skipext_deviceid_types), 0,
1324 "Device ID-Type", HFILL }
1326 { &hf_mip_pmipv4skipext_deviceid_id,
1327 { "Identifier", "mip.ext.pmipv4skipext.deviceid_id",
1328 FT_BYTES, BASE_NONE, NULL, 0,
1329 "Device ID Identifier", HFILL }
1331 { &hf_mip_pmipv4skipext_subscriberid_type,
1332 { "ID-Type", "mip.ext.pmipv4skipext.subscriberid_type",
1333 FT_UINT8, BASE_DEC, VALS(mip_pmipv4skipext_subscriberid_types), 0,
1334 "Subscriber ID-Type", HFILL }
1336 { &hf_mip_pmipv4skipext_subscriberid_id,
1337 { "Identifier", "mip.ext.pmipv4skipext.subscriberid_id",
1338 FT_BYTES, BASE_NONE, NULL, 0,
1339 "Subscriber ID Identifier", HFILL }
1341 { &hf_mip_pmipv4skipext_accesstechnology_type,
1342 { "Access Technology Type", "mip.ext.pmipv4skipext.accesstechnology_type",
1343 FT_UINT8, BASE_DEC, VALS(mip_pmipv4skipext_accesstechnology_types), 0,
1344 NULL, HFILL }
1346 { &hf_mip_cvse_reserved,
1347 { "CVSE Reserved", "mip.ext.cvse.reserved",
1348 FT_UINT8, BASE_HEX, NULL, 0x0,
1349 NULL, HFILL }
1351 { &hf_mip_cvse_vendor_org_id,
1352 { "CVSE Vendor/org ID", "mip.ext.cvse.vendor_id",
1353 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0,
1354 NULL, HFILL }
1356 { &hf_mip_cvse_verizon_cvse_type ,
1357 { "Verizon CVSE Type", "mip.ext.cvse.verizon_type",
1358 FT_UINT16, BASE_DEC, VALS(mip_cvse_verizon_cvse_types), 0,
1359 NULL, HFILL }
1361 { &hf_mip_cvse_3gpp2_cvse_type ,
1362 { "3GPP2 CVSE Type","mip.ext.cvse.3gpp2_type",
1363 FT_UINT16, BASE_DEC, NULL, 0,
1364 NULL, HFILL }
1366 { &hf_mip_cvse_3gpp2_grekey,
1367 { "GRE Key","mip.ext.cvse.3gpp2_grekey",
1368 FT_UINT16, BASE_DEC, NULL, 0,
1369 NULL, HFILL }
1371 { &hf_mip_cvse_vendor_cvse_type,
1372 { "Vendor CVSE Type", "mip.ext.cvse.vendor_type",
1373 FT_UINT16, BASE_HEX, NULL, 0x0,
1374 NULL, HFILL }
1376 { &hf_mip_cvse_vendor_cvse_value,
1377 { "Vendor CVSE Value", "mip.ext.cvse.vendor_value",
1378 FT_BYTES, BASE_NONE, NULL, 0,
1379 NULL, HFILL }
1381 { &hf_mip_nvse_reserved,
1382 { "Reserved", "mip.ext.nvse.reserved",
1383 FT_UINT16, BASE_HEX, NULL, 0x0,
1384 NULL, HFILL }
1386 { &hf_mip_nvse_vendor_org_id,
1387 { "Vendor ID", "mip.ext.nvse.vendor_id",
1388 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0,
1389 NULL, HFILL }
1391 { &hf_mip_nvse_vendor_nvse_type ,
1392 { "Vendor Type", "mip.ext.nvse.vendor_type",
1393 FT_UINT16, BASE_DEC, NULL, 0x0,
1394 NULL, HFILL }
1396 { &hf_mip_nvse_vendor_nvse_value ,
1397 { "Vendor Value", "mip.ext.nvse.vendor_value",
1398 FT_BYTES, BASE_NONE, NULL, 0,
1399 NULL, HFILL }
1401 { &hf_mip_nvse_3gpp2_type ,
1402 { "Type", "mip.ext.nvse.3gpp2.type",
1403 FT_UINT16, BASE_DEC, VALS(mip_nvse_3gpp2_type_vals), 0,
1404 NULL, HFILL }
1406 { &hf_mip_nvse_3gpp2_type16_value ,
1407 { "value", "mip.ext.nvse.3gpp2.type16.value",
1408 FT_UINT16, BASE_DEC, VALS(mip_nvse_3gpp2_type17_vals), 0,
1409 NULL, HFILL }
1411 { &hf_mip_nvse_3gpp2_type17_entity,
1412 { "Entity-Type", "mip.ext.nvse.3gpp2.type17.entity",
1413 FT_UINT8, BASE_DEC, VALS(mip_nvse_3gpp2_type17_entity_vals), 0,
1414 NULL, HFILL }
1416 { &hf_mip_nvse_3gpp2_type17_subtype1,
1417 { "Sub-Type1", "mip.ext.nvse.3gpp2.type17.subtype1",
1418 FT_UINT8, BASE_DEC, NULL, 0,
1419 NULL, HFILL }
1421 { &hf_mip_nvse_3gpp2_type17_length,
1422 { "Length", "mip.ext.nvse.3gpp2.type17.length",
1423 FT_UINT8, BASE_DEC, NULL, 0,
1424 NULL, HFILL }
1426 { &hf_mip_nvse_3gpp2_type17_subtype2,
1427 { "Sub-Type2", "mip.ext.nvse.3gpp2.type17.subtype2",
1428 FT_UINT8, BASE_DEC, NULL, 0,
1429 NULL, HFILL }
1431 { &hf_mip_nvse_3gpp2_type17_prim_dns,
1432 { "Primary DNS", "mip.ext.nvse.3gpp2.type17.prim_dns",
1433 FT_IPv4, BASE_NONE, NULL, 0,
1434 NULL, HFILL }
1436 { &hf_mip_nvse_3gpp2_type17_sec_dns,
1437 { "Secondary DNS", "mip.ext.nvse.3gpp2.type17.sec_dns",
1438 FT_IPv4, BASE_NONE, NULL, 0,
1439 NULL, HFILL }
1443 /* Setup protocol subtree array */
1444 static gint *ett[] = {
1445 &ett_mip,
1446 &ett_mip_flags,
1447 &ett_mip_ext,
1448 &ett_mip_exts,
1449 &ett_mip_pmipv4_ext,
1452 /* Register the protocol name and description */
1453 proto_mip = proto_register_protocol("Mobile IP", "Mobile IP", "mip");
1455 /* Register the dissector by name */
1456 register_dissector("mip", dissect_mip, proto_mip);
1458 /* Required function calls to register the header fields and subtrees used */
1459 proto_register_field_array(proto_mip, hf, array_length(hf));
1460 proto_register_subtree_array(ett, array_length(ett));
1462 mip_nvse_ext_dissector_table = register_dissector_table("mip.nvse_ext",
1463 "MIP Normal Vendor/Organization Specific Extension", FT_UINT32, BASE_DEC);
1466 void
1467 proto_reg_handoff_mip(void)
1469 dissector_handle_t mip_handle;
1471 mip_handle = find_dissector("mip");
1472 ip_handle = find_dissector("ip");
1473 dissector_add_uint("udp.port", UDP_PORT_MIP, mip_handle);
1475 /* Register as dissector for 3GPP2 NVSE */
1476 dissector_add_uint("mip.nvse_ext", VENDOR_THE3GPP2,
1477 new_create_dissector_handle(dissect_mip_priv_ext_3gpp2, proto_mip));
1481 * Editor modelines
1483 * Local Variables:
1484 * c-basic-offset: 2
1485 * tab-width: 8
1486 * indent-tabs-mode: nil
1487 * End:
1489 * ex: set shiftwidth=2 tabstop=8 expandtab:
1490 * :indentSize=2:tabSize=8:noTabs=true: