summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-03-13 19:35:20 -0700
committerGuy Harris <guy@alum.mit.edu>2016-03-14 02:35:47 +0000
commit0246f2d8a0d1d4e7a7c35fc5b768af31b4041da1 (patch)
tree1c76c72fe34b2e3597a42762c2c86c15d4db513b
parent8cb41a93375145378b394ce82406cd57e9db8c71 (diff)
downloadwireshark-0246f2d8a0d1d4e7a7c35fc5b768af31b4041da1.tar.gz
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>
-rw-r--r--epan/dissectors/packet-cip.c27
-rw-r--r--epan/dissectors/packet-cip.h3
-rw-r--r--epan/dissectors/packet-cipsafety.c4
3 files changed, 18 insertions, 16 deletions
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c
index 102f3894d5..656c615f09 100644
--- a/epan/dissectors/packet-cip.c
+++ b/epan/dissectors/packet-cip.c
@@ -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 );
diff --git a/epan/dissectors/packet-cip.h b/epan/dissectors/packet-cip.h
index 115642a858..7b1b7be3e7 100644
--- a/epan/dissectors/packet-cip.h
+++ b/epan/dissectors/packet-cip.h
@@ -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);
diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c
index 11e67a4c3e..44a2466d4a 100644
--- a/epan/dissectors/packet-cipsafety.c
+++ b/epan/dissectors/packet-cipsafety.c
@@ -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;
}