xDLC frames other than I and UI frames may have a payload, e.g. TEST
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 24 Jan 2000 02:05:39 +0000 (02:05 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 24 Jan 2000 02:05:39 +0000 (02:05 +0000)
frames; rename "XDLC_HAS_PAYLOAD()" to "XDLC_IS_INFORMATION()", and if
the frame isn't an "information" frame, dissect its payload (if any) as
data.

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

packet-lapd.c
packet-llc.c
xdlc.h

index 1618e0ddf6a7a9e97af3e54670eda2d3795b4eb1..d0de40bb7e1bdb4740c4d2a7dc2ed6ce9e2d3335 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for LAPD frame disassembly
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-lapd.c,v 1.3 1999/11/16 11:42:37 guy Exp $
+ * $Id: packet-lapd.c,v 1.4 2000/01/24 02:05:38 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -138,7 +138,7 @@ dissect_lapd(const u_char *pd, frame_data *fd, proto_tree *tree)
            ett_lapd_control, is_response, TRUE);
        lapd_header_len += XDLC_CONTROL_LEN(control, TRUE);
 
-       if (XDLC_HAS_PAYLOAD(control)) {
+       if (XDLC_IS_INFORMATION(control)) {
                /* call next protocol */
                switch (sapi) {
 
@@ -150,7 +150,8 @@ dissect_lapd(const u_char *pd, frame_data *fd, proto_tree *tree)
                        dissect_data(pd, lapd_header_len, fd, tree);
                        break;
                }
-       }
+       } else
+               dissect_data(pd, lapd_header_len, fd, tree);
 }
 
 void
index 9c214d94182099aeea888100e198c4a9e732dbdc..5e84483314f75d69af88c1e591693717e651a762 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for IEEE 802.2 LLC layer
  * Gilbert Ramirez <gramirez@tivoli.com>
  *
- * $Id: packet-llc.c,v 1.42 2000/01/24 01:45:12 guy Exp $
+ * $Id: packet-llc.c,v 1.43 2000/01/24 02:05:39 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -232,10 +232,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) {
 
        if (is_snap) {
                oui = pd[offset+3] << 16 | pd[offset+4] << 8 | pd[offset+5];
-               if (XDLC_HAS_PAYLOAD(control)) {
-                       /*
-                        * This frame has a payload to be analyzed.
-                        */
+               if (XDLC_IS_INFORMATION(control)) {
                        etype = pntohs(&pd[offset+6]);
                        switch (oui) {
 
@@ -262,10 +259,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) {
                }
        }               
        else {
-               if (XDLC_HAS_PAYLOAD(control)) {
-                       /*
-                        * This frame has a payload to be analyzed.
-                        */
+               if (XDLC_IS_INFORMATION(control)) {
                        capture = sap_capture_func(pd[offset]);
 
                        /* non-SNAP */
@@ -365,25 +359,11 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                           AppleTalk data packets - but used
                           OUI_ENCAP_ETHER and an Ethernet
                           packet type for AARP packets. */
-                       if (XDLC_HAS_PAYLOAD(control)) {
-                               /*
-                                * This frame has a payload to be analyzed.
-                                * XXX - I've seen a U frame (for a SNAP
-                                * protocol with OUI 00-80-5F, belonging
-                                * to Compaq, and a PID of 0002) with a
-                                * function of TEST and, apparently, with
-                                * a payload - the data in the frame
-                                * following the LLC header included the
-                                * Unicode string "NTFS", so, unless that's
-                                * crud left over from an earlier frame whose
-                                * buffer was reused for this frame, and the
-                                * length was mysteriously set to include the
-                                * leftover crud, TEST frames can have data,
-                                * just as UI frames can.
-                                */
+                       if (XDLC_IS_INFORMATION(control)) {
                                ethertype(etype, offset+8, pd,
                                    fd, tree, llc_tree, hf_llc_type);
-                       }
+                       } else
+                               dissect_data(pd, offset+8, fd, tree);
                        break;
 
                case OUI_CISCO:
@@ -396,10 +376,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                                proto_tree_add_item(llc_tree,
                                    hf_llc_pid, offset+6, 2, etype);
                        }
-                       if (XDLC_HAS_PAYLOAD(control)) {
-                               /*
-                                * This frame has a payload to be analyzed.
-                                */
+                       if (XDLC_IS_INFORMATION(control)) {
                                switch (etype) {
 
                                case 0x2000:
@@ -410,7 +387,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                                        dissect_data(pd, offset+8, fd, tree);
                                        break;
                                }
-                       }
+                       } else
+                               dissect_data(pd, offset+8, fd, tree);
                        break;
 
                default:
@@ -418,12 +396,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                                proto_tree_add_item(llc_tree,
                                    hf_llc_pid, offset+6, 2, etype);
                        }
-                       if (XDLC_HAS_PAYLOAD(control)) {
-                               /*
-                                * This frame has a payload to be analyzed.
-                                */
-                               dissect_data(pd, offset+8, fd, tree);
-                       }
+                       dissect_data(pd, offset+8, fd, tree);
                        break;
                }
        }               
@@ -440,10 +413,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                        );
                }
 
-               if (XDLC_HAS_PAYLOAD(control)) {
-                       /*
-                        * This frame has a payload to be analyzed.
-                        */
+               if (XDLC_IS_INFORMATION(control)) {
                        dissect = sap_dissect_func(pd[offset]);
 
                        /* non-SNAP */
@@ -455,7 +425,8 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
                        else {
                                dissect_data(pd, offset, fd, tree);
                        }
-               }
+               } else
+                       dissect_data(pd, offset, fd, tree);
        }
 }
 
diff --git a/xdlc.h b/xdlc.h
index 152ea677b23731d2a6662339bb897d946e79a8a8..930eb35b8d681f120e3806241bc82b48fe66154b 100644 (file)
--- a/xdlc.h
+++ b/xdlc.h
@@ -2,7 +2,7 @@
  * Define *DLC frame types, and routine to dissect the control field of
  * a *DLC frame.
  *
- * $Id: xdlc.h,v 1.11 2000/01/07 22:05:43 guy Exp $
+ * $Id: xdlc.h,v 1.12 2000/01/24 02:05:39 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 /*
  * This macro takes the control field of an xDLC frame, as returned by
  * "get_xdlc_control()" or "dissect_xdlc_control()", and evaluates to
- * TRUE if the frame has a payload (i.e., if it's an Information or
- * Unnumbered Information frame) and FALSE if it doesn't.
+ * TRUE if the frame is an "information" frame and FALSE if it isn't.
+ * Note that frames other than information frames can have data in them,
+ * e.g. TEST frames.
  */
-#define XDLC_HAS_PAYLOAD(control) \
+#define XDLC_IS_INFORMATION(control) \
        (((control) & 0x1) == XDLC_I || (control) == (XDLC_UI|XDLC_U))
 
 /*