aboutsummaryrefslogtreecommitdiffstats
path: root/packet-mbtcp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-04-24 23:22:03 +0000
committerGuy Harris <guy@alum.mit.edu>2001-04-24 23:22:03 +0000
commit595241a676ea51b08d08f915a1165d9917bb56dd (patch)
tree431a2723da59af06bc0f632f340529b1daea25f7 /packet-mbtcp.c
parentd40b312548ca429a5fcfccdc271320268cbbca63 (diff)
downloadwireshark-595241a676ea51b08d08f915a1165d9917bb56dd.tar.gz
wireshark-595241a676ea51b08d08f915a1165d9917bb56dd.tar.bz2
wireshark-595241a676ea51b08d08f915a1165d9917bb56dd.zip
Clearing a column before adding text to it with "col_add_fstr()" is
unnecessary. Clearing it before fetching anything from the packet with a call that might throw an exception, however, is a Good Idea. The Modbus/TCP dissector is called from a dissector table, so it doesn't have to check if the protocol is enabled, or set "pinfo->current_proto" - that's done for it by the dissector-table code. svn path=/trunk/; revision=3378
Diffstat (limited to 'packet-mbtcp.c')
-rw-r--r--packet-mbtcp.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/packet-mbtcp.c b/packet-mbtcp.c
index 9315777d46..fc223236d7 100644
--- a/packet-mbtcp.c
+++ b/packet-mbtcp.c
@@ -10,7 +10,7 @@
*
* for information on Modbus/TCP.
*
- * $Id: packet-mbtcp.c,v 1.2 2001/04/24 19:31:33 guy Exp $
+ * $Id: packet-mbtcp.c,v 1.3 2001/04/24 23:22:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -229,16 +229,13 @@ dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* packets in one TCP packet */
guint8 exception_code = 0, exception_returned = 0;
-/* Check if protocol decoding is enabled else decode as data and return */
- CHECK_DISPLAY_AS_DATA(proto_mbtcp, tvb, pinfo, tree);
-
- /* load the display labels */
- pinfo->current_proto = "Modbus/TCP";
-
/* Make entries in Protocol column on summary display */
if (check_col(pinfo->fd, COL_PROTOCOL))
col_set_str(pinfo->fd, COL_PROTOCOL, "Modbus/TCP");
+ if (check_col(pinfo->fd, COL_INFO))
+ col_clear(pinfo->fd, COL_INFO);
+
/* Make entries in Info column on summary display (updated after building proto tree) */
tvb_memcpy(tvb, (guint8 *)&mh, offset, sizeof(mbtcp_hdr));
mh.transaction_id = ntohs(mh.transaction_id);
@@ -250,7 +247,7 @@ dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
func_string = function_string(mh.mdbs_hdr.function_code);
if (check_col(pinfo->fd, COL_INFO))
- { col_clear(pinfo->fd, COL_INFO);
+ {
packet_type = classify_packet(pinfo);
switch ( packet_type ) {
case query_packet : strcpy(pkt_type_str, "query");
@@ -331,7 +328,7 @@ dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Update entries in Info column on summary display */
if (check_col(pinfo->fd, COL_INFO))
- { col_clear(pinfo->fd, COL_INFO);
+ {
switch ( packet_type ) {
case query_packet : strcpy(pkt_type_str, "query");
break;