packet-infiniband: Fixed displaying reserved field

1. Added Extended transport type field instead of reserved as per latest
release 1.3.1 in CM Req msg.
2. Defined reserved bits and bytes for CM messages
3. Minor code refactor to move to smaller functions for CM Req Rsp
parsing instead of 200+ lines function which is hard to read and
is expected to grow for more features
4. Cleanup around primary and alternate fields which were crossing byte
boundary

CM request and response messages are tested.
Reject message reserved fields change is untested but it a minor change
that is expected to work.

Change-Id: I94da62614f854218249b4e14c780f4168f44751c
Reported-by: Alexis La Goutte
Tested-by: paravpandit@yahoo.com
Reviewed-on: https://code.wireshark.org/review/18340
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
This commit is contained in:
Parav Pandit 2016-10-20 07:06:07 -04:00 committed by Jaap Keuter
parent 875b3e2732
commit 3156980aa5
1 changed files with 306 additions and 220 deletions

View File

@ -491,6 +491,9 @@ static const value_string OperationalVLs[]= {
{ 0, NULL}
};
/* For reserved fields in various packets */
static int hf_infiniband_reserved1 = -1;
static int hf_infiniband_reserved4 = -1;
/* Local Route Header (LRH) */
static int hf_infiniband_LRH = -1;
static int hf_infiniband_virtual_lane = -1;
@ -592,28 +595,35 @@ static int hf_cm_req_rdc_exists = -1;
static int hf_cm_req_rnr_retry_count = -1;
static int hf_cm_req_max_cm_retries = -1;
static int hf_cm_req_srq = -1;
static int hf_cm_req_extended_transport = -1;
static int hf_cm_req_primary_local_lid = -1;
static int hf_cm_req_primary_remote_lid = -1;
static int hf_cm_req_primary_local_gid = -1;
static int hf_cm_req_primary_remote_gid = -1;
static int hf_cm_req_primary_flow_label = -1;
static int hf_cm_req_primary_reserved0 = -1;
static int hf_cm_req_primary_packet_rate = -1;
static int hf_cm_req_primary_traffic_class = -1;
static int hf_cm_req_primary_hop_limit = -1;
static int hf_cm_req_primary_sl = -1;
static int hf_cm_req_primary_subnet_local = -1;
static int hf_cm_req_primary_reserved1 = -1;
static int hf_cm_req_primary_local_ack_to = -1;
static int hf_cm_req_primary_reserved2 = -1;
static int hf_cm_req_alt_local_lid = -1;
static int hf_cm_req_alt_remote_lid = -1;
static int hf_cm_req_alt_local_gid = -1;
static int hf_cm_req_alt_remote_gid = -1;
static int hf_cm_req_flow_label = -1;
static int hf_cm_req_alt_reserved0 = -1;
static int hf_cm_req_packet_rate = -1;
static int hf_cm_req_alt_traffic_class = -1;
static int hf_cm_req_alt_hop_limit = -1;
static int hf_cm_req_SL = -1;
static int hf_cm_req_subnet_local = -1;
static int hf_cm_req_alt_reserved1 = -1;
static int hf_cm_req_local_ACK_timeout = -1;
static int hf_cm_req_alt_reserved2 = -1;
static int hf_cm_req_private_data = -1;
/* CM REP Header */
static int hf_cm_rep_localcommid = -1;
@ -629,6 +639,7 @@ static int hf_cm_rep_failoveracc = -1;
static int hf_cm_rep_e2eflowctl = -1;
static int hf_cm_rep_rnrretrycount = -1;
static int hf_cm_rep_srq = -1;
static int hf_cm_rep_reserved = -1;
static int hf_cm_rep_localcaguid = -1;
static int hf_cm_rep_privatedata = -1;
/* CM RTU Header */
@ -639,7 +650,9 @@ static int hf_cm_rtu_privatedata = -1;
static int hf_cm_rej_local_commid = -1;
static int hf_cm_rej_remote_commid = -1;
static int hf_cm_rej_msg_rej = -1;
static int hf_cm_rej_msg_reserved0 = -1;
static int hf_cm_rej_rej_info_len = -1;
static int hf_cm_rej_msg_reserved1 = -1;
static int hf_cm_rej_reason = -1;
static int hf_cm_rej_add_rej_info = -1;
static int hf_cm_rej_private_data = -1;
@ -657,7 +670,6 @@ static int hf_infiniband_MAD = -1;
static int hf_infiniband_base_version = -1;
static int hf_infiniband_mgmt_class = -1;
static int hf_infiniband_class_version = -1;
/* static int hf_infiniband_reserved1 = -1; */
static int hf_infiniband_method = -1;
static int hf_infiniband_status = -1;
static int hf_infiniband_class_specific = -1;
@ -2933,107 +2945,11 @@ static void parse_CM_Req_ServiceID(proto_tree *parent_tree, tvbuff_t *tvb, gint
}
*offset = local_offset;
}
/* Parse Communications Management
* IN: parentTree to add the dissection to
* IN: tvb - the data buffer from wireshark
* IN/OUT: The current and updated offset */
static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
static void save_conversation_info(packet_info *pinfo, guint8 *local_gid, guint8 *remote_gid,
guint32 local_qpn, guint32 local_lid, guint32 remote_lid,
guint64 serviceid, MAD_Data *MadData)
{
MAD_Data MadData;
gint local_offset;
guint8 *local_gid, *remote_gid;
const char *label;
proto_item *CM_header_item;
proto_tree *CM_header_tree;
tvbuff_t *next_tvb;
heur_dtbl_entry_t *hdtbl_entry;
local_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE);
remote_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE);
if (!parse_MAD_Common(parentTree, tvb, offset, &MadData))
{
/* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
return;
}
local_offset = *offset;
CM_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 140, ENC_NA);
label = val_to_str_const(MadData.attributeID, CM_Attributes, "(Unknown CM Attribute)");
proto_item_set_text(CM_header_item, "CM %s", label);
col_add_fstr(pinfo->cinfo, COL_INFO, "CM: %s", label);
CM_header_tree = proto_item_add_subtree(CM_header_item, ett_cm);
switch (MadData.attributeID) {
case ATTR_CM_REQ: {
guint32 local_qpn;
guint32 local_lid;
guint32 remote_lid;
guint64 serviceid;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_comm_id, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
local_offset += 4; /* skip reserved */
serviceid = tvb_get_ntoh64(tvb, local_offset);
parse_CM_Req_ServiceID(CM_header_tree, tvb, &local_offset, serviceid);
proto_tree_add_item(CM_header_tree, hf_cm_req_local_ca_guid, tvb, local_offset, 8, ENC_BIG_ENDIAN); local_offset += 8;
local_offset += 4; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_local_qkey, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_qpn, tvb, local_offset, 3, ENC_BIG_ENDIAN);
local_qpn = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_respo_res, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_eecn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_init_depth, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_remote_eecn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_remote_cm_resp_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_transp_serv_type, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_e2e_flow_ctrl, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_start_psn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_cm_resp_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_retry_count, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_pkey, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_path_pp_mtu, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_rdc_exists, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_rnr_retry_count, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_max_cm_retries, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_srq, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
local_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
remote_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_gid, tvb, local_offset, 16, ENC_NA);
tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)local_gid); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_gid, tvb, local_offset, 16, ENC_NA);
tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)remote_gid); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_flow_label, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 2;
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_packet_rate, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_traffic_class, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_hop_limit, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_sl, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_subnet_local, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_ack_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_gid, tvb, local_offset, 16, ENC_NA); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_gid, tvb, local_offset, 16, ENC_NA); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_flow_label, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 2;
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_packet_rate, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_traffic_class, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_hop_limit, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_SL, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_subnet_local, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_req_local_ACK_timeout, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
/* the following saves information about the conversation this packet defines,
so there's no point in doing it more than once per packet */
if (!pinfo->fd->flags.visited)
@ -3055,7 +2971,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
/* save the context to the context hash table, for retrieval when the corresponding
CM REP message arrives*/
*hash_key = MadData.transactionID;
*hash_key = MadData->transactionID;
*hash_key = add_address_to_hash64(*hash_key, &pinfo->src);
g_hash_table_replace(CM_context_table, hash_key, connection);
@ -3069,6 +2985,87 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
PT_IBQP, pinfo->srcport, pinfo->destport, 0);
conversation_add_proto_data(conv, proto_infiniband, proto_data);
}
}
static void parse_CM_Req(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset,
MAD_Data *MadData, proto_tree *CM_header_tree)
{
tvbuff_t *next_tvb;
heur_dtbl_entry_t *hdtbl_entry;
guint8 *local_gid, *remote_gid;
guint64 serviceid;
gint local_offset;
guint32 local_qpn;
guint32 local_lid;
guint32 remote_lid;
local_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE);
remote_gid = (guint8 *)wmem_alloc(wmem_packet_scope(), GID_SIZE);
local_offset = *offset;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_comm_id, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved4, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
serviceid = tvb_get_ntoh64(tvb, local_offset);
parse_CM_Req_ServiceID(CM_header_tree, tvb, &local_offset, serviceid);
proto_tree_add_item(CM_header_tree, hf_cm_req_local_ca_guid, tvb, local_offset, 8, ENC_BIG_ENDIAN); local_offset += 8;
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved4, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_qkey, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_qpn, tvb, local_offset, 3, ENC_BIG_ENDIAN);
local_qpn = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_respo_res, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_eecn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_init_depth, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_remote_eecn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_remote_cm_resp_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_transp_serv_type, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_e2e_flow_ctrl, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_start_psn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_cm_resp_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_retry_count, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_pkey, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_path_pp_mtu, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_rdc_exists, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_rnr_retry_count, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_max_cm_retries, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_srq, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_extended_transport, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
local_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN);
remote_lid = tvb_get_ntohs(tvb, local_offset); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_gid, tvb, local_offset, 16, ENC_NA);
tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)local_gid); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_remote_gid, tvb, local_offset, 16, ENC_NA);
tvb_get_ipv6(tvb, local_offset, (struct e_in6_addr*)remote_gid); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_flow_label, tvb, local_offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_reserved0, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_packet_rate, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_traffic_class, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_hop_limit, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_sl, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_subnet_local, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_local_ack_to, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_primary_reserved2, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_lid, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_local_gid, tvb, local_offset, 16, ENC_NA); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_remote_gid, tvb, local_offset, 16, ENC_NA); local_offset += 16;
proto_tree_add_item(CM_header_tree, hf_cm_req_flow_label, tvb, local_offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_reserved0, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_packet_rate, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_traffic_class, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_hop_limit, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_SL, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_subnet_local, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_req_local_ACK_timeout, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_req_alt_reserved2, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
save_conversation_info(pinfo, local_gid, remote_gid, local_qpn, local_lid, remote_lid, serviceid, MadData);
/* give a chance for subdissectors to analyze the private data */
next_tvb = tvb_new_subset_length(tvb, local_offset, 92);
@ -3077,20 +3074,29 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
proto_tree_add_item(CM_header_tree, hf_cm_req_private_data, tvb, local_offset, 92, ENC_NA);
local_offset += 92;
*offset = local_offset;
}
break;
case ATTR_CM_REP: {
static void parse_CM_Rsp(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset,
MAD_Data *MadData, proto_tree *CM_header_tree)
{
tvbuff_t *next_tvb;
heur_dtbl_entry_t *hdtbl_entry;
guint32 remote_qpn;
gint local_offset;
local_offset = *offset;
proto_tree_add_item(CM_header_tree, hf_cm_rep_localcommid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_rep_remotecommid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_rep_localqkey, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_rep_localqpn, tvb, local_offset, 3, ENC_BIG_ENDIAN);
remote_qpn = tvb_get_ntoh24(tvb, local_offset); local_offset += 3;
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_localeecontnum, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_startingpsn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_responderres, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_initiatordepth, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_tgtackdelay, tvb, local_offset, 1, ENC_BIG_ENDIAN);
@ -3098,7 +3104,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
proto_tree_add_item(CM_header_tree, hf_cm_rep_e2eflowctl, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_rnrretrycount, tvb, local_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(CM_header_tree, hf_cm_rep_srq, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_rep_reserved, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rep_localcaguid, tvb, local_offset, 8, ENC_BIG_ENDIAN); local_offset += 8;
/* the following saves information about the conversation this packet defines,
@ -3108,7 +3114,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
/* get the previously saved context for this connection */
connection_context *connection;
guint64 hash_key;
hash_key = MadData.transactionID;
hash_key = MadData->transactionID;
hash_key = add_address_to_hash64(hash_key, &pinfo->dst);
connection = (connection_context *)g_hash_table_lookup(CM_context_table, &hash_key);
@ -3166,7 +3172,43 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
proto_tree_add_item(CM_header_tree, hf_cm_rep_privatedata, tvb, local_offset, 196, ENC_NA);
local_offset += 196;
*offset = local_offset;
}
/* Parse Communications Management
* IN: parentTree to add the dissection to
* IN: tvb - the data buffer from wireshark
* IN/OUT: The current and updated offset */
static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *tvb, gint *offset)
{
MAD_Data MadData;
gint local_offset;
const char *label;
proto_item *CM_header_item;
proto_tree *CM_header_tree;
if (!parse_MAD_Common(parentTree, tvb, offset, &MadData))
{
/* TODO: Mark Corrupt Packet - Not enough bytes exist for at least the Common MAD header which is present in all MAD packets */
return;
}
local_offset = *offset;
CM_header_item = proto_tree_add_item(parentTree, hf_infiniband_smp_data, tvb, local_offset, 140, ENC_NA);
label = val_to_str_const(MadData.attributeID, CM_Attributes, "(Unknown CM Attribute)");
proto_item_set_text(CM_header_item, "CM %s", label);
col_add_fstr(pinfo->cinfo, COL_INFO, "CM: %s", label);
CM_header_tree = proto_item_add_subtree(CM_header_item, ett_cm);
switch (MadData.attributeID) {
case ATTR_CM_REQ:
parse_CM_Req(parentTree, pinfo, tvb, &local_offset, &MadData, CM_header_tree);
break;
case ATTR_CM_REP:
parse_CM_Rsp(parentTree, pinfo, tvb, &local_offset, &MadData, CM_header_tree);
break;
case ATTR_CM_RTU:
proto_tree_add_item(CM_header_tree, hf_cm_rtu_localcommid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
@ -3178,9 +3220,9 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
proto_tree_add_item(CM_header_tree, hf_cm_rej_local_commid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_rej_remote_commid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_rej_msg_rej, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_rej_msg_reserved0, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rej_rej_info_len, tvb, local_offset, 1, ENC_BIG_ENDIAN);
local_offset += 1; /* skip reserved */
proto_tree_add_item(CM_header_tree, hf_cm_rej_msg_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
proto_tree_add_item(CM_header_tree, hf_cm_rej_reason, tvb, local_offset, 2, ENC_BIG_ENDIAN); local_offset += 2;
proto_tree_add_item(CM_header_tree, hf_cm_rej_add_rej_info, tvb, local_offset, 72, ENC_NA); local_offset += 72;
/* currently only REQ/REP call subdissectors for the private data */
@ -3189,8 +3231,8 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
case ATTR_CM_DREQ:
proto_tree_add_item(CM_header_tree, hf_cm_dreq_localcommid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_dreq_remotecommid, tvb, local_offset, 4, ENC_BIG_ENDIAN); local_offset += 4;
proto_tree_add_item(CM_header_tree, hf_cm_dreq_remote_qpn, tvb, local_offset, 3, ENC_BIG_ENDIAN);
local_offset += 4; /* skip qpn + reserved */
proto_tree_add_item(CM_header_tree, hf_cm_dreq_remote_qpn, tvb, local_offset, 3, ENC_BIG_ENDIAN); local_offset += 3;
proto_tree_add_item(CM_header_tree, hf_infiniband_reserved1, tvb, local_offset, 1, ENC_BIG_ENDIAN); local_offset += 1;
/* currently only REQ/REP call subdissectors for the private data */
proto_tree_add_item(CM_header_tree, hf_cm_dreq_privatedata, tvb, local_offset, 220, ENC_NA); local_offset += 220;
break;
@ -5487,6 +5529,16 @@ void proto_register_infiniband(void)
"Unknown/Vendor Specific Data", "infiniband.vendor",
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
},
/* Common Reserved fields */
{ &hf_infiniband_reserved1, {
"Reserved", "infiniband.reserved1",
FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
},
{ &hf_infiniband_reserved4, {
"Reserved", "infiniband.reserved4",
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
},
/* CM REQ Header */
{&hf_cm_req_local_comm_id, {
"Local Communication ID", "infiniband.cm.req",
@ -5584,6 +5636,10 @@ void proto_register_infiniband(void)
"SRQ", "infiniband.cm.req.srq",
FT_UINT8, BASE_HEX, NULL, 0x8, NULL, HFILL}
},
{&hf_cm_req_extended_transport, {
"Extended Transport", "infiniband.cm.req.ext_transport",
FT_UINT8, BASE_HEX, NULL, 0x7, NULL, HFILL}
},
{&hf_cm_req_primary_local_lid, {
"Primary Local Port LID", "infiniband.cm.req.prim_locallid",
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
@ -5602,11 +5658,15 @@ void proto_register_infiniband(void)
},
{&hf_cm_req_primary_flow_label, {
"Primary Flow Label", "infiniband.cm.req.prim_flowlabel",
FT_UINT24, BASE_HEX, NULL, 0xfffff0, NULL, HFILL}
FT_UINT32, BASE_HEX, NULL, 0xfffff000, NULL, HFILL}
},
{&hf_cm_req_primary_reserved0, {
"Reserved", "infiniband.cm.req.prim_reserved0",
FT_UINT32, BASE_HEX, NULL, 0x0fc0, NULL, HFILL}
},
{&hf_cm_req_primary_packet_rate, {
"Primary Packet Rate", "infiniband.cm.req.prim_pktrate",
FT_UINT8, BASE_HEX, NULL, 0x3f, NULL, HFILL}
FT_UINT32, BASE_HEX, NULL, 0x3f, NULL, HFILL}
},
{&hf_cm_req_primary_traffic_class, {
"Primary Traffic Class", "infiniband.cm.req.prim_tfcclass",
@ -5624,10 +5684,18 @@ void proto_register_infiniband(void)
"Primary Subnet Local", "infiniband.cm.req.prim_subnetlocal",
FT_UINT8, BASE_HEX, NULL, 0x8, NULL, HFILL}
},
{&hf_cm_req_primary_reserved1, {
"Reserved", "infiniband.cm.req.prim_reserved1",
FT_UINT8, BASE_HEX, NULL, 0x7, NULL, HFILL}
},
{&hf_cm_req_primary_local_ack_to, {
"Primary Local ACK Timeout", "infiniband.cm.req.prim_localacktout",
FT_UINT8, BASE_HEX, NULL, 0xf8, NULL, HFILL}
},
{&hf_cm_req_primary_reserved2, {
"Reserved", "infiniband.cm.req.prim_reserved2",
FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL}
},
{&hf_cm_req_alt_local_lid, {
"Alternate Local Port LID", "infiniband.cm.req.alt_locallid",
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
@ -5646,11 +5714,15 @@ void proto_register_infiniband(void)
},
{&hf_cm_req_flow_label, {
"Alternate Flow Label", "infiniband.cm.req.alt_flowlabel",
FT_UINT24, BASE_HEX, NULL, 0xfffff0, NULL, HFILL}
FT_UINT32, BASE_HEX, NULL, 0xfffff000, NULL, HFILL}
},
{&hf_cm_req_alt_reserved0, {
"Reserved", "infiniband.cm.req.alt_reserved0",
FT_UINT32, BASE_HEX, NULL, 0x0fc0, NULL, HFILL}
},
{&hf_cm_req_packet_rate, {
"Alternate Packet Rate", "infiniband.cm.req.alt_pktrate",
FT_UINT8, BASE_HEX, NULL, 0x3f, NULL, HFILL}
FT_UINT32, BASE_HEX, NULL, 0x3f, NULL, HFILL}
},
{&hf_cm_req_alt_traffic_class, {
"Alternate Traffic Class", "infiniband.cm.req.alt_tfcclass",
@ -5668,10 +5740,18 @@ void proto_register_infiniband(void)
"Alternate Subnet Local", "infiniband.cm.req.alt_subnetlocal",
FT_UINT8, BASE_HEX, NULL, 0x8, NULL, HFILL}
},
{&hf_cm_req_alt_reserved1, {
"Reserved", "infiniband.cm.req.alt_reserved1",
FT_UINT8, BASE_HEX, NULL, 0x7, NULL, HFILL}
},
{&hf_cm_req_local_ACK_timeout, {
"Alternate Local ACK Timeout", "infiniband.cm.req.alt_localacktout",
FT_UINT8, BASE_HEX, NULL, 0xf8, NULL, HFILL}
},
{&hf_cm_req_alt_reserved2, {
"Reserved", "infiniband.cm.req.alt_reserved1",
FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL}
},
{&hf_cm_req_private_data, {
"PrivateData", "infiniband.cm.req.private",
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
@ -5729,6 +5809,10 @@ void proto_register_infiniband(void)
"SRQ", "infiniband.cm.rep.srq",
FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL}
},
{&hf_cm_rep_reserved, {
"Reserved", "infiniband.cm.rep.reserved",
FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL}
},
{&hf_cm_rep_localcaguid, {
"Local CA GUID", "infiniband.cm.rep.localcaguid",
FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}
@ -5763,10 +5847,18 @@ void proto_register_infiniband(void)
"Message REJected", "infiniband.cm.rej.msgrej",
FT_UINT8, BASE_HEX, NULL, 0xc0, NULL, HFILL}
},
{&hf_cm_rej_msg_reserved0, {
"Reserved", "infiniband.cm.rej.reserved0",
FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL}
},
{&hf_cm_rej_rej_info_len, {
"Reject Info Length", "infiniband.cm.rej.rejinfolen",
FT_UINT8, BASE_HEX, NULL, 0xfe, NULL, HFILL}
},
{&hf_cm_rej_msg_reserved1, {
"Reserved", "infiniband.cm.rej.reserved1",
FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL}
},
{&hf_cm_rej_reason, {
"Reason", "infiniband.cm.rej.reason",
FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}
@ -5827,12 +5919,6 @@ void proto_register_infiniband(void)
"Class Version", "infiniband.mad.classversion",
FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
},
#if 0
{ &hf_infiniband_reserved1, {
"Reserved", "infiniband.mad.reserved1",
FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL}
},
#endif
{ &hf_infiniband_method, {
"Method", "infiniband.mad.method",
FT_UINT8, BASE_HEX, VALS(mad_method_str), 0x0, NULL, HFILL}