aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hip.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-hip.c')
-rw-r--r--epan/dissectors/packet-hip.c287
1 files changed, 143 insertions, 144 deletions
diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c
index 4c84f7b37e..0c7d7c9532 100644
--- a/epan/dissectors/packet-hip.c
+++ b/epan/dissectors/packet-hip.c
@@ -31,6 +31,9 @@
void proto_register_hip(void);
void proto_reg_handoff_hip(void);
+static dissector_handle_t hip_ip_handle;
+static dissector_handle_t hip_udp_handle;
+
#define HIP_UDP_PORT 10500
#define HI_ALG_DSA 3
@@ -288,123 +291,123 @@ static const value_string hit_suite_vals[] = {
/* functions */
static int dissect_hip_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item *ti, int type, int tlv_len);
-static int proto_hip = -1;
-static int hf_hip_proto = -1;
-static int hf_hip_hdr_len = -1;
-static int hf_hip_shim6_fixed_bit_p = -1;
-static int hf_hip_packet_type = -1;
-static int hf_hip_version = -1;
-static int hf_hip_shim6_fixed_bit_s = -1;
-static int hf_hip_controls = -1;
-static int hf_hip_controls_anon = -1;
-static int hf_hip_checksum = -1;
-static int hf_hip_checksum_status = -1;
-static int hf_hip_hit_sndr = -1;
-static int hf_hip_hit_rcvr = -1;
-
-static int hf_hip_type = -1;
-static int hf_hip_tlv_ei_res = -1;
-static int hf_hip_tlv_ei_keyidx = -1;
-static int hf_hip_tlv_ei_oldspi = -1;
-static int hf_hip_tlv_ei_newspi = -1;
-static int hf_hip_tlv_r1_res = -1;
-static int hf_hip_tlv_r1count = -1;
-static int hf_hip_tlv_puzzle_k = -1;
-static int hf_hip_tlv_puzzle_life = -1;
-static int hf_hip_tlv_puzzle_o = -1;
-static int hf_hip_tlv_puzzle_i = -1;
-static int hf_hip_tlv_solution_k = -1;
-static int hf_hip_tlv_solution_reserved = -1;
-static int hf_hip_tlv_solution_o = -1;
-static int hf_hip_tlv_solution_i = -1;
-static int hf_hip_tlv_solution_j = -1;
-static int hf_hip_tlv_seq_updid = -1;
-static int hf_hip_tlv_ack_updid = -1;
-static int hf_hip_tlv_dh_group_id = -1;
-static int hf_hip_tlv_dh_pub = -1;
-static int hf_hip_tlv_dh_pv_length = -1;
-static int hf_hip_tlv_trans_id = -1;
-static int hf_hip_tlv_esp_reserved = -1;
-static int hf_hip_tlv_cipher_id = -1;
-static int hf_hip_tlv_hit_suite_id = -1;
-static int hf_hip_tlv_host_id_len = -1;
-static int hf_hip_tlv_host_di_type = -1;
-static int hf_hip_tlv_host_di_len = -1;
-static int hf_hip_tlv_host_id_hdr = -1;
-static int hf_hip_tlv_host_id_hdr_flags = -1;
-static int hf_hip_tlv_host_id_hdr_proto = -1;
-static int hf_hip_tlv_host_id_hdr_alg = -1;
-static int hf_hip_tlv_host_id_t = -1;
-static int hf_hip_tlv_host_id_q = -1;
-static int hf_hip_tlv_host_id_p = -1;
-static int hf_hip_tlv_host_id_g = -1;
-static int hf_hip_tlv_host_id_y = -1;
-static int hf_hip_tlv_host_id_e_len = -1;
-static int hf_hip_tlv_host_id_e = -1;
-static int hf_hip_tlv_host_id_n = -1;
-static int hf_hip_tlv_notification_res = -1;
-static int hf_hip_tlv_notification_type = -1;
-static int hf_hip_tlv_notification_data = -1;
-static int hf_hip_tlv_opaque_data = -1;
-static int hf_hip_tlv_reg_ltmin = -1;
-static int hf_hip_tlv_reg_ltmax = -1;
-static int hf_hip_tlv_reg_lt = -1;
-static int hf_hip_tlv_reg_type = -1;
-static int hf_hip_tlv_reg_failtype = -1;
-static int hf_hip_tlv_hmac = -1;
-static int hf_hip_tlv_sig_alg = -1;
-static int hf_hip_tlv_sig = -1;
-static int hf_hip_tlv_enc_reserved = -1;
-static int hf_hip_tlv_locator_traffic_type = -1;
-static int hf_hip_tlv_locator_type = -1;
-static int hf_hip_tlv_locator_len = -1;
-static int hf_hip_tlv_locator_reserved = -1;
-static int hf_hip_tlv_locator_lifetime = -1;
-static int hf_hip_tlv_locator_port = -1;
-static int hf_hip_tlv_locator_transport_protocol = -1;
-static int hf_hip_tlv_locator_kind = -1;
-static int hf_hip_tlv_locator_priority = -1;
-static int hf_hip_tlv_locator_spi = -1;
-static int hf_hip_tlv_locator_address = -1;
-
-static int hf_hip_tlv_cert_group = -1;
-static int hf_hip_tlv_cert_count = -1;
-static int hf_hip_tlv_cert_id = -1;
-static int hf_hip_tlv_cert_type = -1;
-static int hf_hip_tlv_certificate = -1;
-
-static int hf_hip_tlv_from_address = -1;
-static int hf_hip_tlv_rvs_address = -1;
-
-static int hf_hip_tlv_nat_traversal_mode_id = -1;
-static int hf_hip_tlv_transaction_minta = -1;
-static int hf_hip_tlv_relay_from_port = -1;
-static int hf_hip_tlv_relay_from_protocol = -1;
-static int hf_hip_tlv_relay_from_reserved = -1;
-static int hf_hip_tlv_relay_from_address = -1;
-static int hf_hip_tlv_relay_to_port = -1;
-static int hf_hip_tlv_relay_to_protocol = -1;
-static int hf_hip_tlv_relay_to_reserved = -1;
-static int hf_hip_tlv_relay_to_address = -1;
-static int hf_hip_tlv_reg_from_port = -1;
-static int hf_hip_tlv_reg_from_protocol = -1;
-static int hf_hip_tlv_reg_from_reserved = -1;
-static int hf_hip_tlv_reg_from_address = -1;
-static int hf_hip_encrypted_parameter_data = -1;
-static int hf_hip_fqdn = -1;
-static int hf_hip_nai = -1;
-
-static gint ett_hip = -1;
-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;
-
-static expert_field ei_hip_tlv_host_id_len = EI_INIT;
-/* static expert_field ei_hip_tlv_host_id_e_len = EI_INIT; */
-static expert_field ei_hip_tlv_host_id_hdr_alg = EI_INIT;
-static expert_field ei_hip_checksum = EI_INIT;
+static int proto_hip;
+static int hf_hip_proto;
+static int hf_hip_hdr_len;
+static int hf_hip_shim6_fixed_bit_p;
+static int hf_hip_packet_type;
+static int hf_hip_version;
+static int hf_hip_shim6_fixed_bit_s;
+static int hf_hip_controls;
+static int hf_hip_controls_anon;
+static int hf_hip_checksum;
+static int hf_hip_checksum_status;
+static int hf_hip_hit_sndr;
+static int hf_hip_hit_rcvr;
+
+static int hf_hip_type;
+static int hf_hip_tlv_ei_res;
+static int hf_hip_tlv_ei_keyidx;
+static int hf_hip_tlv_ei_oldspi;
+static int hf_hip_tlv_ei_newspi;
+static int hf_hip_tlv_r1_res;
+static int hf_hip_tlv_r1count;
+static int hf_hip_tlv_puzzle_k;
+static int hf_hip_tlv_puzzle_life;
+static int hf_hip_tlv_puzzle_o;
+static int hf_hip_tlv_puzzle_i;
+static int hf_hip_tlv_solution_k;
+static int hf_hip_tlv_solution_reserved;
+static int hf_hip_tlv_solution_o;
+static int hf_hip_tlv_solution_i;
+static int hf_hip_tlv_solution_j;
+static int hf_hip_tlv_seq_updid;
+static int hf_hip_tlv_ack_updid;
+static int hf_hip_tlv_dh_group_id;
+static int hf_hip_tlv_dh_pub;
+static int hf_hip_tlv_dh_pv_length;
+static int hf_hip_tlv_trans_id;
+static int hf_hip_tlv_esp_reserved;
+static int hf_hip_tlv_cipher_id;
+static int hf_hip_tlv_hit_suite_id;
+static int hf_hip_tlv_host_id_len;
+static int hf_hip_tlv_host_di_type;
+static int hf_hip_tlv_host_di_len;
+static int hf_hip_tlv_host_id_hdr;
+static int hf_hip_tlv_host_id_hdr_flags;
+static int hf_hip_tlv_host_id_hdr_proto;
+static int hf_hip_tlv_host_id_hdr_alg;
+static int hf_hip_tlv_host_id_t;
+static int hf_hip_tlv_host_id_q;
+static int hf_hip_tlv_host_id_p;
+static int hf_hip_tlv_host_id_g;
+static int hf_hip_tlv_host_id_y;
+static int hf_hip_tlv_host_id_e_len;
+static int hf_hip_tlv_host_id_e;
+static int hf_hip_tlv_host_id_n;
+static int hf_hip_tlv_notification_res;
+static int hf_hip_tlv_notification_type;
+static int hf_hip_tlv_notification_data;
+static int hf_hip_tlv_opaque_data;
+static int hf_hip_tlv_reg_ltmin;
+static int hf_hip_tlv_reg_ltmax;
+static int hf_hip_tlv_reg_lt;
+static int hf_hip_tlv_reg_type;
+static int hf_hip_tlv_reg_failtype;
+static int hf_hip_tlv_hmac;
+static int hf_hip_tlv_sig_alg;
+static int hf_hip_tlv_sig;
+static int hf_hip_tlv_enc_reserved;
+static int hf_hip_tlv_locator_traffic_type;
+static int hf_hip_tlv_locator_type;
+static int hf_hip_tlv_locator_len;
+static int hf_hip_tlv_locator_reserved;
+static int hf_hip_tlv_locator_lifetime;
+static int hf_hip_tlv_locator_port;
+static int hf_hip_tlv_locator_transport_protocol;
+static int hf_hip_tlv_locator_kind;
+static int hf_hip_tlv_locator_priority;
+static int hf_hip_tlv_locator_spi;
+static int hf_hip_tlv_locator_address;
+
+static int hf_hip_tlv_cert_group;
+static int hf_hip_tlv_cert_count;
+static int hf_hip_tlv_cert_id;
+static int hf_hip_tlv_cert_type;
+static int hf_hip_tlv_certificate;
+
+static int hf_hip_tlv_from_address;
+static int hf_hip_tlv_rvs_address;
+
+static int hf_hip_tlv_nat_traversal_mode_id;
+static int hf_hip_tlv_transaction_minta;
+static int hf_hip_tlv_relay_from_port;
+static int hf_hip_tlv_relay_from_protocol;
+static int hf_hip_tlv_relay_from_reserved;
+static int hf_hip_tlv_relay_from_address;
+static int hf_hip_tlv_relay_to_port;
+static int hf_hip_tlv_relay_to_protocol;
+static int hf_hip_tlv_relay_to_reserved;
+static int hf_hip_tlv_relay_to_address;
+static int hf_hip_tlv_reg_from_port;
+static int hf_hip_tlv_reg_from_protocol;
+static int hf_hip_tlv_reg_from_reserved;
+static int hf_hip_tlv_reg_from_address;
+static int hf_hip_encrypted_parameter_data;
+static int hf_hip_fqdn;
+static int hf_hip_nai;
+
+static gint ett_hip;
+static gint ett_hip_controls;
+static gint ett_hip_tlv;
+static gint ett_hip_tlv_data;
+static gint ett_hip_tlv_host_id_hdr;
+static gint ett_hip_locator_data;
+
+static expert_field ei_hip_tlv_host_id_len;
+/* static expert_field ei_hip_tlv_host_id_e_len; */
+static expert_field ei_hip_tlv_host_id_hdr_alg;
+static expert_field ei_hip_checksum;
/* Dissect the HIP packet */
static void
@@ -997,10 +1000,10 @@ dissect_hip_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item *ti, i
break;
if (di_type == 1) {
/* RFC 1035 */
- proto_tree_add_item(t, hf_hip_fqdn, tvb, offset+16+hi_len, di_len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(t, hf_hip_fqdn, tvb, offset+16+hi_len, di_len, ENC_ASCII);
} else if (di_type == 2) {
/* RFC 4282 */
- proto_tree_add_item(t, hf_hip_nai, tvb, offset+16+hi_len, di_len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(t, hf_hip_nai, tvb, offset+16+hi_len, di_len, ENC_ASCII);
}
break;
case PARAM_CERT: /* CERT */
@@ -1371,7 +1374,7 @@ proto_register_hip(void)
{ &hf_hip_tlv_notification_type,
{ "Notification Message Type", "hip.tlv.notification_type",
- FT_UINT16, BASE_DEC, VALS(notification_vals), 0xFFFF, NULL, HFILL }},
+ FT_UINT16, BASE_DEC, VALS(notification_vals), 0x0, NULL, HFILL }},
{ &hf_hip_tlv_notification_data,
{ "Notification Data", "hip.tlv.notification_data",
@@ -1458,7 +1461,7 @@ proto_register_hip(void)
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,
@@ -1498,63 +1501,63 @@ proto_register_hip(void)
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 }},
{ &hf_hip_encrypted_parameter_data,
- { "Encrypted Parameter Data" , "hip.encrypted_parameter_data",
+ { "Encrypted Parameter Data", "hip.encrypted_parameter_data",
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_hip_fqdn,
- { "FQDN" , "hip.fqdn",
+ { "FQDN", "hip.fqdn",
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_hip_nai,
- { "NAI" , "hip.nai",
+ { "NAI", "hip.nai",
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
};
@@ -1580,6 +1583,8 @@ proto_register_hip(void)
expert_module_t* expert_hip;
proto_hip = proto_register_protocol("Host Identity Protocol", "HIP", "hip");
+ hip_ip_handle = register_dissector("hip", dissect_hip, proto_hip);
+ hip_udp_handle = register_dissector("hip_udp", dissect_hip_in_udp, proto_hip);
proto_register_field_array(proto_hip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@@ -1590,14 +1595,8 @@ proto_register_hip(void)
void
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_uint("ip.proto", IP_PROTO_HIP, hip_handle);
-
- hip_handle2 = create_dissector_handle(dissect_hip_in_udp, proto_hip);
- dissector_add_uint_with_preference("udp.port", HIP_UDP_PORT, hip_handle2);
+ dissector_add_uint("ip.proto", IP_PROTO_HIP, hip_ip_handle);
+ dissector_add_uint_with_preference("udp.port", HIP_UDP_PORT, hip_udp_handle);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html