From Andreas Sikkema: keep TPKT information out of the Info column in
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 25 Mar 2002 20:17:09 +0000 (20:17 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 25 Mar 2002 20:17:09 +0000 (20:17 +0000)
cases where the subdissector would append information to that column.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5016 f5534014-38df-0310-8fa8-9805f1628bb7

packet-tpkt.c

index d6f261bbcae8341f7a09460997cc069d3006d6d3..faa956e0d238c330ac7e00ae0a483dcc748a8a0c 100644 (file)
@@ -7,7 +7,7 @@
  * Routine to dissect RFC 1006 TPKT packet containing OSI TP PDU
  * Copyright 2001, Martin Thomas <Martin_A_Thomas@yahoo.com>
  *
- * $Id: packet-tpkt.c,v 1.17 2002/03/05 22:15:21 guy Exp $
+ * $Id: packet-tpkt.c,v 1.18 2002/03/25 20:17:09 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -116,6 +116,19 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        tvbuff_t *next_tvb;
        const char *saved_proto;
 
+       /*
+        * If we're reassembling segmented TPKT PDUs, empty the COL_INFO
+        * column, so subdissectors can append information
+        * without having to worry about emptying the column.
+        *
+        * We use "col_add_str()" because the subdissector
+        * might be appending information to the column, in
+        * which case we'd have to zero the buffer out explicitly
+        * anyway.
+        */
+       if (tpkt_desegment && check_col(pinfo->cinfo, COL_INFO))
+               col_add_str(pinfo->cinfo, COL_INFO, "");
+  
        while (tvb_reported_length_remaining(tvb, offset) != 0) {
                length_remaining = tvb_length_remaining(tvb, offset);
 
@@ -176,7 +189,17 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
                if (check_col(pinfo->cinfo, COL_PROTOCOL))
                        col_set_str(pinfo->cinfo, COL_PROTOCOL, "TPKT");
-               if (check_col(pinfo->cinfo, COL_INFO)) {
+               /*
+                * Don't add the TPKT header information if we're
+                * reassembling segmented TPKT PDUs or if this
+                * PDU isn't reassembled.
+                *
+                * XXX - the first is so that subdissectors can append
+                * information without getting TPKT stuff in the middle;
+                * why the second?
+                */
+               if (!tpkt_desegment && !pinfo->fragmented
+                   && check_col(pinfo->cinfo, COL_INFO)) {
                        col_add_fstr(pinfo->cinfo, COL_INFO,
                            "TPKT Data length = %u", data_len);
                }