forked from osmocom/wireshark
Don't let the existence of a protocol tree affect what's in the Info column.
A dissector must never assume that it will, or won't, be called with a protocol tree; it's up to the Wireshark/TShark/etc. core to decide whether to do it, and it can change its behavior over time or even change it from release to release. Have dissect_epath() take an argument that explicitly indicates whether to add the CIP class to the Info column, rather than assuming that you do so only if the tree pointer passed to it is null. Bug: 12257 Change-Id: Ide8a6fc21252880f849a8d0aa4659a675bb3ae04 Reviewed-on: https://code.wireshark.org/review/14456 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
8cb41a9337
commit
0246f2d8a0
|
@ -3279,7 +3279,7 @@ static int dissect_padded_epath_len(packet_info *pinfo, proto_tree *tree, proto_
|
|||
}
|
||||
|
||||
epath_tree = proto_tree_add_subtree(tree, tvb, offset + path_size_len, path_size * 2, ett_path, &path_item, "Path: ");
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset + path_size_len, path_size * 2, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset + path_size_len, path_size * 2, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
|
||||
return path_size * 2 + path_size_len;
|
||||
}
|
||||
|
@ -3305,7 +3305,7 @@ int dissect_packed_epath(packet_info *pinfo, proto_tree *tree, proto_item *item
|
|||
proto_item *path_item;
|
||||
|
||||
epath_tree = proto_tree_add_subtree(tree, tvb, offset, total_len, ett_path, &path_item, "Path: ");
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset, total_len, FALSE, TRUE, NULL, NULL, NO_DISPLAY, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset, total_len, FALSE, TRUE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
|
||||
return total_len;
|
||||
}
|
||||
|
@ -3317,7 +3317,7 @@ int dissect_padded_epath(packet_info *pinfo, proto_tree *tree, proto_item *item
|
|||
proto_item *path_item;
|
||||
|
||||
epath_tree = proto_tree_add_subtree(tree, tvb, offset, total_len, ett_path, &path_item, "Path: ");
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset, total_len, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, path_item, offset, total_len, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
|
||||
return total_len;
|
||||
}
|
||||
|
@ -4046,7 +4046,8 @@ static int dissect_segment_symbolic(tvbuff_t *tvb, proto_tree *path_seg_tree,
|
|||
|
||||
void dissect_epath(tvbuff_t *tvb, packet_info *pinfo, proto_tree *path_tree, proto_item *epath_item, int offset, int path_length,
|
||||
gboolean generate, gboolean packed, cip_simple_request_info_t* req_data, cip_safety_epath_info_t* safety,
|
||||
int display_type, proto_item *msp_item)
|
||||
int display_type, proto_item *msp_item,
|
||||
gboolean add_class_to_info)
|
||||
{
|
||||
int pathpos, temp_data, temp_data2, seg_size, i;
|
||||
unsigned char segment_type, opt_link_size;
|
||||
|
@ -4270,7 +4271,7 @@ void dissect_epath(tvbuff_t *tvb, packet_info *pinfo, proto_tree *path_tree, pro
|
|||
|
||||
if (req_data != NULL)
|
||||
{
|
||||
if (cip_enhanced_info_column == TRUE && msp_item == NULL)
|
||||
if (cip_enhanced_info_column == TRUE && add_class_to_info)
|
||||
{
|
||||
add_cip_class_to_info_column(pinfo, req_data->iClass, display_type);
|
||||
}
|
||||
|
@ -5884,7 +5885,7 @@ dissect_cip_cm_fwd_open_req(cip_req_info_t *preq_info, proto_tree *cmd_tree, tvb
|
|||
|
||||
/* Add the epath */
|
||||
epath_tree = proto_tree_add_subtree(cmd_tree, tvb, offset+26+net_param_offset+6, conn_path_size, ett_path, &pi, "Connection Path: ");
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+26+net_param_offset+6, conn_path_size, FALSE, FALSE, &connection_path, &safety_fwdopen, DISPLAY_CONNECTION_PATH, NULL);
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+26+net_param_offset+6, conn_path_size, FALSE, FALSE, &connection_path, &safety_fwdopen, DISPLAY_CONNECTION_PATH, NULL, TRUE);
|
||||
|
||||
if (pinfo->fd->flags.visited)
|
||||
{
|
||||
|
@ -6036,7 +6037,7 @@ static void display_previous_request_path(cip_req_info_t *preq_info, proto_tree
|
|||
preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t);
|
||||
}
|
||||
|
||||
dissect_epath(tvbIOI, pinfo, epath_tree, pi, 0, preq_info->IOILen * 2, TRUE, FALSE, preq_info->ciaData, NULL, DISPLAY_REQUEST_PATH, msp_item);
|
||||
dissect_epath(tvbIOI, pinfo, epath_tree, pi, 0, preq_info->IOILen * 2, TRUE, FALSE, preq_info->ciaData, NULL, DISPLAY_REQUEST_PATH, msp_item, FALSE);
|
||||
tvb_free(tvbIOI);
|
||||
}
|
||||
}
|
||||
|
@ -6407,7 +6408,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
|
|||
|
||||
/* Add the EPATH */
|
||||
epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+12, conn_path_size, ett_path, &pi, "Connection Path: ");
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset + 2 + req_path_size + 12, conn_path_size, FALSE, FALSE, &conn_path, NULL, DISPLAY_CONNECTION_PATH, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset + 2 + req_path_size + 12, conn_path_size, FALSE, FALSE, &conn_path, NULL, DISPLAY_CONNECTION_PATH, NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
case SC_CM_UNCON_SEND:
|
||||
|
@ -6464,7 +6465,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
|
|||
|
||||
/* Route Path */
|
||||
epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+6+msg_req_siz, route_path_size, ett_path, &temp_item, "Route Path: ");
|
||||
dissect_epath( tvb, pinfo, epath_tree, temp_item, offset+2+req_path_size+6+msg_req_siz, route_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL );
|
||||
dissect_epath(tvb, pinfo, epath_tree, temp_item, offset+2+req_path_size+6+msg_req_siz, route_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
}
|
||||
break;
|
||||
case SC_CM_GET_CONN_OWNER:
|
||||
|
@ -6479,7 +6480,7 @@ dissect_cip_cm_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_
|
|||
|
||||
/* Add the epath */
|
||||
epath_tree = proto_tree_add_subtree(cmd_data_tree, tvb, offset+2+req_path_size+2, conn_path_size, ett_path, &pi, "Connection Path: ");
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+2+req_path_size+2, conn_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL );
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset+2+req_path_size+2, conn_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
break;
|
||||
default:
|
||||
/* Add data */
|
||||
|
@ -6779,7 +6780,7 @@ dissect_cip_cco_all_attribute_common( proto_tree *cmd_tree, tvbuff_t *tvb, int o
|
|||
|
||||
/* Add the epath */
|
||||
epath_tree = proto_tree_add_subtree(cmd_tree, tvb, offset+30, conn_path_size, ett_path, &pi, "Connection Path: ");
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+30, conn_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL );
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset+30, conn_path_size, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
|
||||
variable_data_size += (conn_path_size+30);
|
||||
|
||||
|
@ -7239,12 +7240,12 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
|
|||
if (preq_info)
|
||||
{
|
||||
preq_info->ciaData = wmem_new(wmem_file_scope(), cip_simple_request_info_t);
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, preq_info->ciaData, NULL, DISPLAY_REQUEST_PATH, msp_item);
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, preq_info->ciaData, NULL, DISPLAY_REQUEST_PATH, msp_item, FALSE);
|
||||
memcpy(&path_info, preq_info->ciaData, sizeof(cip_simple_request_info_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
dissect_epath( tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, &path_info, NULL, DISPLAY_REQUEST_PATH, msp_item);
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset+2, req_path_size*2, FALSE, FALSE, &path_info, NULL, DISPLAY_REQUEST_PATH, msp_item, FALSE);
|
||||
}
|
||||
|
||||
ioilen = tvb_get_guint8( tvb, offset + 1 );
|
||||
|
|
|
@ -335,7 +335,8 @@ typedef struct cip_req_info {
|
|||
#define DISPLAY_REQUEST_PATH 2
|
||||
extern void dissect_epath( tvbuff_t *tvb, packet_info *pinfo, proto_tree *path_tree, proto_item *epath_item, int offset, int path_length,
|
||||
gboolean generate, gboolean packed, cip_simple_request_info_t* req_data, cip_safety_epath_info_t* safety,
|
||||
int display_type, proto_item *msp_item);
|
||||
int display_type, proto_item *msp_item,
|
||||
gboolean add_class_to_info);
|
||||
extern void dissect_cip_date_and_time(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_datetime);
|
||||
extern attribute_info_t* cip_get_attribute(guint class_id, guint instance, guint attribute);
|
||||
|
||||
|
|
|
@ -945,7 +945,7 @@ static int dissect_s_supervisor_output_connection_point_owners(packet_info *pinf
|
|||
|
||||
epath_tree = proto_tree_add_subtree(entry_tree,
|
||||
tvb, offset+attr_len, app_path_size, ett_path, &app_path_item, "Application Resource: ");
|
||||
dissect_epath( tvb, pinfo, epath_tree, app_path_item, offset+attr_len, app_path_size, FALSE, TRUE, NULL, NULL, NO_DISPLAY, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, app_path_item, offset+attr_len, app_path_size, FALSE, TRUE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
attr_len += app_path_size;
|
||||
}
|
||||
}
|
||||
|
@ -1097,7 +1097,7 @@ static int dissect_s_validator_app_data_path(packet_info *pinfo, proto_tree *tre
|
|||
{
|
||||
proto_item* pi;
|
||||
proto_tree* epath_tree = proto_tree_add_subtree(tree, NULL, 0, 0, ett_path, &pi, "Application Data Path: ");
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset, total_len, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL);
|
||||
dissect_epath(tvb, pinfo, epath_tree, pi, offset, total_len, FALSE, FALSE, NULL, NULL, NO_DISPLAY, NULL, TRUE);
|
||||
return total_len;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue