diff options
author | wmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-03-25 15:18:39 +0000 |
---|---|---|
committer | wmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-03-25 15:18:39 +0000 |
commit | 61d600a8e5877fdd1f2355f6a79c7354b8ca3695 (patch) | |
tree | 7be212f5d1b0022ca1a22a9b9499c2e256c367ce /epan/dissectors/packet-hip.c | |
parent | 6055358335b09fd3cc50f403060048d9ca0c003c (diff) |
From Samu Varjonen: "New patch to the locators"
See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3378#c25
From me:
Fix typo: "REALY_UDP_HIP" --> "RELAY_UDP_HIP";
Cleanup whitespace.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32276 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-hip.c')
-rw-r--r-- | epan/dissectors/packet-hip.c | 712 |
1 files changed, 369 insertions, 343 deletions
diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c index 9bbe7b558e..078b54a535 100644 --- a/epan/dissectors/packet-hip.c +++ b/epan/dissectors/packet-hip.c @@ -4,15 +4,15 @@ * * $Id$ * - * Based on dissector originally created by + * Based on dissector originally created by * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> * Thomas Henderson <thomas.r.henderson@boeing.com> - * Samu Varjonen <samu.varjonen@hiit.fi> + * Samu Varjonen <samu.varjonen@hiit.fi> * Thomas Jansen <mithi@mithi.net> - * + * * Packet dissector for Host Identity Protocol (HIP) packets. * This tool displays the TLV structure, verifies checksums, - * and shows NULL encrypted parameters, but will not verify + * and shows NULL encrypted parameters, but will not verify * signatures or decode encrypted parameters. * * Wireshark - Network traffic analyzer @@ -33,7 +33,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -71,7 +71,7 @@ typedef enum { #define PARAM_HIP_TRANSFORM 577 #define PARAM_ENCRYPTED 641 #define PARAM_HOST_ID 705 -/* Type number defined in RFC 5201 contents +/* Type number defined in RFC 5201 contents in draft-ietf-hip-cert-00 */ #define PARAM_CERT 768 #define PARAM_NOTIFICATION 832 @@ -104,7 +104,7 @@ typedef enum { #define PARAM_RELAY_FROM 63998 #define PARAM_RELAY_TO 64002 #define PARAM_RELAY_HMAC 65520 - + /* Bit masks */ #define PARAM_CRITICAL_BIT 0x0001 /* See RFC 5201 section 5.1 */ @@ -113,7 +113,7 @@ typedef enum { #define HIP_SHIM6_FIXED_BIT_P_MASK 0x80 #define HIP_SHIM6_FIXED_BIT_S_MASK 0x01 /* 00001110 Excluding the shim6 compatibility bit */ -#define HIP_RESERVED_MASK 0x0E +#define HIP_RESERVED_MASK 0x0E #define HIP_VERSION_MASK 0xF0 #define HIP_CONTROL_A_MASK 0x0001 #define HIP_CONTROL_C_MASK 0x0002 @@ -171,17 +171,17 @@ static const value_string hip_param_vals[] = { /* RFC 5201 section 5.2.6. */ static const value_string dh_group_id_vals[] = { - { 0x0, "Reserved" }, + { 0x0, "Reserved" }, { 0x01, "384-bit group" }, { 0x02, "OAKLEY well-known group 1" }, - { 0x03, "1536-bit MODP group" }, + { 0x03, "1536-bit MODP group" }, { 0x04, "3072-bit MODP group" }, { 0x05, "6144-bit MODP group" }, { 0x06, "8192-bit MODP group" }, { 0, NULL } }; -/* RFC 5202 section 5.1.2. */ +/* RFC 5202 section 5.1.2. */ static const value_string transform_id_vals[] = { { 0x0, "Reserved" }, { 0x01, "AES-CBC with HMAC-SHA1" }, @@ -192,10 +192,10 @@ static const value_string transform_id_vals[] = { { 0x06, "NULL with HMAC-MD5" }, { 0, NULL } }; - + static const value_string reg_type_vals[] = { { 0x01, "RENDEZVOUS" }, /* RFC 5204 */ - { 0x02, "REALY_UDP_HIP" }, /* draft-ietf-hip-nat-raversal-06.txt */ + { 0x02, "RELAY_UDP_HIP" }, /* draft-ietf-hip-nat-raversal-06.txt */ { 0, NULL } }; @@ -205,7 +205,7 @@ static const value_string sig_alg_vals[] = { { HI_ALG_DSA, "DSA" }, { HI_ALG_RSA, "RSA" }, { 0, NULL } -}; +}; /* draft-ietf-hip-nat-traversal-06.txt */ static const value_string mode_id_vals[] = { @@ -272,7 +272,7 @@ static const value_string nat_traversal_mode_vals[] = { { 2, "ICE-STUN-UDP"}, { 0, NULL } }; - + /* functions */ static int dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len); @@ -381,30 +381,31 @@ static gint ett_hip_controls = -1; static gint ett_hip_tlv = -1; static gint ett_hip_tlv_data = -1; static gint ett_hip_tlv_host_id_hdr = -1; +static gint ett_hip_locator_data = -1; /* Dissect the HIP packet */ -static void -dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static void +dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *hip_tree, *hip_tlv_tree=NULL; - proto_item *ti, *ti_tlv; + proto_item *ti, *ti_tlv; int length, offset = 0, newoffset = 0; guint16 control_h, checksum_h, computed_checksum; guint16 tlv_type_h, tlv_length_h; /* For storing in host order */ vec_t cksum_vec[4]; guint32 phdr[2]; - + /* Payload format RFC 5201 section 5.1 */ guint8 hiph_proto; /* payload protocol */ guint8 hiph_hdr_len; /* header length */ guint8 hiph_shim6_fixed_bit_s; /* This is always 0 */ guint8 hiph_packet_type; /* packet type */ - guint8 hiph_res_ver, hiph_version, hiph_reserved; + guint8 hiph_res_ver, hiph_version, hiph_reserved; /* byte for reserved and version */ guint8 hiph_shim6_fixed_bit_p; /* This is always 1 */ /* checksum_h */ /* checksum */ /* control_h */ /* control */ - /* HIP parameters ... */ + /* HIP parameters ... */ /* load the top pane info. This should be overwritten by the next protocol in the stack */ @@ -412,20 +413,20 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); newoffset = offset; - hiph_proto = tvb_get_guint8(tvb, newoffset); + hiph_proto = tvb_get_guint8(tvb, newoffset); newoffset++; - hiph_hdr_len = tvb_get_guint8(tvb, newoffset); + hiph_hdr_len = tvb_get_guint8(tvb, newoffset); newoffset++; hiph_packet_type = tvb_get_guint8(tvb, newoffset); /* draft-ietf-shim6-proto-12 see section 5.3 */ hiph_shim6_fixed_bit_p = (hiph_packet_type & HIP_SHIM6_FIXED_BIT_P_MASK) >> 7; hiph_packet_type = hiph_packet_type & HIP_PACKET_TYPE_MASK; newoffset++; - hiph_res_ver = tvb_get_guint8(tvb, newoffset); - /* divide to reserved and version and shim6_fixed_bit_s + hiph_res_ver = tvb_get_guint8(tvb, newoffset); + /* divide to reserved and version and shim6_fixed_bit_s draft-ietf-shim6-proto-12 see section 5.3 */ hiph_version = (hiph_res_ver & HIP_VERSION_MASK) >> 4; - hiph_reserved = hiph_res_ver & HIP_RESERVED_MASK; + hiph_reserved = hiph_res_ver & HIP_RESERVED_MASK; hiph_shim6_fixed_bit_s = hiph_res_ver & HIP_SHIM6_FIXED_BIT_S_MASK; newoffset++; checksum_h = tvb_get_ntohs(tvb, newoffset); @@ -442,21 +443,21 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hip_tree = proto_item_add_subtree(ti, ett_hip); proto_tree_add_item(hip_tree, hf_hip_proto, tvb, offset, 1, FALSE); proto_tree_add_item(hip_tree, hf_hip_hdr_len, tvb, offset+1, 1, FALSE); - proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_p, tvb, offset+2, 1, - hiph_shim6_fixed_bit_p, - "Fixed P-bit: %u (Always zero)", - hiph_shim6_fixed_bit_p); - proto_tree_add_uint(hip_tree, hf_hip_packet_type, tvb, offset+2, 1, + proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_p, tvb, offset+2, 1, + hiph_shim6_fixed_bit_p, + "Fixed P-bit: %u (Always zero)", + hiph_shim6_fixed_bit_p); + proto_tree_add_uint(hip_tree, hf_hip_packet_type, tvb, offset+2, 1, hiph_packet_type); - proto_tree_add_uint_format(hip_tree, hf_hip_version, tvb, offset+3, 1, - hiph_version, "Version: %u, Reserved: %u", - hiph_version, hiph_reserved); - proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_s, tvb, offset+3, 1, - hiph_shim6_fixed_bit_s, - "Fixed S-bit: %u (%s)", - hiph_shim6_fixed_bit_s, + proto_tree_add_uint_format(hip_tree, hf_hip_version, tvb, offset+3, 1, + hiph_version, "Version: %u, Reserved: %u", + hiph_version, hiph_reserved); + proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_s, tvb, offset+3, 1, + hiph_shim6_fixed_bit_s, + "Fixed S-bit: %u (%s)", + hiph_shim6_fixed_bit_s, ((hiph_shim6_fixed_bit_s) ? "HIP" : "SHIM6")); - + /* Checksum - this is the same algorithm from UDP, ICMPv6 */ if (!pinfo->fragmented) { /* IPv4 or IPv6 addresses */ @@ -481,8 +482,8 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, cksum_vec[3].len); computed_checksum = in_cksum(cksum_vec, 4); if (computed_checksum == 0) { - proto_tree_add_uint_format(hip_tree, hf_hip_checksum, tvb, - offset+4, 2, checksum_h, + proto_tree_add_uint_format(hip_tree, hf_hip_checksum, tvb, + offset+4, 2, checksum_h, "Checksum: 0x%04x (correct)", checksum_h); } else { @@ -491,7 +492,7 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Checksum: 0x%04x (incorrect, " "should be 0x%04x)", checksum_h, - in_cksum_shouldbe(checksum_h, + in_cksum_shouldbe(checksum_h, computed_checksum)); } } else { @@ -502,49 +503,49 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } ti = proto_tree_add_item(hip_tree, hf_hip_controls, tvb, offset+6, 2, FALSE); - if (ti) { + if (ti) { /* HIP Controls subtree */ - ti = proto_item_add_subtree(ti, ett_hip_controls); - proto_tree_add_boolean(ti, hf_hip_controls_anon, tvb, + ti = proto_item_add_subtree(ti, ett_hip_controls); + proto_tree_add_boolean(ti, hf_hip_controls_anon, tvb, offset+7,1, control_h); } - + offset += 8; - proto_tree_add_item(hip_tree, hf_hip_hit_sndr, tvb, offset, + proto_tree_add_item(hip_tree, hf_hip_hit_sndr, tvb, offset, 16, FALSE); offset += 16; - proto_tree_add_item(hip_tree, hf_hip_hit_rcvr, tvb, offset, + proto_tree_add_item(hip_tree, hf_hip_hit_rcvr, tvb, offset, 16, FALSE); offset += 16; - + length = (hiph_hdr_len + 1) * 8; /* Begin TLV parsing */ if (offset < length) { - ti_tlv = proto_tree_add_text(hip_tree, tvb, offset, + ti_tlv = proto_tree_add_text(hip_tree, tvb, offset, tvb_length(tvb), "HIP Parameters"); hip_tlv_tree = proto_item_add_subtree(ti_tlv, ett_hip_tlv); } /* Parse type and length in TLV */ while (offset < length) - { + { tlv_type_h = tvb_get_ntohs(tvb, offset); tlv_length_h = tvb_get_ntohs(tvb, offset + 2); ti_tlv = proto_tree_add_uint_format(hip_tlv_tree, hf_hip_type, tvb, - offset, 4 + tlv_length_h, tlv_type_h, + offset, 4 + tlv_length_h, tlv_type_h, "%s (type=%u, length=%u)", val_to_str(tlv_type_h, hip_param_vals, "Unknown"), tlv_type_h, tlv_length_h); - + /* Parse value */ dissect_hip_tlv(tvb, offset, ti_tlv, tlv_type_h, tlv_length_h); - + offset += 11 + tlv_length_h - (tlv_length_h + 3) % 8; } - + } } -static void +static void dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint32 nullbytes; @@ -556,38 +557,38 @@ dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - -static int + +static int dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len) { proto_tree *t=NULL; - proto_item *ti_tlv; + proto_item *ti_tlv, *ti_loc; guint8 n, algorithm, reg_type; guint16 trans, hi_len, di_len, di_type, e_len, pv_len; guint32 reserved, hi_hdr; guint8 transport_proto; guint8 locator_type; int newoffset, newlen, hi_t; - + /* move over the TLV */ newoffset = offset + 4; switch (type) { - case PARAM_ESP_INFO: + case PARAM_ESP_INFO: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_ei_res, tvb, newoffset, 2, FALSE); /* KEYMAT index */ newoffset += 2; proto_tree_add_item(t, hf_hip_tlv_ei_keyidx, tvb, newoffset, 2, FALSE); - /* OLD SPI */ + /* OLD SPI */ newoffset += 2; proto_tree_add_item(t, hf_hip_tlv_ei_oldspi, tvb, newoffset, 4, FALSE); - /* NEW SPI */ + /* NEW SPI */ newoffset += 4; - proto_tree_add_item(t, hf_hip_tlv_ei_newspi, tvb, newoffset, 4, FALSE); + proto_tree_add_item(t, hf_hip_tlv_ei_newspi, tvb, newoffset, 4, FALSE); break; - case PARAM_R1_COUNTER: + case PARAM_R1_COUNTER: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_r1_res, tvb, newoffset, 4, FALSE); @@ -595,74 +596,99 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len newoffset += 4; proto_tree_add_item(t, hf_hip_tlv_r1count, tvb, newoffset, 8, FALSE); break; - case PARAM_LOCATOR: - /* RFC 5206 section 4. and - draft-ietf-hip-nat-raversal-06.txt section 5.7. + case PARAM_LOCATOR: + /* RFC 5206 section 4. and + draft-ietf-hip-nat-raversal-06.txt section 5.7. for type 2 locators */ t = proto_item_add_subtree(ti, ett_hip_tlv_data); tlv_len -= 4; - /* loop through included locators */ + /* loop through included locators */ while (tlv_len > 0) { - /* Traffic type */ - proto_tree_add_item(t, hf_hip_tlv_locator_traffic_type, tvb, - newoffset, 1, FALSE); - newoffset++; - /* Locator type */ - locator_type = tvb_get_guint8(tvb, newoffset); - proto_tree_add_item(t, hf_hip_tlv_locator_type, tvb, newoffset, 1, FALSE); - newoffset++; - /* Locator length */ - proto_tree_add_item(t, hf_hip_tlv_locator_len, tvb, newoffset, 1, FALSE); - newoffset++; - /* Reserved includes the Preferred bit */ - reserved = tvb_get_guint8(tvb, newoffset); - proto_tree_add_uint_format(t, hf_hip_tlv_locator_reserved, tvb, - newoffset, 1, reserved, - "Reserved: 0x%x %s", reserved, - (reserved >> 31) ? "(Preferred)" : ""); - newoffset++; - /* Locator lifetime */ - proto_tree_add_item(t, hf_hip_tlv_locator_lifetime, tvb, - newoffset, 4, FALSE); - newoffset += 4; - /* Locator types 1 and 0 RFC 5206 section 4.2.*/ + /* Every locator to new tree node + Skip ahead and read the 0 or 1 type locator from 8 bytes + and type 2 locator from 20 bytes to be used as the top level + tree_item for this subtree + */ + locator_type = tvb_get_guint8(tvb, newoffset + 1); if (locator_type == 1 || locator_type == 0) { - /* Locator */ - proto_tree_add_item(t, hf_hip_tlv_locator_address, tvb, newoffset, 16, FALSE); - newoffset += 16; - tlv_len -= 24; - /* Locator type 2 draft-ietf-hip-nat-raversal-06.txt section 5.7. */ + ti_loc = proto_tree_add_item(t, hf_hip_tlv_locator_address, + tvb, newoffset + 8, 16, FALSE); } else if (locator_type == 2) { - /* Tansport port */ - proto_tree_add_item(t, hf_hip_tlv_locator_port, tvb, - newoffset, 2, FALSE); - newoffset += 2; - /* Transport protocol */ - transport_proto = tvb_get_guint8(tvb, newoffset); - /* draft-ietf-hip-nat-traversal-06 section 5.6 */ - proto_tree_add_uint_format(t, hf_hip_tlv_locator_transport_protocol, - tvb, newoffset, 1, transport_proto, - "Transport protocol: %d %s", - transport_proto, - (transport_proto == 17) ? - "(UDP)" : ""); - newoffset++; - /* Kind */ - proto_tree_add_item(t, hf_hip_tlv_locator_kind, tvb, + ti_loc = proto_tree_add_item(t, hf_hip_tlv_locator_address, + tvb, newoffset + 20, 16, FALSE); + } else { + /* unknown or malformed locator type jumping over it */ + ti_loc = NULL; + newoffset += (1 + tvb_get_guint8(tvb, newoffset + 2)); + tlv_len -= (1 + tvb_get_guint8(tvb, newoffset + 2)); + } + if (ti_loc) { + ti_loc = proto_item_add_subtree(ti_loc, ett_hip_locator_data); + /* Traffic type */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_traffic_type, tvb, newoffset, 1, FALSE); newoffset++; - /* Priority */ - proto_tree_add_item(t, hf_hip_tlv_locator_priority, tvb, - newoffset, 4, FALSE); - newoffset += 4; - /* SPI */ - proto_tree_add_item(t, hf_hip_tlv_locator_spi, tvb, + /* Locator type */ +#if 0 + locator_type = tvb_get_guint8(tvb, newoffset); +#endif + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_type, tvb, newoffset, 1, FALSE); + newoffset++; + /* Locator length */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_len, tvb, newoffset, 1, FALSE); + newoffset++; + /* Reserved includes the Preferred bit */ + reserved = tvb_get_guint8(tvb, newoffset); + proto_tree_add_uint_format(ti_loc, hf_hip_tlv_locator_reserved, tvb, + newoffset, 1, reserved, + "Reserved: 0x%x %s", reserved, + (reserved >> 31) ? "(Preferred)" : ""); + newoffset++; + /* Locator lifetime */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_lifetime, tvb, newoffset, 4, FALSE); - newoffset += 4; - /* Locator */ - proto_tree_add_item(t, hf_hip_tlv_locator_address, tvb, newoffset, 16, FALSE); - newoffset += 16; - tlv_len -= 36; + newoffset += 4; + /* Locator types 1 and 0 RFC 5206 section 4.2.*/ + if (locator_type == 1 || locator_type == 0) { + /* Locator */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_address, + tvb, newoffset, 16, FALSE); + newoffset += 16; + tlv_len -= 24; + /* Locator type 2 draft-ietf-hip-nat-raversal-06.txt section 5.7. */ + } else if (locator_type == 2) { + /* Tansport port */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_port, tvb, + newoffset, 2, FALSE); + newoffset += 2; + /* Transport protocol */ + transport_proto = tvb_get_guint8(tvb, newoffset); + /* draft-ietf-hip-nat-traversal-06 section 5.6 */ + proto_tree_add_uint_format(ti_loc, hf_hip_tlv_locator_transport_protocol, + tvb, newoffset, 1, transport_proto, + "Transport protocol: %d %s", + transport_proto, + (transport_proto == 17) ? + "(UDP)" : ""); + newoffset++; + /* Kind */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_kind, tvb, + newoffset, 1, FALSE); + newoffset++; + /* Priority */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_priority, tvb, + newoffset, 4, FALSE); + newoffset += 4; + /* SPI */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_spi, tvb, + newoffset, 4, FALSE); + newoffset += 4; + /* Locator */ + proto_tree_add_item(ti_loc, hf_hip_tlv_locator_address, + tvb, newoffset, 16, FALSE); + newoffset += 16; + tlv_len -= 36; + } } } break; @@ -697,12 +723,12 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len newoffset += 8; proto_tree_add_item(t, hf_hip_tlv_solution_j, tvb, newoffset, 8, FALSE); break; - case PARAM_SEQ: + case PARAM_SEQ: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Update ID */ proto_tree_add_item(t, hf_hip_tlv_seq_updid, tvb, newoffset, 4, FALSE); break; - case PARAM_ACK: + case PARAM_ACK: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Can contain multiple Update IDs from peer */ while (tlv_len > 0) { @@ -712,16 +738,16 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len tlv_len -= 4; } break; - case PARAM_DIFFIE_HELLMAN: + case PARAM_DIFFIE_HELLMAN: t = proto_item_add_subtree(ti, ett_hip_tlv_data); n = tvb_get_guint8(tvb, newoffset); /* First Group ID*/ proto_tree_add_uint_format(t, hf_hip_tlv_dh_group_id, tvb, newoffset, - 1, n, "%u (%s)", n, + 1, n, "%u (%s)", n, val_to_str(n, dh_group_id_vals, "Unknown")); /* First Public value len */ - newoffset++; - pv_len = tvb_get_ntohs(tvb, newoffset); + newoffset++; + pv_len = tvb_get_ntohs(tvb, newoffset); proto_tree_add_item(t, hf_hip_tlv_dh_pv_length, tvb, newoffset, 2, FALSE); /* First Public value */ @@ -740,7 +766,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len proto_tree_add_item(t, hf_hip_tlv_dh_pv_length, tvb, newoffset, 2, FALSE); /* Second Public Value */ newoffset += 2; - proto_tree_add_item(t, hf_hip_tlv_dh_pub, tvb, newoffset, + proto_tree_add_item(t, hf_hip_tlv_dh_pub, tvb, newoffset, pv_len, FALSE); } break; @@ -754,27 +780,27 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len /* Suite # 1, 2, ..., n two bytes per transform id */ trans = tvb_get_ntohs(tvb, newoffset); - proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb, + proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb, newoffset, 2, trans, "%u (%s)", trans, val_to_str(trans, transform_id_vals, "Unknown")); tlv_len -= 2; newoffset += 2; } - break; - case PARAM_HIP_TRANSFORM: + break; + case PARAM_HIP_TRANSFORM: t = proto_item_add_subtree(ti, ett_hip_tlv_data); while (tlv_len > 0) { /* Suite # 1, 2, ..., n two bytes per transform id */ trans = tvb_get_ntohs(tvb, newoffset); - proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb, + proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb, newoffset, 2, trans, "%u (%s)", trans, val_to_str(trans, transform_id_vals, "Unknown")); - tlv_len -= 2; + tlv_len -= 2; newoffset += 2; } break; - case PARAM_NAT_TRAVERSAL_MODE: + case PARAM_NAT_TRAVERSAL_MODE: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_esp_reserved, tvb, newoffset, 2, FALSE); @@ -784,36 +810,35 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len /* Suite # 1, 2, ..., n two bytes per mode id */ trans = tvb_get_ntohs(tvb, newoffset); - proto_tree_add_uint_format(t, hf_hip_tlv_nat_traversal_mode_id, tvb, + proto_tree_add_uint_format(t, hf_hip_tlv_nat_traversal_mode_id, tvb, newoffset, 2, trans, "%u (%s)", trans, val_to_str(trans, mode_id_vals, "Unknown")); - tlv_len -= 2; + tlv_len -= 2; newoffset += 2; } - break; - case PARAM_TRANSACTION_PACING: + break; + case PARAM_TRANSACTION_PACING: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Min Ta */ proto_tree_add_item(t, hf_hip_tlv_transaction_minta, tvb, newoffset, 4, FALSE); break; - case PARAM_ENCRYPTED: + case PARAM_ENCRYPTED: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_enc_reserved, tvb, newoffset, 4, FALSE); newoffset += 4; - /* IV - 16 bytes IV for AES CBC RFC 3602 - 8 bytes IV for 3DES CBC RFC 2405 - 0 bytes IV for NULL - and + /* IV + 16 bytes IV for AES CBC RFC 3602 + 8 bytes IV for 3DES CBC RFC 2405 + 0 bytes IV for NULL + and encrypted data after that. */ - proto_tree_add_text(t, tvb, newoffset, tlv_len - 4, + proto_tree_add_text(t, tvb, newoffset, tlv_len - 4, "Encrypted Parameter Data (%u bytes)", tlv_len - 4); break; - case PARAM_HOST_ID: - if (type != PARAM_ENCRYPTED) - t = proto_item_add_subtree(ti, ett_hip_tlv_data); + case PARAM_HOST_ID: + t = proto_item_add_subtree(ti, ett_hip_tlv_data); hi_len = tvb_get_ntohs(tvb, newoffset); proto_tree_add_item(t, hf_hip_tlv_host_id_len, tvb, newoffset, 2, FALSE); newoffset += 2; @@ -832,26 +857,26 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len * <public key> */ hi_hdr = tvb_get_ntohl(tvb, newoffset); - ti_tlv = proto_tree_add_item(t, hf_hip_tlv_host_id_hdr, + ti_tlv = proto_tree_add_item(t, hf_hip_tlv_host_id_hdr, tvb, newoffset, 4, FALSE); if (ti_tlv) { ti_tlv = proto_item_add_subtree(ti_tlv, ett_hip_tlv_host_id_hdr); /* HDR Flags*/ - proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_flags, tvb, + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_flags, tvb, newoffset, 2, hi_hdr); newoffset += 2; /* HDR Protocol */ - proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_proto, tvb, + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_proto, tvb, newoffset, 1, hi_hdr); newoffset += 1; /* HDR Algorithm */ - proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_alg, tvb, + proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_alg, tvb, newoffset, 1, hi_hdr); } - algorithm = tvb_get_guint8(tvb, newoffset); + algorithm = tvb_get_guint8(tvb, newoffset); switch (algorithm) { case HI_ALG_DSA: - /* DSA KEY RR RFC 2536 + /* DSA KEY RR RFC 2536 * T 1 octet * Q 20 octets * P 64 + T*8 octets @@ -859,12 +884,12 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len * Y 64 + T*8 octets */ newoffset++; /* 12 + offset */ - /* T */ + /* T */ proto_tree_add_item(t, hf_hip_tlv_host_id_t, tvb, newoffset, 1, FALSE); hi_t = tvb_get_guint8(tvb, newoffset); newoffset++; - /* Q */ - proto_tree_add_item(t, hf_hip_tlv_host_id_q, tvb, newoffset, + /* Q */ + proto_tree_add_item(t, hf_hip_tlv_host_id_q, tvb, newoffset, 20, FALSE); newoffset += 20; if (hi_t > 56) /* max 4096 bits */ @@ -890,7 +915,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len */ newoffset++; /* 12 + offset */ /* E len */ - e_len = tvb_get_guint8(tvb, newoffset); + e_len = tvb_get_guint8(tvb, newoffset); proto_tree_add_item(t, hf_hip_tlv_host_id_e_len, tvb, newoffset, (e_len > 255) ? 3 : 1, FALSE); newoffset++; @@ -910,13 +935,13 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len e_len, FALSE); newoffset += e_len; hi_len -= e_len; - + if (hi_len > 512) { proto_tree_add_text(t, tvb, newoffset, 1, "<< Invalid HI length >>"); break; } - + /* RSA public modulus n */ proto_tree_add_item(t, hf_hip_tlv_host_id_n, tvb, newoffset, hi_len, FALSE); @@ -924,7 +949,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len default: proto_tree_add_text(t, tvb, newoffset, 1, "Unknown algorithm type (%d).\n", algorithm); - + break; } /* FQDN */ @@ -934,7 +959,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len /* RFC 1035 */ proto_tree_add_text(t, tvb, offset+16+hi_len, di_len, "FQDN: %s", tvb_get_ephemeral_string (tvb, offset+16+hi_len, di_len)); - } else if (di_type == 2) { + } else if (di_type == 2) { /* RFC 4282 */ proto_tree_add_text(t, tvb, offset+16+hi_len, di_len, "NAI: %s", tvb_get_ephemeral_string (tvb, offset+16+hi_len, di_len)); @@ -958,7 +983,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len proto_tree_add_item(t, hf_hip_tlv_certificate, tvb, newoffset, tlv_len-4, FALSE); break; - case PARAM_NOTIFICATION: + case PARAM_NOTIFICATION: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_notification_res, tvb, newoffset, 2, FALSE); @@ -971,9 +996,9 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len tlv_len-4, FALSE); break; case PARAM_ECHO_REQUEST_SIGNED: - case PARAM_ECHO_RESPONSE_SIGNED: - case PARAM_ECHO_REQUEST_UNSIGNED: - case PARAM_ECHO_RESPONSE_UNSIGNED: + case PARAM_ECHO_RESPONSE_SIGNED: + case PARAM_ECHO_REQUEST_UNSIGNED: + case PARAM_ECHO_RESPONSE_UNSIGNED: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Variable length Opaque Data */ proto_tree_add_item(t, hf_hip_tlv_opaque_data, tvb, newoffset, @@ -984,7 +1009,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len case PARAM_REG_RESPONSE: case PARAM_REG_FAILED: t = proto_item_add_subtree(ti, ett_hip_tlv_data); - if (type == PARAM_REG_INFO) { + if (type == PARAM_REG_INFO) { /* Min Lifetime */ proto_tree_add_item(t, hf_hip_tlv_reg_ltmin, tvb, newoffset, 1, FALSE); newoffset++; @@ -992,12 +1017,12 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len proto_tree_add_item(t, hf_hip_tlv_reg_ltmax, tvb, newoffset, 1, FALSE); newoffset++; tlv_len -= 2; - } else if (type == PARAM_REG_FAILED) { + } else if (type == PARAM_REG_FAILED) { /* Failure Type */ proto_tree_add_item(t, hf_hip_tlv_reg_failtype, tvb, newoffset, 1, FALSE); newoffset++;; tlv_len--; - } else { + } else { /* Lifetime */ proto_tree_add_item(t, hf_hip_tlv_reg_lt, tvb, newoffset, 1, FALSE); newoffset++; @@ -1006,16 +1031,16 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len /* Reg Type 1 ... n, Padding */ while (tlv_len > 0) { reg_type = tvb_get_guint8(tvb, newoffset); - proto_tree_add_uint_format(t, hf_hip_tlv_reg_type, tvb, + proto_tree_add_uint_format(t, hf_hip_tlv_reg_type, tvb, newoffset, 1, reg_type, "%u (%s)", reg_type, val_to_str(reg_type, reg_type_vals, "Unknown")); /* one byte per registration type */ - tlv_len--; + tlv_len--; newoffset++; } break; - case PARAM_HMAC: - case PARAM_HMAC_2: + case PARAM_HMAC: + case PARAM_HMAC_2: case PARAM_RVS_HMAC: case PARAM_RELAY_HMAC: t = proto_item_add_subtree(ti, ett_hip_tlv_data); @@ -1024,12 +1049,12 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len tlv_len, FALSE); break; case PARAM_HIP_SIGNATURE: - case PARAM_HIP_SIGNATURE_2: + case PARAM_HIP_SIGNATURE_2: t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Signature algorithm */ n = tvb_get_guint8(tvb, offset+4); proto_tree_add_uint_format(t, hf_hip_tlv_sig_alg, tvb, newoffset, 1, - n, "%u (%s)", n, + n, "%u (%s)", n, val_to_str(n, sig_alg_vals, "Unknown")); newoffset++; /* Signature */ @@ -1054,13 +1079,13 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Port */ proto_tree_add_item(t, hf_hip_tlv_relay_from_port, tvb, newoffset, 2, FALSE); - newoffset += 2; + newoffset += 2; /* Protocol */ proto_tree_add_item(t, hf_hip_tlv_relay_from_protocol, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_relay_from_reserved, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Address */ proto_tree_add_item(t, hf_hip_tlv_relay_to_address, tvb, newoffset, 16, FALSE); break; @@ -1068,13 +1093,13 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Port */ proto_tree_add_item(t, hf_hip_tlv_relay_to_port, tvb, newoffset, 2, FALSE); - newoffset += 2; + newoffset += 2; /* Protocol */ proto_tree_add_item(t, hf_hip_tlv_relay_to_protocol, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_relay_to_reserved, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Address */ proto_tree_add_item(t, hf_hip_tlv_relay_to_address, tvb, newoffset, 16, FALSE); break; @@ -1082,13 +1107,13 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len t = proto_item_add_subtree(ti, ett_hip_tlv_data); /* Port */ proto_tree_add_item(t, hf_hip_tlv_reg_from_port, tvb, newoffset, 2, FALSE); - newoffset += 2; + newoffset += 2; /* Protocol */ proto_tree_add_item(t, hf_hip_tlv_reg_from_protocol, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Reserved */ proto_tree_add_item(t, hf_hip_tlv_reg_from_reserved, tvb, newoffset, 1, FALSE); - newoffset += 1; + newoffset += 1; /* Address */ proto_tree_add_item(t, hf_hip_tlv_reg_from_address, tvb, newoffset, 16, FALSE); break; @@ -1103,382 +1128,382 @@ proto_register_hip(void) { static hf_register_info hf[] = { { &hf_hip_proto, - { "Payload Protocol", "hip.proto", + { "Payload Protocol", "hip.proto", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_hdr_len, - { "Header Length", "hip.hdr_len", + { "Header Length", "hip.hdr_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_packet_type, - { "Packet Type", "hip.packet_type", + { "Packet Type", "hip.packet_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_shim6_fixed_bit_p, - { "Header fixed bit P", "hip.shim6_fixed_p", + { "Header fixed bit P", "hip.shim6_fixed_p", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_version, - { "Version", "hip.version", + { "Version", "hip.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_shim6_fixed_bit_s, - { "Header fixed bit S", "hip.shim6_fixed_s", + { "Header fixed bit S", "hip.shim6_fixed_s", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_controls, - { "HIP Controls", "hip.controls", + { "HIP Controls", "hip.controls", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_controls_anon, - { "Anonymous (Sender's HI is anonymous)", "hip.controls.a", + { "Anonymous (Sender's HI is anonymous)", "hip.controls.a", FT_BOOLEAN, 16, NULL, HIP_CONTROL_A_MASK, NULL, HFILL }}, - + { &hf_hip_checksum, - { "Checksum", "hip.checksum", + { "Checksum", "hip.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_hit_sndr, - { "Sender's HIT", "hip.hit_sndr", + { "Sender's HIT", "hip.hit_sndr", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_hit_rcvr, - { "Receiver's HIT", "hip.hit_rcvr", + { "Receiver's HIT", "hip.hit_rcvr", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_type, - { "Type", "hip.type", + { "Type", "hip.type", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_r1_res, - { "Reserved", "hip.tlv.r1_reserved", + { "Reserved", "hip.tlv.r1_reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_r1count, - { "R1 Counter", "hip.tlv.r1_counter", + { "R1 Counter", "hip.tlv.r1_counter", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_puzzle_k, - { "Difficulty (K)", "hip.tlv_puzzle_k", + { "Difficulty (K)", "hip.tlv_puzzle_k", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_puzzle_life, - { "Lifetime", "hip.tlv_puzzle_lifetime", + { "Lifetime", "hip.tlv_puzzle_lifetime", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_puzzle_o, - { "Opaque Data", "hip.tlv_puzzle_opaque", + { "Opaque Data", "hip.tlv_puzzle_opaque", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_puzzle_i, - { "Random number (I)", "hip.tlv.puzzle_random_i", + { "Random number (I)", "hip.tlv.puzzle_random_i", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_solution_k, - { "Difficulty (K)", "hip.tlv_solution_k", + { "Difficulty (K)", "hip.tlv_solution_k", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_solution_reserved, - { "Reserved", "hip.tlv_solution_reserved", + { "Reserved", "hip.tlv_solution_reserved", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_solution_o, - { "Opaque Data", "hip.tlv_solution_opaque", + { "Opaque Data", "hip.tlv_solution_opaque", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_solution_i, - { "Random number (I)", "hip.tlv.solution_random_i", + { "Random number (I)", "hip.tlv.solution_random_i", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_solution_j, - { "Solution (J)", "hip.tlv_solution_j", + { "Solution (J)", "hip.tlv_solution_j", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_ei_res, - { "Reserved", "hip.tlv_esp_info_reserved", + { "Reserved", "hip.tlv_esp_info_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_ei_keyidx, - { "Keymaterial Index", "hip.tlv_esp_info_key_index", + { "Keymaterial Index", "hip.tlv_esp_info_key_index", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_ei_oldspi, - { "Old SPI", "hip.tlv_esp_info_old_spi", + { "Old SPI", "hip.tlv_esp_info_old_spi", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_ei_newspi, - { "New SPI", "hip.tlv_esp_info_new_spi", + { "New SPI", "hip.tlv_esp_info_new_spi", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_seq_updid, - { "Seq Update ID", "hip.tlv_seq_update_id", + { "Seq Update ID", "hip.tlv_seq_update_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_ack_updid, - { "ACKed Peer Update ID", "hip.tlv_ack_updid", + { "ACKed Peer Update ID", "hip.tlv_ack_updid", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_dh_group_id, - { "Group ID", "hip.tlv.dh_group_id", + { "Group ID", "hip.tlv.dh_group_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_dh_pv_length, - { "Public Value Length", "hip.tlv.dh_pv_length", + { "Public Value Length", "hip.tlv.dh_pv_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_dh_pub, - { "Public Value", "hip.tlv.dh_public_value", + { "Public Value", "hip.tlv.dh_public_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_trans_id, - { "Transform ID", "hip.tlv.trans_id", + { "Transform ID", "hip.tlv.trans_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_esp_reserved, - { "Reserved", "hip.tlv.esp_trans_res", + { "Reserved", "hip.tlv.esp_trans_res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_len, - { "Host Identity Length", "hip.tlv.host_id_length", + { "Host Identity Length", "hip.tlv.host_id_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_di_type, - { "Domain Identifier Type", "hip.tlv.host_domain_id_type", + { "Domain Identifier Type", "hip.tlv.host_domain_id_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_di_len, - { "Domain Identifier Length", "hip.tlv.host_domain_id_length", + { "Domain Identifier Length", "hip.tlv.host_domain_id_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_hdr, - { "Host Identity flags", "hip.tlv.host_id_hdr", + { "Host Identity flags", "hip.tlv.host_id_hdr", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_hdr_flags, - { "Host Identity Header Flags", "hip.tlv.host_id_header_flags", - FT_UINT32, BASE_HEX, VALS(hi_hdr_flags_vals), + { "Host Identity Header Flags", "hip.tlv.host_id_header_flags", + FT_UINT32, BASE_HEX, VALS(hi_hdr_flags_vals), HI_HDR_FLAGS_MASK, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_hdr_proto, - { "Host Identity Header Protocol", "hip.tlv.host_id_header_proto", - FT_UINT32, BASE_HEX, VALS(hi_hdr_proto_vals), + { "Host Identity Header Protocol", "hip.tlv.host_id_header_proto", + FT_UINT32, BASE_HEX, VALS(hi_hdr_proto_vals), HI_HDR_PROTO_MASK, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_hdr_alg, - { "Host Identity Header Algorithm", "hip.tlv.host_id_header_algo", - FT_UINT32, BASE_HEX, VALS(hi_hdr_alg_vals), + { "Host Identity Header Algorithm", "hip.tlv.host_id_header_algo", + FT_UINT32, BASE_HEX, VALS(hi_hdr_alg_vals), HI_HDR_ALG_MASK, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_t, - { "Host Identity T", "hip.tlv.host_identity_t", + { "Host Identity T", "hip.tlv.host_identity_t", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_q, - { "Host Identity Q", "hip.tlv.host_identity_q", + { "Host Identity Q", "hip.tlv.host_identity_q", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_p, - { "Host Identity P", "hip.tlv.host_id_p", + { "Host Identity P", "hip.tlv.host_id_p", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_host_id_g, - { "Host Identity G", "hip.tlv.host_id_g", + { "Host Identity G", "hip.tlv.host_id_g", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_host_id_y, - { "Host Identity Y (public value)", "hip.tlv.host_id_y", + { "Host Identity Y (public value)", "hip.tlv.host_id_y", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_e_len, { "RSA Host Identity exponent length (e_len)", "hip.tlv.host_id_e_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_e, - { "RSA Host Identity exponent (e)", "hip.tlv.host_id_e", + { "RSA Host Identity exponent (e)", "hip.tlv.host_id_e", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_host_id_n, - { "RSA Host Identity public modulus (n)", "hip.tlv.host_id_n", + { "RSA Host Identity public modulus (n)", "hip.tlv.host_id_n", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_notification_res, - { "Notification Reserved", "hip.tlv.notification_res", + { "Notification Reserved", "hip.tlv.notification_res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_notification_type, - { "Notification Message Type", "hip.tlv.notification_type", + { "Notification Message Type", "hip.tlv.notification_type", FT_UINT16, BASE_DEC, VALS(notification_vals), 0xFFFF, NULL, HFILL }}, - + { &hf_hip_tlv_notification_data, - { "Notification Data", "hip.tlv.notification_data", + { "Notification Data", "hip.tlv.notification_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_opaque_data, - { "Opaque Data", "hip.tlv.opaque_data", + { "Opaque Data", "hip.tlv.opaque_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_ltmin, - { "Minimum Registration Lifetime", "hip.tlv.reg_ltmin", + { "Minimum Registration Lifetime", "hip.tlv.reg_ltmin", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_ltmax, - { "Maximum Registration Lifetime", "hip.tlv.reg_ltmax", + { "Maximum Registration Lifetime", "hip.tlv.reg_ltmax", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_lt, - { "Registration Lifetime", "hip.tlv.reg_lt", + { "Registration Lifetime", "hip.tlv.reg_lt", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_type, - { "Registration Type", "hip.tlv.reg_type", + { "Registration Type", "hip.tlv.reg_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_failtype, - { "Registration Failure Type", "hip.tlv.reg_failtype", + { "Registration Failure Type", "hip.tlv.reg_failtype", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_hmac, - { "HMAC", "hip.tlv.hmac", + { "HMAC", "hip.tlv.hmac", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_sig_alg, - { "Signature Algorithm", "hip.tlv.sig_alg", + { "Signature Algorithm", "hip.tlv.sig_alg", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_sig, - { "Signature", "hip.tlv.sig", + { "Signature", "hip.tlv.sig", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_enc_reserved, - { "Reserved", "hip.tlv.enc_reserved", + { "Reserved", "hip.tlv.enc_reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_traffic_type, - { "Traffic Type", "hip.tlv.locator_traffic_type", + { "Traffic Type", "hip.tlv.locator_traffic_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_type, - { "Locator Type", "hip.tlv.locator_type", + { "Locator Type", "hip.tlv.locator_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_len, - { "Locator Length", "hip.tlv.locator_len", + { "Locator Length", "hip.tlv.locator_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_reserved, - { "Reserved", "hip.tlv.locator_reserved", + { "Reserved", "hip.tlv.locator_reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_lifetime, - { "Locator Lifetime", "hip.tlv.locator_lifetime", + { "Locator Lifetime", "hip.tlv.locator_lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_port, - { "Locator port", "hip.tlv.locator_port", + { "Locator port", "hip.tlv.locator_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_transport_protocol, - { "Locator transport protocol", "hip.tlv.locator_transport_protocol", + { "Locator transport protocol", "hip.tlv.locator_transport_protocol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_kind, - { "Locator kind", "hip.tlv.locator_kind", + { "Locator kind", "hip.tlv.locator_kind", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_priority, - { "Locator priority", "hip.tlv.locator_priority", + { "Locator priority", "hip.tlv.locator_priority", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_spi, - { "Locator spi", "hip.tlv.locator_spi", + { "Locator spi", "hip.tlv.locator_spi", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_locator_address, - { "Locator" , "hip.tlv.locator_address", + { "Locator" , "hip.tlv.locator_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_cert_group, - { "Cert group", "hip.tlv.cert_group", + { "Cert group", "hip.tlv.cert_group", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_cert_count, - { "Cert count", "hip.tlv.cert_count", + { "Cert count", "hip.tlv.cert_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_cert_id, - { "Cert ID", "hip.tlv.cert_id", + { "Cert ID", "hip.tlv.cert_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_cert_type, - { "Cert type", "hip.tlv.cert_type", + { "Cert type", "hip.tlv.cert_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_certificate, - { "Certificate", "hip.tlv.certificate", + { "Certificate", "hip.tlv.certificate", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_nat_traversal_mode_id, - { "NAT Traversal Mode ID", "hip.tlv.nat_traversal_mode_id", + { "NAT Traversal Mode ID", "hip.tlv.nat_traversal_mode_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_from_port, - { "Relay From Port", "hip.tlv.relay_from_port", + { "Relay From Port", "hip.tlv.relay_from_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_to_port, - { "Relay To Port", "hip.tlv.relay_to_port", + { "Relay To Port", "hip.tlv.relay_to_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - + { &hf_hip_tlv_reg_from_port, - { "Port", "hip.tlv.reg_from_port", + { "Port", "hip.tlv.reg_from_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_transaction_minta, - { "Min Ta" , "hip.tlv_transaction_minta", + { "Min Ta" , "hip.tlv_transaction_minta", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_from_address, - { "Address" , "hip.tlv_from_address", + { "Address" , "hip.tlv_from_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_rvs_address, - { "RVS Address" , "hip.tlv_rvs_address", + { "RVS Address" , "hip.tlv_rvs_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_from_protocol, - { "Protocol" , "hip.tlv_relay_from_protocol", + { "Protocol" , "hip.tlv_relay_from_protocol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_from_reserved, - { "Reserved" , "hip.tlv_relay_from_reserved", + { "Reserved" , "hip.tlv_relay_from_reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_from_address, - { "Address" , "hip.tlv_relay_from_address", + { "Address" , "hip.tlv_relay_from_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_to_protocol, - { "Protocol" , "hip.tlv_relay_to_protocol", + { "Protocol" , "hip.tlv_relay_to_protocol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_to_reserved, - { "Reserved" , "hip.tlv_relay_to_reserved", + { "Reserved" , "hip.tlv_relay_to_reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_relay_to_address, - { "Address" , "hip.tlv_relay_to_address", + { "Address" , "hip.tlv_relay_to_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_reg_from_protocol, - { "Protocol" , "hip.tlv_reg_from_protocol", + { "Protocol" , "hip.tlv_reg_from_protocol", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_reg_from_reserved, - { "Reserved" , "hip.tlv_reg_from_reserved", + { "Reserved" , "hip.tlv_reg_from_reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_hip_tlv_reg_from_address, - { "Address" , "hip.tlv_reg_from_address", + { "Address" , "hip.tlv_reg_from_address", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; @@ -1489,6 +1514,7 @@ proto_register_hip(void) &ett_hip_tlv, &ett_hip_tlv_data, &ett_hip_tlv_host_id_hdr, + &ett_hip_locator_data, }; proto_hip = proto_register_protocol("Host Identity Protocol", @@ -1503,7 +1529,7 @@ proto_reg_handoff_hip(void) { dissector_handle_t hip_handle; dissector_handle_t hip_handle2; - + hip_handle = create_dissector_handle(dissect_hip, proto_hip); dissector_add("ip.proto", IP_PROTO_HIP, hip_handle); |