aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packet-lapd.c7
-rw-r--r--packet-llc.c55
-rw-r--r--xdlc.h9
3 files changed, 22 insertions, 49 deletions
diff --git a/packet-lapd.c b/packet-lapd.c
index 1618e0ddf6..d0de40bb7e 100644
--- a/packet-lapd.c
+++ b/packet-lapd.c
@@ -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
diff --git a/packet-llc.c b/packet-llc.c
index 9c214d9418..5e84483314 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -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 152ea677b2..930eb35b8d 100644
--- 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>
@@ -60,10 +60,11 @@
/*
* 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))
/*