Set the COL_PROTOCOL column to "ISIS" in the ISIS dissector, rather than
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 13 Apr 2000 08:14:35 +0000 (08:14 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 13 Apr 2000 08:14:35 +0000 (08:14 +0000)
in its caller.

Set the COL_PROTOCOL column to "COTP" in the COTP dissector, rather than
in the dissectors it calls, so that it's done for all frames we hand to
that dissector.

Set the COL_INFO field for COTP packets we don't dissect because the
length indicator is zero, or the frame is too short, or the PDU type is
bogus.

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

packet-isis.c
packet-osi.c

index f09e2757eaf641d8e42b0794622f50d8386ecaf2..ead27120e94f6fba698b920464aaa73767494089 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for ISO/OSI network and transport protocol packet disassembly, core
  * bits.
  *
- * $Id: packet-isis.c,v 1.5 2000/03/20 22:52:43 gram Exp $
+ * $Id: packet-isis.c,v 1.6 2000/04/13 08:14:35 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
@@ -178,6 +178,9 @@ dissect_isis(const u_char *pd, int offset, frame_data *fd,
        proto_item *ti;
        proto_tree *isis_tree = NULL;
 
+       if (check_col(fd, COL_PROTOCOL))
+               col_add_str(fd, COL_PROTOCOL, "ISIS");
+
        if (!BYTES_ARE_IN_FRAME(offset, sizeof(*ihdr))) {
                isis_dissect_unknown(offset, sizeof(*ihdr), tree, fd,
                        "not enough capture data for header (%d vs %d)",
index 78f1864814cfe206c1775e5e69b31b0fdb9eb170..ed0b5fbb99378fcd5660be7c04149c99423e7418 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-osi.c
  * Routines for ISO/OSI network and transport protocol packet disassembly
  *
- * $Id: packet-osi.c,v 1.25 2000/04/13 07:52:55 guy Exp $
+ * $Id: packet-osi.c,v 1.26 2000/04/13 08:14:33 guy Exp $
  * Laurent Deniel <deniel@worldnet.fr>
  *
  * Ethereal - Network traffic analyzer
@@ -269,8 +269,6 @@ static int osi_decode_DR(const u_char *pd, int offset,
       break;
   }
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "DR TPDU src-ref: 0x%04x dst-ref: 0x%04x",
                 src_ref, dst_ref);
@@ -360,8 +358,6 @@ static int osi_decode_DT(const u_char *pd, int offset,
       break;
   }
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "DT TPDU (%d) dst-ref: 0x%04x %s", 
                 tpdu_nr,
@@ -502,8 +498,6 @@ static int osi_decode_ED(const u_char *pd, int offset,
       break;
   } /* li */
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "ED TPDU (%d) dst-ref: 0x%04x", 
                 tpdu_nr, dst_ref);
@@ -585,8 +579,6 @@ static int osi_decode_RJ(const u_char *pd, int offset,
       break;
   }
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "RJ TPDU (%d) dst-ref: 0x%04x", 
                 tpdu_nr, dst_ref);
@@ -685,8 +677,6 @@ static int osi_decode_CC(const u_char *pd, int offset,
   if (class_option > 4)
     return -1;
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "%s TPDU src-ref: 0x%04x dst-ref: 0x%04x",
                 (tpdu == CR_TPDU) ? "CR" : "CC",
@@ -972,8 +962,6 @@ static int osi_decode_DC(const u_char *pd, int offset,
       break;
   } /* li */
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "DC TPDU src-ref: 0x%04x dst-ref: 0x%04x", 
                 src_ref,
@@ -1026,8 +1014,6 @@ static int osi_decode_AK(const u_char *pd, int offset,
   if (!is_LI_NORMAL_AK(li)) {
     tpdu_nr = pd[offset + P_TPDU_NR_234];
 
-    if (check_col(fd, COL_PROTOCOL))
-      col_add_str(fd, COL_PROTOCOL, "COTP");
     if (check_col(fd, COL_INFO))
       col_add_fstr(fd, COL_INFO, "AK TPDU (%d) dst-ref: 0x%04x", 
                   tpdu_nr, dst_ref);
@@ -1132,8 +1118,6 @@ static int osi_decode_AK(const u_char *pd, int offset,
     tpdu_nr   = EXTRACT_LONG(&pd[offset + P_TPDU_NR_234]);
     cdt_in_ak = EXTRACT_SHORT(&pd[offset + P_CDT_IN_AK]);
 
-    if (check_col(fd, COL_PROTOCOL))
-      col_add_str(fd, COL_PROTOCOL, "COTP");
     if (check_col(fd, COL_INFO))
       col_add_fstr(fd, COL_INFO, "AK TPDU (%d) dst-ref: 0x%04x", 
                   tpdu_nr, dst_ref);
@@ -1285,8 +1269,6 @@ static int osi_decode_EA(const u_char *pd, int offset,
       break;
   } /* li */
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, 
                 "EA TPDU (%d) dst-ref: 0x%04x", tpdu_nr, dst_ref);
@@ -1371,8 +1353,6 @@ static int osi_decode_ER(const u_char *pd, int offset,
       break;
   }
 
-  if (check_col(fd, COL_PROTOCOL))
-    col_add_str(fd, COL_PROTOCOL, "COTP");
   if (check_col(fd, COL_INFO))
     col_add_fstr(fd, COL_INFO, "ER TPDU dst-ref: 0x%04x", dst_ref);
 
@@ -1401,8 +1381,18 @@ static void dissect_cotp_internal(const u_char *pd, int offset, frame_data *fd,
 {
   int status = -1;
 
-  if (((li = pd[offset + P_LI]) == 0) ||
-      (!BYTES_ARE_IN_FRAME(offset, P_LI + li + 1))) {
+  if (check_col(fd, COL_PROTOCOL))
+    col_add_str(fd, COL_PROTOCOL, "COTP");
+
+  if ((li = pd[offset + P_LI]) == 0) {
+    if (check_col(fd, COL_INFO))
+      col_add_str(fd, COL_INFO, "Length indicator is zero");
+    dissect_data(pd, offset, fd, tree);
+    return;
+  }
+ if (!BYTES_ARE_IN_FRAME(offset, P_LI + li + 1)) {
+    if (check_col(fd, COL_INFO))
+      col_add_str(fd, COL_INFO, "Captured data in frame doesn't include entire frame");
     dissect_data(pd, offset, fd, tree);
     return;
   }
@@ -1441,6 +1431,8 @@ static void dissect_cotp_internal(const u_char *pd, int offset, frame_data *fd,
       status = osi_decode_ER(pd, offset, fd, tree);
       break;
     default      :
+      if (check_col(fd, COL_INFO))
+        col_add_fstr(fd, COL_INFO, "Unknown TPDU type (0x%x)", tpdu);
       break;
   }
 
@@ -1749,9 +1741,6 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd,
       dissect_data(pd, offset, fd, tree);
       break;
     case NLPID_ISO10589_ISIS:
-      if (check_col(fd, COL_PROTOCOL)) {
-       col_add_str(fd, COL_PROTOCOL, "ISIS");
-      }
       dissect_isis(pd, offset, fd, tree);
       break;
     default: