1 diff -urN wireshark-0.99.7.orig/epan/dissectors/Makefile.common wireshark-0.99.7/epan/dissectors/Makefile.common
2 --- wireshark-0.99.7.orig/epan/dissectors/Makefile.common 2007-12-20 21:19:06.000000000 +0100
3 +++ wireshark-0.99.7/epan/dissectors/Makefile.common 2007-12-20 21:20:59.000000000 +0100
7 packet-diffserv-mpls-common.c \
12 diff -urN wireshark-0.99.7.orig/epan/dissectors/packet-hip.c wireshark-0.99.7/epan/dissectors/packet-hip.c
13 --- wireshark-0.99.7.orig/epan/dissectors/packet-hip.c 1970-01-01 01:00:00.000000000 +0100
14 +++ wireshark-0.99.7/epan/dissectors/packet-hip.c 2007-12-20 21:37:45.000000000 +0100
17 + * Routines for HIP packet disassembly
19 + * 03/2006 draft-ietf-hip-base-05, -esp-02, -mm-03, -registration-01, -rvs-04
20 + * 07/2005 draft-ietf-hip-base-03, -esp-00, and -mm-02
21 + * 03/2005 draft-ietf-hip-base-01
22 + * 11/2004 RSA and draft-ietf-hip-mm-00
23 + * 09/2004 draft-nikander-hip-mm-02
24 + * 07/2004 draft-ietf-hip-base-00
28 + * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
29 + * Thomas Henderson <thomas.r.henderson@boeing.com>
31 + * Packet dissector for Host Identity Protocol (HIP) packets.
32 + * This tool displays the TLV structure, verifies checksums,
33 + * and shows NULL encrypted parameters, but will not verify
34 + * signatures or decode encrypted parameters.
38 + * Ethereal - Network traffic analyzer
39 + * By Gerald Combs <gerald@ethereal.com>
40 + * Copyright 1998 Gerald Combs
42 + * This program is free software; you can redistribute it and/or
43 + * modify it under the terms of the GNU General Public License
44 + * as published by the Free Software Foundation; either version 2
45 + * of the License, or (at your option) any later version.
47 + * This program is distributed in the hope that it will be useful,
48 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 + * GNU General Public License for more details.
52 + * You should have received a copy of the GNU General Public License
53 + * along with this program; if not, write to the Free Software
54 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
66 +#include <epan/packet.h>
67 +#include <epan/addr_resolv.h>
69 +#include "in_cksum.h"
73 +#include "packet-ip.h"
74 +#include <epan/conversation.h>
76 +static int proto_hip = -1;
77 +static int hf_hip_proto = -1;
78 +static int hf_hip_hdr_len = -1;
79 +static int hf_hip_packet_type = -1;
80 +static int hf_hip_version = -1;
81 +static int hf_hip_res = -1;
82 +static int hf_hip_controls = -1;
83 +static int hf_hip_controls_cert = -1;
84 +static int hf_hip_controls_anon = -1;
85 +static int hf_hip_checksum = -1;
86 +static int hf_hip_hit_sndr = -1;
87 +static int hf_hip_hit_rcvr = -1;
89 +static int hf_hip_type = -1;
90 +static int hf_hip_tlv_ei_res = -1;
91 +static int hf_hip_tlv_ei_keyidx = -1;
92 +static int hf_hip_tlv_ei_oldspi = -1;
93 +static int hf_hip_tlv_ei_newspi = -1;
94 +static int hf_hip_tlv_r1_res = -1;
95 +static int hf_hip_tlv_r1count = -1;
96 +static int hf_hip_tlv_puzzle_k = -1;
97 +static int hf_hip_tlv_puzzle_life = -1;
98 +static int hf_hip_tlv_puzzle_o = -1;
99 +static int hf_hip_tlv_puzzle_i = -1;
100 +static int hf_hip_tlv_puzzle_j = -1;
101 +static int hf_hip_tlv_seq_updid = -1;
102 +static int hf_hip_tlv_ack_updid = -1;
103 +static int hf_hip_tlv_dh_group_id = -1;
104 +static int hf_hip_tlv_dh_pub = -1;
105 +static int hf_hip_tlv_trans_id = -1;
106 +static int hf_hip_tlv_esp_reserved = -1;
107 +static int hf_hip_tlv_host_id_len = -1;
108 +static int hf_hip_tlv_host_di_type = -1;
109 +static int hf_hip_tlv_host_di_len = -1;
110 +static int hf_hip_tlv_host_id_hdr = -1;
111 +static int hf_hip_tlv_host_id_hdr_flags = -1;
112 +static int hf_hip_tlv_host_id_hdr_proto = -1;
113 +static int hf_hip_tlv_host_id_hdr_alg = -1;
114 +static int hf_hip_tlv_host_id_t = -1;
115 +static int hf_hip_tlv_host_id_q = -1;
116 +static int hf_hip_tlv_host_id_p = -1;
117 +static int hf_hip_tlv_host_id_g = -1;
118 +static int hf_hip_tlv_host_id_y = -1;
119 +static int hf_hip_tlv_host_id_e_len = -1;
120 +static int hf_hip_tlv_host_id_e = -1;
121 +static int hf_hip_tlv_host_id_n = -1;
122 +static int hf_hip_tlv_cert_count = -1;
123 +static int hf_hip_tlv_cert_id = -1;
124 +static int hf_hip_tlv_cert_type = -1;
125 +static int hf_hip_tlv_certificate = -1;
126 +static int hf_hip_tlv_notify_res = -1;
127 +static int hf_hip_tlv_notify_type = -1;
128 +static int hf_hip_tlv_notify_data = -1;
129 +static int hf_hip_tlv_opaque_data = -1;
130 +static int hf_hip_tlv_reg_ltmin = -1;
131 +static int hf_hip_tlv_reg_ltmax = -1;
132 +static int hf_hip_tlv_reg_lt = -1;
133 +static int hf_hip_tlv_reg_type = -1;
134 +static int hf_hip_tlv_reg_failtype = -1;
135 +static int hf_hip_tlv_hmac = -1;
136 +static int hf_hip_tlv_sig_alg = -1;
137 +static int hf_hip_tlv_sig = -1;
138 +static int hf_hip_tlv_id = -1;
139 +static int hf_hip_tlv_enc_reserved = -1;
140 +static int hf_hip_tlv_enc_iv = -1;
141 +static int hf_hip_tlv_locator_traffic_type = -1;
142 +static int hf_hip_tlv_locator_type = -1;
143 +static int hf_hip_tlv_locator_len = -1;
144 +static int hf_hip_tlv_locator_reserved = -1;
145 +static int hf_hip_tlv_locator_lifetime = -1;
146 +static int hip_transform = 0;
148 +static gint ett_hip = -1;
149 +static gint ett_hip_controls = -1;
150 +static gint ett_hip_tlv = -1;
151 +static gint ett_hip_tlv_data = -1;
152 +static gint ett_hip_tlv_host_id_hdr = -1;
154 +/* Place HIP summary in protocol tree */
155 +static gboolean hip_summary_in_tree = TRUE;
157 +/* This minimal structure used to get at the Type field*/
159 + guint16 nextpluslen; /* Next header, plus length */
160 + guint8 hiptype; /* Type (what we are after) */
161 + guint8 hipreserved; /* Reserved (what we are after) */
162 + /*variable size*/ /* (IV and) Payload data */
165 +/* 128-bit Host Identity Tag */
166 +#define HIT_BITSIZE 128
167 +typedef unsigned char hip_hit [HIT_BITSIZE/8];
169 +#define HI_ALG_DSA 3
170 +#define HI_ALG_RSA 5
172 +/* HIP packet types */
178 + CER, /* 5 - removed from draft-ietf-hip-base-03 */
179 + BOS=11, /* 11 - removed from draft-ietf-hip-base-01 */
180 + UPDATE=16, /* 16 */
181 + NOTIFY=17, /* 17 */
183 + CLOSE_ACK=19, /* 19 */
186 +/* HIP TLV parameters */
187 +/* 03/2006 draft-ietf-hip-base-05, -esp-02, -mm-03, -registration-01, -rvs-04 */
188 +#define PARAM_ESP_INFO 65
189 +#define PARAM_R1_COUNTER 128
190 +#define PARAM_LOCATOR 193
191 +#define PARAM_PUZZLE 257
192 +#define PARAM_SOLUTION 321
193 +#define PARAM_SEQ 385
194 +#define PARAM_ACK 449
195 +#define PARAM_DIFFIE_HELLMAN 513
196 +#define PARAM_HIP_TRANSFORM 577
197 +#define PARAM_ENCRYPTED 641
198 +#define PARAM_HOST_ID 705
199 +#define PARAM_CERT 768
200 +#define PARAM_NOTIFY 832
201 +#define PARAM_ECHO_REQUEST 897
202 +#define PARAM_REG_INFO 930
203 +#define PARAM_REG_REQUEST 932
204 +#define PARAM_REG_RESPONSE 934
205 +#define PARAM_REG_FAILED 936
206 +#define PARAM_ECHO_RESPONSE 961
207 +#define PARAM_ESP_TRANSFORM 4095
208 +#define PARAM_TRANSFORM_LOW 2048 /* defines range for transforms */
209 +#define PARAM_TRANSFORM_HIGH 4095
210 +#define PARAM_HMAC 61505
211 +#define PARAM_HMAC_2 61569
212 +#define PARAM_HIP_SIGNATURE_2 61633
213 +#define PARAM_HIP_SIGNATURE 61697
214 +#define PARAM_ECHO_REQUEST_NOSIG 63661
215 +#define PARAM_ECHO_RESPONSE_NOSIG 63425
216 +#define PARAM_FROM 65498
217 +#define PARAM_RVS_HMAC 65500
218 +#define PARAM_VIA_RVS 65502
219 +#define PARAM_CRITICAL_BIT 0x0001
221 +#define HIP_CONTROL_C_MASK 0x0002
222 +#define HIP_CONTROL_A_MASK 0x0001
224 +#define HI_HDR_FLAGS_MASK 0xFFFF0000
225 +#define HI_HDR_PROTO_MASK 0x0000FF00
226 +#define HI_HDR_ALG_MASK 0x000000FF
228 +const value_string hi_hdr_flags_vals[] = {
229 + { 0x0200, "key is associated with a user" },
230 + { 0x0201, "zone key" },
231 + { 0x0202, "key is associated with non-zone entity" },
235 +const value_string hi_hdr_proto_vals[] = {
236 + { 0x01, "key is used for TLS" },
237 + { 0x02, "key is used for email" },
238 + { 0x03, "key is used for DNS security" },
239 + { 0x04, "key is used for Oakley/IPSEC" },
240 + { 0xFF, "key is valid for any protocol" },
244 +const value_string hi_hdr_alg_vals[] = {
245 + { 0x00, "reserved" },
246 + { 0x01, "RSA/MD5" },
247 + { 0x02, "Diffie-Hellman" },
249 + { 0x04, "elliptic curve crypto" },
251 + { 0xFF, "reserved" },
254 +const value_string notify_vals[] = {
255 + { 1, "Unsupported critical parameter type" },
256 + { 7, "Invalid syntax" },
257 + { 14, "No Diffie-Hellman proposal chosen" },
258 + { 15, "Invalid Diffie-Hellman chosen" },
259 + { 16, "No HIP proposal chosen" },
260 + { 17, "Invalid HIP transform chosen" },
261 + { 18, "No ESP proposal chosen" },
262 + { 19, "Invalid ESP transform chosen" },
263 + { 24, "Authentication failed" },
264 + { 26, "Checksum failed" },
265 + { 28, "HMAC failed" },
266 + { 32, "Encryption failed" },
267 + { 40, "Invalid HIT" },
268 + { 42, "Blocked by policy" },
269 + { 44, "Server busy please retry" },
270 + { 46, "I2 acknowledgement" },
274 +typedef struct _hiphdr {
275 + guint8 proto; /* payload protocol */
276 + guint8 hdr_len; /* header length */
277 + guint8 packet_type; /* packet type */
278 + guint8 res:4,version:4; /* version, reserved */
279 + guint16 checksum; /* checksum */
280 + guint16 control; /* control */
281 + hip_hit hit_sndr; /* Sender's Host Identity Tag */
282 + hip_hit hit_rcvr; /* Receiver's Host Identity Tag*/
283 + /* HIP parameters ... */
286 +typedef struct _tlv_head
294 +char * hip_param(int n);
295 +char *dh_group_id_label(int groupid);
296 +char *transform_id_label(int transform);
297 +char *sig_alg_label(int alg);
298 +int dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len);
300 +static dissector_handle_t data_handle;
302 +/**** end defs from hip.h ****/
305 + * Dissect the HIP packet
308 +dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
310 + proto_tree *hip_tree, *hip_tlv_tree=NULL;
311 + proto_item *ti, *ti_tlv;
314 + int length, offset = 0;
315 + guint16 control_h, checksum_h, computed_checksum;
316 + guint16 tlv_type_h, tlv_length_h; /* For storing in host order */
317 + vec_t cksum_vec[4];
321 + * load the top pane info. This should be overwritten by
322 + * the next protocol in the stack
324 + if (check_col(pinfo->cinfo, COL_PROTOCOL))
325 + col_set_str(pinfo->cinfo, COL_PROTOCOL, "HIP");
326 + if (check_col(pinfo->cinfo, COL_INFO))
327 + col_clear(pinfo->cinfo, COL_INFO);
329 + /* Convert control and checksum to host order */
331 + tvb_memcpy(tvb, (guint8 *)&hiph, 0, sizeof(hiphdr));
332 + control_h = g_ntohs(hiph.control);
333 + checksum_h = g_ntohs(hiph.checksum);
335 + if (check_col(pinfo->cinfo, COL_INFO)) {
336 + switch (hiph.packet_type) {
338 + col_add_fstr(pinfo->cinfo, COL_INFO,
339 + "HIP I1 (HIP Initiator Packet)");
342 + col_add_fstr(pinfo->cinfo, COL_INFO,
343 + "HIP R1 (HIP Responder Packet)");
346 + col_add_fstr(pinfo->cinfo, COL_INFO,
347 + "HIP I2 (Second HIP Initiator Packet)");
350 + col_add_fstr(pinfo->cinfo, COL_INFO,
351 + "HIP R2 (Second HIP Responder Packet)");
354 + col_add_fstr(pinfo->cinfo, COL_INFO,
355 + "HIP UPDATE (HIP Update Packet)");
358 + col_add_fstr(pinfo->cinfo, COL_INFO,
359 + "HIP CER (HIP Certificate Packet)");
362 + col_add_fstr(pinfo->cinfo, COL_INFO,
363 + "HIP BOS (HIP Bootstrap Packet)");
366 + col_add_fstr(pinfo->cinfo, COL_INFO,
367 + "HIP NOTIFY (HIP Notification Packet)");
370 + col_add_fstr(pinfo->cinfo, COL_INFO,
371 + "HIP CLOSE (HIP Close Packet)");
374 + col_add_fstr(pinfo->cinfo, COL_INFO,
375 + "HIP CLOSE_ACK (HIP Close Acknowledgement Packet)");
378 + col_add_fstr(pinfo->cinfo, COL_INFO, "HIP Unknown type");
384 + * populate a tree in the second pane with the status of the link layer
388 + if (hip_summary_in_tree) {
389 + ti = proto_tree_add_protocol_format(tree, proto_hip, tvb, 0, -1, "Host Identity Protocol");
391 + ti = proto_tree_add_item(tree, proto_hip, tvb, 0, -1, FALSE);
394 + hip_tree = proto_item_add_subtree(ti, ett_hip);
395 + proto_tree_add_uint(hip_tree, hf_hip_proto, tvb, offset, 1, hiph.proto);
396 + proto_tree_add_uint(hip_tree, hf_hip_hdr_len, tvb, offset+1, 1, hiph.hdr_len);
397 + proto_tree_add_uint(hip_tree, hf_hip_packet_type, tvb, offset+2, 1, hiph.packet_type);
398 + proto_tree_add_uint_format(hip_tree, hf_hip_version, tvb, offset+3, 1, hiph.version,
399 + "Version: %u, Reserved: %u", hiph.version, hiph.res);
400 + ti = proto_tree_add_uint(hip_tree, hf_hip_controls, tvb, offset+4, 2, control_h);
401 + if (ti) { /* HIP Controls subtree*/
402 + ti = proto_item_add_subtree(ti, ett_hip_controls);
403 + proto_tree_add_boolean(ti, hf_hip_controls_cert, tvb, offset+5,1, control_h);
404 + proto_tree_add_boolean(ti, hf_hip_controls_anon, tvb, offset+5,1, control_h);
408 + /* Checksum - this is the same algorithm from UDP, ICMPv6 */
409 + if (!pinfo->fragmented) {
410 + /* IPv4 or IPv6 addresses */
411 + cksum_vec[0].ptr = pinfo->src.data;
412 + cksum_vec[0].len = pinfo->src.len;
413 + cksum_vec[1].ptr = pinfo->dst.data;
414 + cksum_vec[1].len = pinfo->dst.len;
415 + /* the rest of the pseudo-header */
416 + if (pinfo->src.type == AT_IPv6) {
417 + cksum_vec[2].ptr = (const guint8 *)&phdr;
418 + phdr[0] = g_htonl(tvb_reported_length(tvb));
419 + phdr[1] = g_htonl(IP_PROTO_HIP);
420 + cksum_vec[2].len = 8;
422 + cksum_vec[2].ptr = (const guint8 *)&phdr;
423 + phdr[0] = g_htonl((IP_PROTO_HIP<<16)+tvb_reported_length(tvb));
424 + cksum_vec[2].len = 4;
426 + /* pointer to the HIP header (packet data) */
427 + cksum_vec[3].len = tvb_reported_length(tvb);
428 + cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, cksum_vec[3].len);
429 + computed_checksum = in_cksum(cksum_vec, 4);
430 + if (computed_checksum == 0) {
431 + proto_tree_add_uint_format(hip_tree, hf_hip_checksum, tvb,
432 + offset+6, 2, checksum_h, "Checksum: 0x%04x (correct)",
435 + proto_tree_add_uint_format(hip_tree, hf_hip_checksum, tvb,
436 + offset+6, 2, checksum_h,
437 + "Checksum: 0x%04x (incorrect, should be 0x%04x)",
439 + in_cksum_shouldbe(checksum_h, computed_checksum));
442 + proto_tree_add_uint_format(hip_tree, hf_hip_checksum, tvb,
443 + offset+6, 2, checksum_h,"Checksum: 0x%04x (unverified)",
447 + proto_tree_add_bytes(hip_tree, hf_hip_hit_sndr, tvb, offset, sizeof(hip_hit), hiph.hit_sndr);
448 + offset += sizeof(hip_hit);
449 + proto_tree_add_bytes(hip_tree, hf_hip_hit_rcvr, tvb, offset, sizeof(hip_hit), hiph.hit_rcvr);
450 + offset += sizeof(hip_hit);
452 + length = (hiph.hdr_len+1)*8;
453 + /* Begin TLV parsing */
454 + if (offset < length) {
455 + ti_tlv = proto_tree_add_text(hip_tree, tvb, offset, tvb_length(tvb), "HIP Parameters");
456 + hip_tlv_tree = proto_item_add_subtree(ti_tlv, ett_hip_tlv);
458 + /* Parse type and length in TLV */
459 + while (offset < length)
461 + tvb_memcpy(tvb, (guint8 *)&tlv, offset, sizeof(tlv_head));
462 + tlv_type_h = g_ntohs(tlv.type);
463 + tlv_length_h = g_ntohs(tlv.length);
464 + ti_tlv = proto_tree_add_uint_format(hip_tlv_tree, hf_hip_type, tvb,
465 + offset, 4+tlv_length_h, tlv.type, "%s (type=%u, length=%u)",
466 + hip_param(tlv_type_h), tlv_type_h, tlv_length_h);
469 + dissect_hip_tlv(tvb, offset, ti_tlv, tlv_type_h, tlv_length_h);
471 + offset += 11 + tlv_length_h - (tlv_length_h + 3) % 8;
478 +proto_register_hip(void)
480 +/* Most of this stuff is unused */
481 + module_t *hip_module;
482 + static hf_register_info hf[] = {
484 + { "Payload Protocol", "hip.proto", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
487 + { "Header Length", "hip.hdr_len", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
489 + { &hf_hip_packet_type,
490 + { "Packet Type", "hip.packet_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
493 + { "Version", "hip.version", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
496 + { "Reserved", "hip.res", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
498 + { &hf_hip_controls,
499 + { "HIP Controls", "hip.controls", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
501 + { &hf_hip_controls_cert,
502 + { "Certificate (One or more CER packets follows)", "hip.controls.c", FT_BOOLEAN, 16, NULL, HIP_CONTROL_C_MASK, "", HFILL }},
504 + { &hf_hip_controls_anon,
505 + { "Anonymous (Sender's HI is anonymous)", "hip.controls.a", FT_BOOLEAN, 16, NULL, HIP_CONTROL_A_MASK, "", HFILL }},
507 + { &hf_hip_checksum,
508 + { "Checksum", "hip.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
510 + { &hf_hip_hit_sndr,
511 + { "Sender's HIT", "hip.hit_sndr", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
513 + { &hf_hip_hit_rcvr,
514 + { "Receiver's HIT", "hip.hit_rcvr", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
517 + { "Type", "hip.type", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
519 + { &hf_hip_tlv_r1_res,
520 + { "Reserved", "hip.tlv.r1_res", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
522 + { &hf_hip_tlv_r1count,
523 + { "R1 Counter", "hip.tlv.r1count", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
525 + { &hf_hip_tlv_puzzle_k,
526 + { "Puzzle Difficulty K","hip.tlv_puzzle_k", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
528 + { &hf_hip_tlv_puzzle_life,
529 + { "Puzzle Lifetime","hip.tlv_puzzle_life", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
531 + { &hf_hip_tlv_puzzle_o,
532 + { "Opaque Data","hip.tlv_puzzle_o", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
534 + { &hf_hip_tlv_puzzle_i,
535 + { "Puzzle Random I", "hip.tlv.puzzle_i", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
537 + { &hf_hip_tlv_puzzle_j,
538 + { "Puzzle Solution J", "hip.tlv_puzzle_j", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
540 + { &hf_hip_tlv_ei_res,
541 + { "Reserved", "hip.tlv_ei_res", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
543 + { &hf_hip_tlv_ei_keyidx,
544 + { "Keymat Index", "hip.tlv_ei_keyidx", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
546 + { &hf_hip_tlv_ei_oldspi,
547 + { "Old SPI", "hip.tlv_ei_oldspi", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
549 + { &hf_hip_tlv_ei_newspi,
550 + { "New SPI", "hip.tlv_ei_newspi", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
552 + { &hf_hip_tlv_seq_updid,
553 + { "Update ID", "hip.tlv_seq_updid", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
555 + { &hf_hip_tlv_ack_updid,
556 + { "ACKed Peer Update ID", "hip.tlv_ack_updid", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
558 + { &hf_hip_tlv_dh_group_id,
559 + { "Group ID", "hip.tlv.dh_group_id", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
561 + { &hf_hip_tlv_dh_pub,
562 + { "Public Value", "hip.tlv.dh_pub", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
564 + { &hf_hip_tlv_trans_id,
565 + { "Transform ID", "hip.tlv.trans_id", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
567 + { &hf_hip_tlv_esp_reserved,
568 + { "Reserved", "hip.tlv.esp_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
570 + { &hf_hip_tlv_host_id_len,
571 + { "Host Identity Length","hip.tlv.host_id_len", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
573 + { &hf_hip_tlv_host_di_type,
574 + { "Domain Identifier Type","hip.tlv.host_di_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
576 + { &hf_hip_tlv_host_di_len,
577 + { "Domain Identifier Length","hip.tlv.host_di_len", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
579 + { &hf_hip_tlv_host_id_hdr,
580 + { "Host Identity flags","hip.tlv.host_id_hdr", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
582 + { &hf_hip_tlv_host_id_hdr_flags,
583 + { "Flags","hip.tlv.host_id_hdr_flags", FT_UINT32, BASE_HEX, VALS(hi_hdr_flags_vals), HI_HDR_FLAGS_MASK, "", HFILL }},
585 + { &hf_hip_tlv_host_id_hdr_proto,
586 + { "Protocol","hip.tlv.host_id_hdr_flags", FT_UINT32, BASE_HEX, VALS(hi_hdr_proto_vals), HI_HDR_PROTO_MASK, "", HFILL }},
588 + { &hf_hip_tlv_host_id_hdr_alg,
589 + { "Algorithm","hip.tlv.host_id_hdr_alg", FT_UINT32, BASE_HEX, VALS(hi_hdr_alg_vals), HI_HDR_ALG_MASK, "", HFILL }},
591 + { &hf_hip_tlv_host_id_t,
592 + { "Host Identity T","hip.tlv.host_id_t", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
594 + { &hf_hip_tlv_host_id_q,
595 + { "Host Identity Q","hip.tlv.host_id_q", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
597 + { &hf_hip_tlv_host_id_p,
598 + { "Host Identity P","hip.tlv.host_id_p", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
600 + { &hf_hip_tlv_host_id_g,
601 + { "Host Identity G","hip.tlv.host_id_g", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
603 + { &hf_hip_tlv_host_id_y,
604 + { "Host Identity Y (public value)", "hip.tlv.host_id_y", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
606 + { &hf_hip_tlv_host_id_e_len,
607 + { "RSA Host Identity e_len (exponent length)",
608 + "hip.tlv.host_id_e_len", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
610 + { &hf_hip_tlv_host_id_e,
611 + { "RSA Host Identity e (exponent)", "hip.tlv.host_id_e", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
613 + { &hf_hip_tlv_host_id_n,
614 + { "RSA Host Identity n (public modulus)", "hip.tlv.host_id_n", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
616 + { &hf_hip_tlv_cert_count,
617 + { "Cert count","hip.tlv.cert_count", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
619 + { &hf_hip_tlv_cert_id,
620 + { "Cert ID","hip.tlv.cert_id", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
622 + { &hf_hip_tlv_cert_type,
623 + { "Cert type","hip.tlv.cert_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
625 + { &hf_hip_tlv_certificate,
626 + { "Certificate","hip.tlv.certificate", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
628 + { &hf_hip_tlv_notify_res,
629 + { "Reserved","hip.tlv.notify_res", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
631 + { &hf_hip_tlv_notify_type,
632 + { "Notify Message Type","hip.tlv.notify_type", FT_UINT16, BASE_DEC, VALS(notify_vals), 0xFFFF, "", HFILL }},
634 + { &hf_hip_tlv_notify_data,
635 + { "Notification Data","hip.tlv.notify_data", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
637 + { &hf_hip_tlv_opaque_data,
638 + { "Opaque Data","hip.tlv.opaque_data", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
640 + { &hf_hip_tlv_reg_ltmin,
641 + { "Minimum Registration Lifetime","hip.tlv.reg_ltmin", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
643 + { &hf_hip_tlv_reg_ltmax,
644 + { "Maximum Registration Lifetime","hip.tlv.reg_ltmax", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
646 + { &hf_hip_tlv_reg_lt,
647 + { "Registration Lifetime","hip.tlv.reg_lt", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
649 + { &hf_hip_tlv_reg_type,
650 + { "Registration Type","hip.tlv.reg_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
652 + { &hf_hip_tlv_reg_failtype,
653 + { "Registration Failure Type","hip.tlv.reg_failtype", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
655 + { &hf_hip_tlv_hmac,
656 + { "HMAC","hip.tlv.hmac", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
658 + { &hf_hip_tlv_sig_alg,
659 + { "Signature Algorithm","hip.tlv.sig_alg", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
662 + { "Signature", "hip.tlv.sig", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
665 + { "ID", "hip.tlv.id", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
667 + { &hf_hip_tlv_enc_reserved,
668 + { "Reserved", "hip.tlv.enc_reserved", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
670 + { &hf_hip_tlv_enc_iv,
671 + { "IV", "hip.tlv.enc_iv", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
673 + { &hf_hip_tlv_locator_traffic_type,
674 + { "Traffic Type", "hip.tlv.locator_traffic_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
676 + { &hf_hip_tlv_locator_type,
677 + { "Locator Type", "hip.tlv.locator_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
679 + { &hf_hip_tlv_locator_len,
680 + { "Locator Length", "hip.tlv.locator_len", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
682 + { &hf_hip_tlv_locator_reserved,
683 + { "Reserved | P bit", "hip.tlv.locator_reserved", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
685 + { &hf_hip_tlv_locator_lifetime,
686 + { "Locator Lifetime", "hip.tlv.locator_lifetime", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
689 + static gint *ett[] = {
694 + &ett_hip_tlv_host_id_hdr,
697 + proto_hip = proto_register_protocol("Host Identity Protocol",
700 + proto_register_field_array(proto_hip, hf, array_length(hf));
701 + proto_register_subtree_array(ett, array_length(ett));
703 + /* Register configuration preferences */
704 + hip_module = prefs_register_protocol(proto_hip, NULL);
705 + prefs_register_bool_preference(hip_module, "summary_in_tree",
706 + "Show HIP summary in protocol tree",
707 + "Whether the HIP summary line should be shown in the protocol tree",
708 + &hip_summary_in_tree);
712 +proto_reg_handoff_hip(void)
714 + dissector_handle_t hip_handle;
716 + hip_handle = create_dissector_handle(dissect_hip, proto_hip);
717 + dissector_add("ip.proto", IP_PROTO_HIP, hip_handle);
718 + data_handle = find_dissector("data");
721 +char * hip_param(int n)
727 + //case 0: /* sometimes extra padding */
730 + case PARAM_ESP_INFO:
731 + sprintf(s, "ESP INFO");
733 + case PARAM_R1_COUNTER:
734 + sprintf(s, "R1 COUNTER");
736 + case PARAM_LOCATOR:
737 + sprintf(s, "LOCATOR");
740 + sprintf(s, "PUZZLE");
742 + case PARAM_SOLUTION:
743 + sprintf(s, "SOLUTION");
751 + case PARAM_DIFFIE_HELLMAN:
752 + sprintf(s, "DIFFIE_HELLMAN");
754 + case PARAM_HIP_TRANSFORM:
755 + sprintf(s, "HIP_TRANSFORM");
757 + case PARAM_ENCRYPTED:
758 + sprintf(s, "ENCRYPTED");
760 + case PARAM_HOST_ID:
761 + sprintf(s, "HOST_ID");
764 + sprintf(s, "CERT");
767 + sprintf(s, "NOTIFY");
769 + case PARAM_ECHO_REQUEST:
770 + sprintf(s, "ECHO_REQUEST");
772 + case PARAM_ECHO_RESPONSE:
773 + sprintf(s, "ECHO_RESPONSE");
775 + case PARAM_ESP_TRANSFORM:
776 + sprintf(s, "ESP_TRANSFORM");
779 + sprintf(s, "HMAC");
782 + sprintf(s, "HMAC_2");
784 + case PARAM_HIP_SIGNATURE_2:
785 + sprintf(s, "HIP_SIGNATURE_2");
787 + case PARAM_HIP_SIGNATURE:
788 + sprintf(s, "HIP_SIGNATURE");
790 + case PARAM_ECHO_REQUEST_NOSIG:
791 + sprintf(s, "ECHO_REQUEST (No sig.)");
793 + case PARAM_ECHO_RESPONSE_NOSIG:
794 + sprintf(s, "ECHO_RESPONSE (No sig.)");
797 + sprintf(s, "?UNKNOWN?");
804 +char *dh_group_id_label(int groupid)
810 + sprintf(s, "Reserved");
813 + sprintf(s, "384-bit group");
816 + sprintf(s, "OAKLEY well-known group 1");
819 + sprintf(s, "1536-bit MODP group");
822 + sprintf(s, "3072-bit MODP group");
825 + sprintf(s, "6144-bit MODP group");
828 + sprintf(s, "8192-bit MODP group");
831 + sprintf(s, "UNKNOWN?");
838 +char *transform_id_label(int transform)
844 + sprintf(s, "Reserved");
847 + sprintf(s, "AES-CBC with HMAC-SHA1");
850 + sprintf(s, "3DES-CBC with HMAC-SHA1");
853 + sprintf(s, "3DES-CBC with HMAC-MD5");
856 + sprintf(s, "BLOWFISH-CBC with HMAC-SHA1");
859 + sprintf(s, "NULL with HMAC-SHA1");
862 + sprintf(s, "NULL with HMAC-MD5");
865 + sprintf(s, "UNKNOWN?");
872 +char *sig_alg_label(int alg)
878 + sprintf(s, "Reserved");
887 + sprintf(s, "UNKNOWN?");
895 +int dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len)
897 + proto_tree *t=NULL;
898 + proto_item *ti_tlv;
900 + guint8 n, algorithm, reg_type;
901 + guint16 trans, hi_len, di_len, di_type, e_len;
902 + guint32 reserved, hi_hdr;
903 + int newoffset, newlen, hi_t;
907 + case PARAM_ESP_INFO:
908 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
909 + proto_tree_add_uint(t, hf_hip_tlv_ei_res, tvb, offset+4, 2,
910 + tvb_get_ntohs(tvb, offset+4));
911 + proto_tree_add_uint(t, hf_hip_tlv_ei_keyidx, tvb, offset+6, 2,
912 + tvb_get_ntohs(tvb, offset+6));
913 + proto_tree_add_uint(t, hf_hip_tlv_ei_oldspi, tvb, offset+8, 4,
914 + tvb_get_ntohl(tvb, offset+8));
915 + proto_tree_add_uint(t, hf_hip_tlv_ei_newspi, tvb, offset+12, 4,
916 + tvb_get_ntohl(tvb, offset+12));
918 + case PARAM_R1_COUNTER:
919 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
920 + proto_tree_add_uint(t, hf_hip_tlv_r1_res, tvb, offset+4, 4,
921 + tvb_get_ntohl(tvb, offset+4));
922 + tvb_memcpy(tvb, (guint8*)data, offset+8, 8);
923 + proto_tree_add_bytes(t, hf_hip_tlv_r1count, tvb, offset+8, 8, data);
925 + case PARAM_LOCATOR:
926 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
928 + newoffset = offset + 4;
929 + while (tlv_len > 0) {
930 + proto_tree_add_uint(t, hf_hip_tlv_locator_traffic_type, tvb,
931 + newoffset, 1, tvb_get_guint8(tvb, newoffset));
933 + proto_tree_add_uint(t, hf_hip_tlv_locator_type, tvb,
934 + newoffset, 1, tvb_get_guint8(tvb, newoffset));
936 + proto_tree_add_uint(t, hf_hip_tlv_locator_len, tvb,
937 + newoffset, 1, tvb_get_guint8(tvb, newoffset));
939 + reserved = tvb_get_guint8(tvb, newoffset);
940 + proto_tree_add_uint_format(t, hf_hip_tlv_locator_reserved, tvb,
941 + newoffset, 1, reserved, "Reserved: 0x%x %s", reserved,
942 + (reserved >> 31) ? "(Preferred)" : "");
944 + proto_tree_add_uint(t, hf_hip_tlv_locator_lifetime, tvb,
945 + newoffset, 4, tvb_get_ntohl(tvb, newoffset));
947 + proto_tree_add_text(t, tvb, newoffset, 16, "Address: %s",
948 + ip6_to_str((const struct e_in6_addr*)
949 + tvb_get_ptr(tvb, newoffset, 16)));
955 + case PARAM_SOLUTION:
956 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
957 + proto_tree_add_uint(t, hf_hip_tlv_puzzle_k, tvb, offset+4, 1,
958 + tvb_get_guint8(tvb, offset+4));
959 + proto_tree_add_uint(t, hf_hip_tlv_puzzle_life, tvb, offset+5, 1,
960 + tvb_get_guint8(tvb, offset+5));
961 + proto_tree_add_uint(t, hf_hip_tlv_puzzle_o, tvb,offset+6, 2,
962 + tvb_get_ntohs(tvb, offset+6));
963 + tvb_memcpy(tvb, (guint8*)data, offset+8, 8);
964 + proto_tree_add_bytes(t, hf_hip_tlv_puzzle_i, tvb,offset+8, 8, data);
965 + if (type == PARAM_SOLUTION) { /* solution also contains J */
966 + tvb_memcpy(tvb, (guint8*)data, offset+16, 8);
967 + proto_tree_add_bytes(t, hf_hip_tlv_puzzle_j, tvb, offset+16, 8,
971 + case PARAM_SEQ: /* SEQ */
972 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
973 + proto_tree_add_uint(t, hf_hip_tlv_seq_updid, tvb, offset+4, 4,
974 + tvb_get_ntohl(tvb, offset+4));
976 + case PARAM_ACK: /* ACK */
977 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
978 + newoffset = offset + 4;
979 + while (tlv_len > 0) {
980 + proto_tree_add_uint(t, hf_hip_tlv_ack_updid, tvb, newoffset, 4, tvb_get_ntohl(tvb, newoffset));
985 + case PARAM_DIFFIE_HELLMAN: /* DIFFIE_HELLMAN */
986 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
987 + n = tvb_get_guint8(tvb, offset+4);
988 + proto_tree_add_uint_format(t, hf_hip_tlv_dh_group_id, tvb, offset+4,
989 + 1, n, "%u (%s)", n, dh_group_id_label(n));
990 + tvb_memcpy(tvb, (guint8*)data, offset+5, tlv_len-1);
991 + proto_tree_add_bytes(t, hf_hip_tlv_dh_pub, tvb, offset+5, tlv_len-1,
994 + case PARAM_ESP_TRANSFORM: /* ESP_TRANSFORM */
995 + case PARAM_HIP_TRANSFORM: /* HIP_TRANSFORM */
996 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
997 + /* ESP transform may have E bit*/
998 + if (type == PARAM_ESP_TRANSFORM) {
999 + proto_tree_add_uint(t, hf_hip_tlv_esp_reserved, tvb,
1000 + offset+4, 2, tvb_get_ntohs(tvb, offset+4));
1001 + newoffset = offset + 6;
1004 + newoffset = offset + 4;
1005 + /* check for NULL as only HIP transform */
1007 + hip_transform = tvb_get_ntohs(tvb, newoffset);
1009 + hip_transform = 0;
1011 + while (tlv_len > 0) {
1012 + trans = tvb_get_ntohs(tvb, newoffset);
1013 + proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb,
1014 + newoffset, 2, trans, "%u (%s)", trans,
1015 + transform_id_label(trans));
1016 + tlv_len -= 2; /* two bytes per transform id */
1020 + case PARAM_ENCRYPTED: /* ENCRYPTED */
1021 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1022 + proto_tree_add_uint(t, hf_hip_tlv_enc_reserved, tvb, offset+4, 4,
1023 + tvb_get_ntohl(tvb, offset+4));
1024 + if (hip_transform == 5) { /* null encryption, no IV */
1026 + t = proto_item_add_subtree(t, ett_hip_tlv_data);
1027 + } else { /* encrypted data */
1028 + tvb_memcpy(tvb, (guint8*)data, offset+8, 8);
1029 + proto_tree_add_bytes(t, hf_hip_tlv_enc_iv,tvb,offset+8,8,data);
1030 + proto_tree_add_text(t, tvb, offset+16, tlv_len-12,
1031 + "Encrypted Data (%u bytes)", tlv_len-12);
1034 + case PARAM_HOST_ID: /* HOST_ID */
1035 + if (type != PARAM_ENCRYPTED)
1036 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1037 + /* hi_length, fqdn_length */
1038 + hi_len = tvb_get_ntohs(tvb, offset+4);
1039 + di_len = tvb_get_ntohs(tvb, offset+6);
1040 + di_type = (di_len >> 12) & 0x000F; /* get 4 bits for DI type */
1041 + di_len = di_len & 0x0FFF; /* 12 bits for DI length */
1042 + proto_tree_add_uint(t, hf_hip_tlv_host_id_len, tvb, offset+4, 2,
1044 + proto_tree_add_uint(t, hf_hip_tlv_host_di_type, tvb, offset+6, 1,
1046 + proto_tree_add_uint(t, hf_hip_tlv_host_di_len, tvb, offset+6, 2,
1048 + /* hi_hdr - first 4 bytes are 0200ff03 (RFC 2535)
1050 + * protocol 1 octet
1051 + * algorithm 1 octet (DSA or RSA)
1053 + hi_hdr = tvb_get_ntohl(tvb, offset+8);
1054 + ti_tlv = proto_tree_add_uint(t, hf_hip_tlv_host_id_hdr, tvb, offset+8, 4, hi_hdr);
1056 + ti_tlv = proto_item_add_subtree(ti_tlv,ett_hip_tlv_host_id_hdr);
1057 + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_flags, tvb, offset+8,2, hi_hdr);
1058 + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_proto, tvb, offset+10,1, hi_hdr);
1059 + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_alg, tvb, offset+11,1, hi_hdr);
1061 + algorithm = tvb_get_guint8(tvb, offset+11);
1062 + switch (algorithm) {
1067 + * P 64 + T*8 octets
1068 + * G 64 + T*8 octets
1069 + * Y 64 + T*8 octets
1072 + proto_tree_add_uint(t, hf_hip_tlv_host_id_t, tvb, offset+12, 1,
1073 + tvb_get_guint8(tvb, offset+12));
1074 + hi_t = tvb_get_guint8(tvb, offset+12);
1075 + tvb_memcpy(tvb, (guint8*)data, offset+13, 20);
1076 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_q, tvb, offset+13,
1078 + newoffset = offset + 33;
1079 + if (hi_t > 56) /* max 4096 bits */
1081 + newlen = 64 + (hi_t * 8);
1082 + tvb_memcpy(tvb, (guint8*)data, newoffset, newlen);
1083 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_p, tvb, newoffset,
1085 + newoffset += newlen;
1086 + tvb_memcpy(tvb, (guint8*)data, newoffset, newlen);
1087 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_g, tvb, newoffset,
1089 + newoffset += newlen;
1090 + tvb_memcpy(tvb, (guint8*)data, newoffset, newlen);
1091 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_y, tvb, newoffset,
1096 + * e_len 1 or 3 octets
1097 + * e specified by e_len
1098 + * n variable length public modulus
1100 + e_len = tvb_get_guint8(tvb, offset+12);
1101 + newoffset = offset+13;
1102 + hi_len -= 5; /* subtract RDATA + e_len */
1103 + if (e_len == 0) { /* e_len is 0 followed by 16-bit value */
1104 + e_len = tvb_get_ntohs(tvb, offset+13);
1108 + if (e_len > 512) { /* per, RFC 3110 < 4096 bits */
1109 + proto_tree_add_text(t, tvb, offset+13, 2,
1110 + "<< e_len too large >>");
1113 + proto_tree_add_uint(t, hf_hip_tlv_host_id_e_len, tvb, offset+12,
1114 + (e_len > 255) ? 3:1, e_len);
1115 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_e, tvb, newoffset,
1116 + e_len, tvb_get_ptr(tvb, newoffset, e_len));
1117 + newoffset += e_len;
1119 + if ((hi_len > 512) || (hi_len < 0)) {
1120 + proto_tree_add_text(t, tvb, newoffset, 1,
1121 + "<< Invalid HI length >>");
1124 + /* RSA public modulus n */
1125 + proto_tree_add_bytes(t, hf_hip_tlv_host_id_n, tvb, newoffset,
1126 + hi_len, tvb_get_ptr(tvb,newoffset,hi_len));
1129 + proto_tree_add_text(t, tvb, offset+11, 1,
1130 + "Unknown algorithm type (%d).\n", algorithm);
1137 + if (di_len > sizeof(data))
1138 + di_len = sizeof(data) - 1;
1139 + memset(data,0,sizeof(data)); /* this null-terminates the string */
1140 + tvb_memcpy(tvb, (guint8*)data, offset+16+hi_len, di_len);
1141 + if (di_type == 1) {
1142 + proto_tree_add_text(t, tvb, offset+16+hi_len, di_len,
1143 + "FQDN: %s", data);
1144 + } else if (di_type == 2) {
1145 + proto_tree_add_text(t, tvb, offset+16+hi_len, di_len,
1149 + case PARAM_CERT: /* CERT */
1150 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1151 + proto_tree_add_uint(t, hf_hip_tlv_cert_count, tvb, offset+4, 1,
1152 + tvb_get_guint8(tvb, offset+4));
1153 + proto_tree_add_uint(t, hf_hip_tlv_cert_id, tvb, offset+5, 1,
1154 + tvb_get_guint8(tvb, offset+5));
1155 + proto_tree_add_uint(t, hf_hip_tlv_cert_type, tvb, offset+6, 1,
1156 + tvb_get_guint8(tvb, offset+6));
1157 + tvb_memcpy(tvb, (guint8*)data, offset+7, tlv_len-3);
1158 + proto_tree_add_bytes(t, hf_hip_tlv_certificate, tvb, offset+7,
1161 + case PARAM_NOTIFY: /* NOTIFY */
1162 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1163 + proto_tree_add_uint(t, hf_hip_tlv_notify_res, tvb, offset+4, 2,
1164 + tvb_get_ntohs(tvb, offset+4));
1165 + proto_tree_add_uint(t, hf_hip_tlv_notify_type, tvb, offset+6, 2,
1166 + tvb_get_ntohs(tvb, offset+6));
1167 + tvb_memcpy(tvb, (guint8*)data, offset+8, tlv_len-4);
1168 + proto_tree_add_bytes(t, hf_hip_tlv_notify_data, tvb, offset+8,
1172 + case PARAM_ECHO_REQUEST: /* ECHO REQUEST */
1173 + case PARAM_ECHO_RESPONSE: /* ECHO RESPONSE */
1174 + case PARAM_ECHO_REQUEST_NOSIG: /* ECHO REQUEST */
1175 + case PARAM_ECHO_RESPONSE_NOSIG: /* ECHO RESPONSE */
1176 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1177 + tvb_memcpy(tvb, (guint8*)data, offset+4, tlv_len);
1178 + proto_tree_add_bytes(t, hf_hip_tlv_opaque_data, tvb, offset+4,
1181 + case PARAM_REG_INFO:
1182 + case PARAM_REG_REQUEST:
1183 + case PARAM_REG_RESPONSE:
1184 + case PARAM_REG_FAILED:
1185 + /* min lt, max lt | lifetime | failuretype */
1186 + if (type == PARAM_REG_INFO) { /* min lt, max lt */
1187 + proto_tree_add_uint(t, hf_hip_tlv_reg_ltmin, tvb, offset+4,
1188 + 1, tvb_get_guint8(tvb, offset+4));
1189 + proto_tree_add_uint(t, hf_hip_tlv_reg_ltmax, tvb, offset+5,
1190 + 1, tvb_get_guint8(tvb, offset+5));
1192 + } else if (type == PARAM_REG_FAILED) { /* failure type */
1193 + proto_tree_add_uint(t, hf_hip_tlv_reg_failtype, tvb, offset+4,
1194 + 1, tvb_get_guint8(tvb, offset+4));
1196 + } else { /* lifetime */
1197 + proto_tree_add_uint(t, hf_hip_tlv_reg_lt, tvb, offset+4,
1198 + 1, tvb_get_guint8(tvb, offset+4));
1201 + /* reg type 1 ... n, padding */
1202 + while (tlv_len > 0) {
1203 + reg_type = tvb_get_guint8(tvb, newoffset);
1204 + proto_tree_add_uint(t, hf_hip_tlv_reg_type, tvb, newoffset, 1,
1206 + tlv_len--; /* one byte per registration type */
1210 + case PARAM_RVS_HMAC: /* RVS HMAC */
1211 + case PARAM_HMAC: /* HMAC */
1212 + case PARAM_HMAC_2: /* HMAC */
1213 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1214 + tvb_memcpy(tvb, (guint8*)data, offset+4, tlv_len);
1215 + proto_tree_add_bytes(t, hf_hip_tlv_hmac, tvb, offset+4,
1218 + case PARAM_HIP_SIGNATURE_2: /* HIP_SIGNATURE_2 */
1219 + case PARAM_HIP_SIGNATURE: /* HIP_SIGNATURE */
1220 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1221 + n = tvb_get_guint8(tvb, offset+4);
1222 + proto_tree_add_uint_format(t, hf_hip_tlv_sig_alg, tvb, offset+4, 1,
1223 + n, "%u (%s)", n, sig_alg_label(n));
1224 + tvb_memcpy(tvb, (guint8*)data, offset+5, tlv_len-1);
1225 + proto_tree_add_bytes(t, hf_hip_tlv_sig, tvb, offset+5, tlv_len-1,
1229 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1230 + proto_tree_add_text(t, tvb, offset+4, 16, "Address: %s",
1231 + ip6_to_str((const struct e_in6_addr*)
1232 + tvb_get_ptr(tvb, offset+4, 16)));
1234 + case PARAM_VIA_RVS:
1235 + t = proto_item_add_subtree(ti, ett_hip_tlv_data);
1236 + newoffset = offset + 4;
1237 + while (tlv_len > 0) {
1238 + proto_tree_add_text(t, tvb, newoffset, 16, "RVS Address: %s",
1239 + ip6_to_str((const struct e_in6_addr*)
1240 + tvb_get_ptr(tvb, newoffset, 16)));
1251 diff -urN wireshark-0.99.7.orig/epan/dissectors/register.c wireshark-0.99.7/epan/dissectors/register.c
1252 --- wireshark-0.99.7.orig/epan/dissectors/register.c 2007-12-20 21:19:06.000000000 +0100
1253 +++ wireshark-0.99.7/epan/dissectors/register.c 2007-12-20 21:15:05.000000000 +0100
1255 {extern void proto_register_fp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_fp", client_data); proto_register_fp ();}
1256 {extern void proto_register_fr (void); if(cb) (*cb)(RA_REGISTER, "proto_register_fr", client_data); proto_register_fr ();}
1257 {extern void proto_register_fractalgeneratorprotocol (void); if(cb) (*cb)(RA_REGISTER, "proto_register_fractalgeneratorprotocol", client_data); proto_register_fractalgeneratorprotocol ();}
1258 + {extern void proto_register_hip (void); proto_register_hip ();}
1259 {extern void proto_register_frame (void); if(cb) (*cb)(RA_REGISTER, "proto_register_frame", client_data); proto_register_frame ();}
1260 {extern void proto_register_ftam (void); if(cb) (*cb)(RA_REGISTER, "proto_register_ftam", client_data); proto_register_ftam ();}
1261 {extern void proto_register_ftp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_ftp", client_data); proto_register_ftp ();}
1263 {extern void proto_reg_handoff_dcerpc_frsapi (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_frsapi", client_data); proto_reg_handoff_dcerpc_frsapi ();}
1264 {extern void proto_reg_handoff_dcerpc_frsrpc (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_frsrpc", client_data); proto_reg_handoff_dcerpc_frsrpc ();}
1265 {extern void proto_reg_handoff_dcerpc_initshutdown (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_initshutdown", client_data); proto_reg_handoff_dcerpc_initshutdown ();}
1266 + {extern void proto_reg_handoff_hip (void); proto_reg_handoff_hip ();}
1267 {extern void proto_reg_handoff_dcerpc_lsa (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_lsa", client_data); proto_reg_handoff_dcerpc_lsa ();}
1268 {extern void proto_reg_handoff_dcerpc_mapi (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_mapi", client_data); proto_reg_handoff_dcerpc_mapi ();}
1269 {extern void proto_reg_handoff_dcerpc_messenger (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_dcerpc_messenger", client_data); proto_reg_handoff_dcerpc_messenger ();}
1270 diff -urN wireshark-0.99.7.orig/epan/ipproto.h wireshark-0.99.7/epan/ipproto.h
1271 --- wireshark-0.99.7.orig/epan/ipproto.h 2007-12-20 21:19:06.000000000 +0100
1272 +++ wireshark-0.99.7/epan/ipproto.h 2007-12-20 21:41:08.000000000 +0100
1274 #define IP_PROTO_MPLS_IN_IP 137 /* MPLS in IP - RFC4023 */
1275 #define IP_PROTO_AX4000 173 /* AX/4000 Testblock - non IANA */
1276 #define IP_PROTO_NCS_HEARTBEAT 224 /* Novell NCS Heartbeat - http://support.novell.com/cgi-bin/search/searchtid.cgi?/10071158.htm */
1277 +#define IP_PROTO_HIP 253 /* Host Identity Protocol */
1279 extern const char *ipprotostr(int proto);
1281 diff -urN wireshark-0.99.7.orig/epan/prefs.c wireshark-0.99.7/epan/prefs.c
1282 --- wireshark-0.99.7.orig/epan/prefs.c 2007-12-20 21:19:06.000000000 +0100
1283 +++ wireshark-0.99.7/epan/prefs.c 2007-12-20 21:42:40.000000000 +0100
1284 @@ -2172,6 +2172,10 @@
1285 /* Handle old names for UDP preferences. */
1286 if (strcmp(dotp, "udp_summary_in_tree") == 0)
1287 pref = find_preference(module, "summary_in_tree");
1288 + } else if (strcmp(module->name, "hip") == 0) {
1289 + /* Handle old names for HIP preferences. */
1290 + if (strcmp(dotp, "hip_summary_in_tree") == 0)
1291 + pref = find_preference(module, "summary_in_tree");
1292 } else if (strcmp(module->name, "ndps") == 0) {
1293 /* Handle old names for NDPS preferences. */
1294 if (strcmp(dotp, "desegment_ndps") == 0)