1998-09-16 02:39:15 +00:00
|
|
|
/* packet-llc.c
|
|
|
|
* Routines for IEEE 802.2 LLC layer
|
2000-04-12 20:24:43 +00:00
|
|
|
* Gilbert Ramirez <gram@xiexie.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2001-01-05 19:07:38 +00:00
|
|
|
* $Id: packet-llc.c,v 1.77 2001/01/05 19:07:37 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
2000-01-07 22:05:43 +00:00
|
|
|
* By Gerald Combs <gerald@zing.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
1998-10-10 03:32:20 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
1998-09-27 22:12:47 +00:00
|
|
|
#include "packet.h"
|
1999-12-29 05:20:00 +00:00
|
|
|
#include "oui.h"
|
1999-08-04 04:37:46 +00:00
|
|
|
#include "xdlc.h"
|
2000-01-22 21:49:50 +00:00
|
|
|
#include "etypes.h"
|
2000-04-17 00:32:43 +00:00
|
|
|
#include "llcsaps.h"
|
2000-02-15 21:06:58 +00:00
|
|
|
#include "packet-ip.h"
|
|
|
|
#include "packet-ipx.h"
|
|
|
|
#include "packet-netbios.h"
|
|
|
|
#include "packet-osi.h"
|
|
|
|
#include "packet-sna.h"
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_llc = -1;
|
|
|
|
static int hf_llc_dsap = -1;
|
|
|
|
static int hf_llc_ssap = -1;
|
1999-12-13 21:48:18 +00:00
|
|
|
static int hf_llc_dsap_ig = -1;
|
|
|
|
static int hf_llc_ssap_cr = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
static int hf_llc_ctrl = -1;
|
|
|
|
static int hf_llc_type = -1;
|
|
|
|
static int hf_llc_oui = -1;
|
1999-12-05 09:45:32 +00:00
|
|
|
static int hf_llc_pid = -1;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_llc = -1;
|
|
|
|
static gint ett_llc_ctrl = -1;
|
|
|
|
|
2000-04-17 00:32:43 +00:00
|
|
|
static dissector_table_t subdissector_table;
|
Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.
Add a new subdissector table in the LLC dissector for protocol IDs with
a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that
table, rather than calling them via a switch statement.
Register the ISL dissector by name, and have the Ethernet dissector call
it via a handle.
Fix the handling of the checksum field in the CDP dissector.
The strings in CDP are counted, not null-terminated; treat them as such.
Fix the handling of the encapsulated frame CRC, and the encapsulated
frame, in the ISL dissector, at least for Ethernet frames; it may not be
correct for encapsulated Token Ring frames.
svn path=/trunk/; revision=2792
2000-12-28 09:49:09 +00:00
|
|
|
static dissector_table_t cisco_subdissector_table;
|
2000-04-17 00:32:43 +00:00
|
|
|
|
2000-11-16 07:35:43 +00:00
|
|
|
static dissector_handle_t bpdu_handle;
|
|
|
|
|
2000-01-23 08:55:37 +00:00
|
|
|
typedef void (capture_func_t)(const u_char *, int, packet_counts *);
|
1999-03-22 03:44:44 +00:00
|
|
|
|
2000-04-17 00:32:43 +00:00
|
|
|
/* The SAP info is split into two tables, one value_string table and one
|
|
|
|
* table of sap_info. This is so that the value_string can be used in the
|
|
|
|
* header field registration.
|
1999-07-07 22:52:57 +00:00
|
|
|
*/
|
1998-09-16 02:39:15 +00:00
|
|
|
struct sap_info {
|
1998-09-23 05:25:12 +00:00
|
|
|
guint8 sap;
|
1999-03-22 03:44:44 +00:00
|
|
|
capture_func_t *capture_func;
|
1998-09-16 02:39:15 +00:00
|
|
|
};
|
|
|
|
|
1999-12-13 23:39:59 +00:00
|
|
|
/*
|
|
|
|
* Group/Individual bit, in the DSAP.
|
|
|
|
*/
|
|
|
|
#define DSAP_GI_BIT 0x01
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Command/Response bit, in the SSAP.
|
|
|
|
*
|
|
|
|
* The low-order bit of the SSAP apparently determines whether this
|
|
|
|
* is a request or a response. (RFC 1390, "Transmission of IP and
|
|
|
|
* ARP over FDDI Networks", says
|
|
|
|
*
|
|
|
|
* Command frames are identified by having the low order
|
|
|
|
* bit of the SSAP address reset to zero. Response frames
|
|
|
|
* have the low order bit of the SSAP address set to one.
|
|
|
|
*
|
|
|
|
* and a page I've seen seems to imply that's part of 802.2.)
|
|
|
|
*/
|
|
|
|
#define SSAP_CR_BIT 0x01
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mask to extrace the SAP number from the DSAP or the SSAP.
|
|
|
|
*/
|
|
|
|
#define SAP_MASK 0xFE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These are for SSAP and DSAP, wth last bit always zero.
|
1999-12-14 07:22:56 +00:00
|
|
|
* XXX - some DSAPs come in separate "individual" and "group" versions,
|
|
|
|
* with the last bit 0 and 1, respectively (e.g., LLC Sub-layer Management,
|
2000-01-24 02:44:52 +00:00
|
|
|
* IBM SNA Path Control, IBM Net Management), but, whilst 0xFE is
|
1999-12-14 07:22:56 +00:00
|
|
|
* the ISO Network Layer Protocol, 0xFF is the Global LSAP.
|
1999-12-13 23:39:59 +00:00
|
|
|
*/
|
1999-07-07 22:52:57 +00:00
|
|
|
static const value_string sap_vals[] = {
|
2000-04-17 00:32:43 +00:00
|
|
|
{ SAP_NULL, "NULL LSAP" },
|
|
|
|
{ SAP_LLC_SLMGMT, "LLC Sub-Layer Management" },
|
|
|
|
{ SAP_SNA_PATHCTRL, "SNA Path Control" },
|
|
|
|
{ SAP_IP, "TCP/IP" },
|
|
|
|
{ SAP_SNA1, "SNA" },
|
|
|
|
{ SAP_SNA2, "SNA" },
|
|
|
|
{ SAP_PROWAY_NM_INIT, "PROWAY (IEC955) Network Management and Initialization" },
|
|
|
|
{ SAP_TI, "Texas Instruments" },
|
|
|
|
{ SAP_BPDU, "Spanning Tree BPDU" },
|
|
|
|
{ SAP_RS511, "EIA RS-511 Manufacturing Message Service" },
|
2001-01-05 19:07:38 +00:00
|
|
|
{ SAP_X25, "ISO 8208 (X.25 over 802.2)" },
|
|
|
|
/*
|
|
|
|
* XXX - setting the group bit of SAP_X25 make 0x7F; is this just
|
|
|
|
* a group version of that?
|
|
|
|
*/
|
2000-04-17 00:32:43 +00:00
|
|
|
{ 0x7F, "ISO 802.2" },
|
|
|
|
{ SAP_XNS, "XNS" },
|
|
|
|
{ SAP_NESTAR, "Nestar" },
|
|
|
|
{ SAP_PROWAY_ASLM, "PROWAY (IEC955) Active Station List Maintenance" },
|
|
|
|
{ SAP_ARP, "ARP" }, /* XXX - hand to "dissect_arp()"? */
|
|
|
|
{ SAP_SNAP, "SNAP" },
|
|
|
|
{ SAP_VINES1, "Banyan Vines" },
|
|
|
|
{ SAP_VINES2, "Banyan Vines" },
|
|
|
|
{ SAP_NETWARE, "NetWare" },
|
|
|
|
{ SAP_NETBIOS, "NetBIOS" },
|
|
|
|
{ SAP_IBMNM, "IBM Net Management" },
|
|
|
|
{ SAP_RPL1, "Remote Program Load" },
|
|
|
|
{ SAP_UB, "Ungermann-Bass" },
|
|
|
|
{ SAP_RPL2, "Remote Program Load" },
|
|
|
|
{ SAP_OSINL, "ISO Network Layer" },
|
|
|
|
{ SAP_GLOBAL, "Global LSAP" },
|
|
|
|
{ 0x00, NULL }
|
1998-09-17 18:43:11 +00:00
|
|
|
};
|
|
|
|
|
1999-07-07 22:52:57 +00:00
|
|
|
static struct sap_info saps[] = {
|
2000-04-17 00:32:43 +00:00
|
|
|
{ SAP_IP, capture_ip },
|
|
|
|
{ SAP_NETWARE, capture_ipx },
|
|
|
|
{ SAP_NETBIOS, capture_netbios },
|
|
|
|
{ 0x00, NULL}
|
1999-07-07 22:52:57 +00:00
|
|
|
};
|
1998-09-17 18:43:11 +00:00
|
|
|
|
2000-02-05 09:34:33 +00:00
|
|
|
/*
|
|
|
|
* See
|
|
|
|
*
|
|
|
|
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/vlan.htm
|
|
|
|
*
|
|
|
|
* for the PIDs for VTP and DRiP that go with an OUI of OUI_CISCO.
|
|
|
|
*/
|
1999-12-29 05:20:00 +00:00
|
|
|
const value_string oui_vals[] = {
|
1999-12-05 09:45:32 +00:00
|
|
|
{ OUI_ENCAP_ETHER, "Encapsulated Ethernet" },
|
1999-07-07 22:52:57 +00:00
|
|
|
/*
|
|
|
|
http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r/brprt1/brsrb.htm
|
|
|
|
*/
|
2000-01-12 19:37:24 +00:00
|
|
|
{ OUI_CISCO, "Cisco" },
|
2000-01-22 21:49:50 +00:00
|
|
|
{ OUI_CISCO_90, "Cisco IOS 9.0 Compatible" },
|
|
|
|
{ OUI_BFR, "Bridged Frame-Relay" }, /* RFC 2427 */
|
1999-12-29 05:20:00 +00:00
|
|
|
{ OUI_ATM_FORUM, "ATM Forum" },
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
{ OUI_APPLE_ATALK, "Apple (AppleTalk)" },
|
2000-04-10 14:45:30 +00:00
|
|
|
{ OUI_CABLE_BPDU, "DOCSIS Spanning Tree" }, /* DOCSIS spanning tree BPDU */
|
1999-12-05 09:45:32 +00:00
|
|
|
{ 0, NULL }
|
1999-07-07 22:52:57 +00:00
|
|
|
};
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-03-22 03:44:44 +00:00
|
|
|
static capture_func_t *
|
1999-02-09 00:35:38 +00:00
|
|
|
sap_capture_func(u_char sap) {
|
1998-09-17 18:43:11 +00:00
|
|
|
int i=0;
|
|
|
|
|
1999-07-07 22:52:57 +00:00
|
|
|
/* look for the second record where sap == 0, which should
|
|
|
|
* be the last record
|
|
|
|
*/
|
|
|
|
while (saps[i].sap > 0 || i == 0) {
|
1998-09-17 18:43:11 +00:00
|
|
|
if (saps[i].sap == sap) {
|
1999-02-09 00:35:38 +00:00
|
|
|
return saps[i].capture_func;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
1999-03-22 03:56:34 +00:00
|
|
|
return NULL;
|
1999-02-09 00:35:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-01-23 08:55:37 +00:00
|
|
|
capture_llc(const u_char *pd, int offset, packet_counts *ld) {
|
1999-02-09 00:35:38 +00:00
|
|
|
|
|
|
|
int is_snap;
|
1999-09-26 20:31:51 +00:00
|
|
|
guint16 control;
|
1999-11-11 08:04:06 +00:00
|
|
|
int llc_header_len;
|
1999-12-05 09:45:32 +00:00
|
|
|
guint32 oui;
|
1999-08-23 22:47:13 +00:00
|
|
|
guint16 etype;
|
1999-03-22 03:44:44 +00:00
|
|
|
capture_func_t *capture;
|
1999-02-09 00:35:38 +00:00
|
|
|
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, 2)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
2000-01-24 02:44:52 +00:00
|
|
|
is_snap = (pd[offset] == SAP_SNAP) && (pd[offset+1] == SAP_SNAP);
|
1999-11-11 08:04:06 +00:00
|
|
|
llc_header_len = 2; /* DSAP + SSAP */
|
1999-02-09 00:35:38 +00:00
|
|
|
|
1999-08-23 22:47:13 +00:00
|
|
|
/*
|
1999-12-13 23:39:59 +00:00
|
|
|
* XXX - the page referred to in the comment above about the
|
|
|
|
* Command/Response bit also implies that LLC Type 2 always
|
|
|
|
* uses extended operation, so we don't need to determine
|
|
|
|
* whether it's basic or extended operation; is that the case?
|
1999-08-23 22:47:13 +00:00
|
|
|
*/
|
1999-12-13 23:39:59 +00:00
|
|
|
control = get_xdlc_control(pd, offset+2, pd[offset+1] & SSAP_CR_BIT,
|
|
|
|
TRUE);
|
1999-11-11 08:04:06 +00:00
|
|
|
llc_header_len += XDLC_CONTROL_LEN(control, TRUE);
|
1999-09-26 20:40:00 +00:00
|
|
|
if (is_snap)
|
1999-12-05 09:45:32 +00:00
|
|
|
llc_header_len += 5; /* 3 bytes of OUI, 2 bytes of protocol ID */
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, llc_header_len)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
1999-02-09 00:35:38 +00:00
|
|
|
|
1999-08-23 22:47:13 +00:00
|
|
|
if (is_snap) {
|
1999-12-05 09:45:32 +00:00
|
|
|
oui = pd[offset+3] << 16 | pd[offset+4] << 8 | pd[offset+5];
|
2000-01-24 02:05:39 +00:00
|
|
|
if (XDLC_IS_INFORMATION(control)) {
|
1999-12-05 09:45:32 +00:00
|
|
|
etype = pntohs(&pd[offset+6]);
|
|
|
|
switch (oui) {
|
|
|
|
|
|
|
|
case OUI_ENCAP_ETHER:
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
case OUI_APPLE_ATALK:
|
|
|
|
/* No, I have no idea why Apple used
|
|
|
|
one of their own OUIs, rather than
|
|
|
|
OUI_ENCAP_ETHER, and an Ethernet
|
|
|
|
packet type as protocol ID, for
|
|
|
|
AppleTalk data packets - but used
|
|
|
|
OUI_ENCAP_ETHER and an Ethernet
|
|
|
|
packet type for AARP packets. */
|
1999-12-05 09:45:32 +00:00
|
|
|
capture_ethertype(etype, offset+8, pd,
|
2000-01-23 08:55:37 +00:00
|
|
|
ld);
|
1999-12-05 09:45:32 +00:00
|
|
|
break;
|
2000-01-22 21:49:50 +00:00
|
|
|
case OUI_CISCO:
|
|
|
|
capture_ethertype(etype,
|
2000-01-23 08:55:37 +00:00
|
|
|
offset + 8, pd, ld);
|
2000-01-22 21:49:50 +00:00
|
|
|
break;
|
1999-12-05 09:45:32 +00:00
|
|
|
default:
|
|
|
|
ld->other++;
|
|
|
|
break;
|
|
|
|
}
|
1999-02-09 00:35:38 +00:00
|
|
|
}
|
1999-08-23 22:47:13 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-01-24 02:05:39 +00:00
|
|
|
if (XDLC_IS_INFORMATION(control)) {
|
1999-08-23 22:47:13 +00:00
|
|
|
capture = sap_capture_func(pd[offset]);
|
|
|
|
|
|
|
|
/* non-SNAP */
|
1999-11-11 08:04:06 +00:00
|
|
|
offset += llc_header_len;
|
1999-08-23 22:47:13 +00:00
|
|
|
|
|
|
|
if (capture) {
|
2000-01-23 08:55:37 +00:00
|
|
|
capture(pd, offset, ld);
|
1999-08-23 22:47:13 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ld->other++;
|
|
|
|
}
|
1999-02-09 00:35:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-03 10:34:42 +00:00
|
|
|
static void
|
2000-05-11 22:04:18 +00:00
|
|
|
dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *llc_tree = NULL;
|
1999-09-26 20:31:51 +00:00
|
|
|
proto_item *ti = NULL;
|
1998-09-17 18:43:11 +00:00
|
|
|
int is_snap;
|
1999-09-26 20:31:51 +00:00
|
|
|
guint16 control;
|
1999-11-11 08:04:06 +00:00
|
|
|
int llc_header_len;
|
1999-12-05 09:45:32 +00:00
|
|
|
guint32 oui;
|
1999-08-23 22:47:13 +00:00
|
|
|
guint16 etype;
|
2000-05-11 22:04:18 +00:00
|
|
|
guint8 dsap, ssap;
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
const guint8 *pd;
|
|
|
|
int offset;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
CHECK_DISPLAY_AS_DATA(proto_llc, tvb, pinfo, tree);
|
|
|
|
|
2000-05-11 22:04:18 +00:00
|
|
|
pinfo->current_proto = "LLC";
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-05-11 22:04:18 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL)) {
|
2000-11-19 08:54:37 +00:00
|
|
|
col_set_str(pinfo->fd, COL_PROTOCOL, "LLC");
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
2001-01-05 08:43:30 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
|
|
|
col_clear(pinfo->fd, COL_INFO);
|
|
|
|
}
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
|
2000-05-11 22:04:18 +00:00
|
|
|
dsap = tvb_get_guint8(tvb, 0);
|
1998-09-16 02:39:15 +00:00
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_llc, tvb, 0, 0, FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
llc_tree = proto_item_add_subtree(ti, ett_llc);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree, hf_llc_dsap, tvb, 0,
|
2000-05-11 22:04:18 +00:00
|
|
|
1, dsap & SAP_MASK);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_boolean(llc_tree, hf_llc_dsap_ig, tvb, 0,
|
2000-05-11 22:04:18 +00:00
|
|
|
1, dsap & DSAP_GI_BIT);
|
2000-05-28 22:02:17 +00:00
|
|
|
} else
|
|
|
|
llc_tree = NULL;
|
|
|
|
|
|
|
|
ssap = tvb_get_guint8(tvb, 1);
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree, hf_llc_ssap, tvb, 1,
|
2000-05-11 22:04:18 +00:00
|
|
|
1, ssap & SAP_MASK);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_boolean(llc_tree, hf_llc_ssap_cr, tvb, 1,
|
2000-05-11 22:04:18 +00:00
|
|
|
1, ssap & SSAP_CR_BIT);
|
1999-08-04 04:37:46 +00:00
|
|
|
} else
|
|
|
|
llc_tree = NULL;
|
|
|
|
|
2000-05-28 22:02:17 +00:00
|
|
|
is_snap = (dsap == SAP_SNAP) && (ssap == SAP_SNAP);
|
|
|
|
llc_header_len = 2; /* DSAP + SSAP */
|
|
|
|
|
1999-08-04 04:37:46 +00:00
|
|
|
/*
|
1999-12-13 23:39:59 +00:00
|
|
|
* XXX - the page referred to in the comment above about the
|
|
|
|
* Command/Response bit also implies that LLC Type 2 always
|
|
|
|
* uses extended operation, so we don't need to determine
|
|
|
|
* whether it's basic or extended operation; is that the case?
|
1999-08-04 04:37:46 +00:00
|
|
|
*/
|
2000-05-31 03:58:56 +00:00
|
|
|
control = dissect_xdlc_control(tvb, 2, pinfo, llc_tree,
|
1999-11-16 11:44:20 +00:00
|
|
|
hf_llc_ctrl, ett_llc_ctrl,
|
2000-05-31 05:09:07 +00:00
|
|
|
ssap & SSAP_CR_BIT, TRUE);
|
1999-11-11 08:04:06 +00:00
|
|
|
llc_header_len += XDLC_CONTROL_LEN(control, TRUE);
|
1999-09-26 20:40:00 +00:00
|
|
|
if (is_snap)
|
1999-12-05 09:45:32 +00:00
|
|
|
llc_header_len += 5; /* 3 bytes of OUI, 2 bytes of protocol ID */
|
2000-05-11 22:04:18 +00:00
|
|
|
|
1999-09-26 20:31:51 +00:00
|
|
|
if (tree)
|
1999-11-11 08:04:06 +00:00
|
|
|
proto_item_set_len(ti, llc_header_len);
|
1999-08-04 04:37:46 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
if (is_snap) {
|
2000-05-28 21:21:23 +00:00
|
|
|
oui = tvb_get_ntoh24(tvb, 3);
|
2000-05-11 22:04:18 +00:00
|
|
|
etype = tvb_get_ntohs(tvb, 6);
|
|
|
|
|
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
2000-08-25 06:31:25 +00:00
|
|
|
col_append_fstr(pinfo->fd, COL_INFO, "; SNAP, OUI 0x%06X (%s), PID 0x%04X",
|
1999-12-29 05:20:00 +00:00
|
|
|
oui, val_to_str(oui, oui_vals, "Unknown"),
|
Apple, for some unknown reason, doesn't just encapsulate AppleTalk data
packets as SNAP-encapsulated Ethernet; instead, they use one of their
*own* OUIs, followed by the Ethernet packet type for AppleTalk. (Even
more oddly, they *do* use SNAP-encapsulated Ethernet for AARP....)
Dissect OUI 08-00-07 the same way we dissect the SNAP-encapsulated
Ethernet OUI of 00-00-00, and identify it as an Apple OUI.
Add checks to make sure we actually have a full LLC header and, if it's
a SNAP frame, that we have a full SNAP header as well.
For non-SNAP frames, list both the DSAP and the SSAP in the Info column,
and, for SNAP frames, list the OUI and PID.
svn path=/trunk/; revision=1220
1999-12-05 22:52:00 +00:00
|
|
|
etype);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree, hf_llc_oui, tvb, 3, 3,
|
1999-12-05 09:45:32 +00:00
|
|
|
oui);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
2000-05-11 22:04:18 +00:00
|
|
|
|
2000-05-16 04:44:14 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, 8, -1, -1);
|
2000-05-11 22:04:18 +00:00
|
|
|
tvb_compat(next_tvb, &pd, &offset);
|
|
|
|
|
2000-01-24 01:45:12 +00:00
|
|
|
switch (oui) {
|
|
|
|
|
|
|
|
case OUI_ENCAP_ETHER:
|
|
|
|
case OUI_APPLE_ATALK:
|
|
|
|
/* No, I have no idea why Apple used
|
|
|
|
one of their own OUIs, rather than
|
|
|
|
OUI_ENCAP_ETHER, and an Ethernet
|
|
|
|
packet type as protocol ID, for
|
|
|
|
AppleTalk data packets - but used
|
|
|
|
OUI_ENCAP_ETHER and an Ethernet
|
|
|
|
packet type for AARP packets. */
|
2000-01-24 02:05:39 +00:00
|
|
|
if (XDLC_IS_INFORMATION(control)) {
|
2000-05-19 04:54:36 +00:00
|
|
|
ethertype(etype, tvb, 8,
|
|
|
|
pinfo, tree, llc_tree, hf_llc_type);
|
2000-01-24 02:05:39 +00:00
|
|
|
} else
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
2000-01-24 01:45:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OUI_CISCO:
|
|
|
|
/* So are all CDP packets LLC packets
|
|
|
|
with an OUI of OUI_CISCO and a
|
|
|
|
protocol ID of 0x2000, or
|
|
|
|
are some of them raw or encapsulated
|
|
|
|
Ethernet? */
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree,
|
2000-05-11 22:04:18 +00:00
|
|
|
hf_llc_pid, tvb, 6, 2, etype);
|
2000-01-24 01:45:12 +00:00
|
|
|
}
|
2000-01-24 02:05:39 +00:00
|
|
|
if (XDLC_IS_INFORMATION(control)) {
|
Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.
Add a new subdissector table in the LLC dissector for protocol IDs with
a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that
table, rather than calling them via a switch statement.
Register the ISL dissector by name, and have the Ethernet dissector call
it via a handle.
Fix the handling of the checksum field in the CDP dissector.
The strings in CDP are counted, not null-terminated; treat them as such.
Fix the handling of the encapsulated frame CRC, and the encapsulated
frame, in the ISL dissector, at least for Ethernet frames; it may not be
correct for encapsulated Token Ring frames.
svn path=/trunk/; revision=2792
2000-12-28 09:49:09 +00:00
|
|
|
/* do lookup with the subdissector table */
|
|
|
|
/* for future reference, 0x0102 is Cisco DRIP */
|
|
|
|
if (!dissector_try_port(cisco_subdissector_table,
|
|
|
|
etype, next_tvb, pinfo, tree))
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
2000-01-24 02:05:39 +00:00
|
|
|
} else
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
2000-01-24 01:45:12 +00:00
|
|
|
break;
|
|
|
|
|
2000-04-10 14:45:30 +00:00
|
|
|
case OUI_CABLE_BPDU: /* DOCSIS cable modem spanning tree BPDU */
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree,
|
2001-01-03 06:56:03 +00:00
|
|
|
hf_llc_pid, tvb, 6, 2, etype);
|
2000-04-10 14:45:30 +00:00
|
|
|
}
|
2000-11-16 07:35:43 +00:00
|
|
|
call_dissector(bpdu_handle, next_tvb, pinfo, tree);
|
2000-04-10 14:45:30 +00:00
|
|
|
break;
|
|
|
|
|
2000-01-24 01:45:12 +00:00
|
|
|
default:
|
|
|
|
if (tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(llc_tree,
|
2000-05-11 22:04:18 +00:00
|
|
|
hf_llc_pid, tvb, 6, 2, etype);
|
2000-01-24 01:45:12 +00:00
|
|
|
}
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
2000-01-24 01:45:12 +00:00
|
|
|
break;
|
1999-08-23 22:47:13 +00:00
|
|
|
}
|
2000-05-11 22:04:18 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
else {
|
2000-05-11 22:04:18 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
2000-08-25 06:31:25 +00:00
|
|
|
col_append_fstr(pinfo->fd, COL_INFO,
|
|
|
|
"; DSAP %s %s, SSAP %s %s",
|
2000-05-11 22:04:18 +00:00
|
|
|
val_to_str(dsap & SAP_MASK, sap_vals, "%02x"),
|
|
|
|
dsap & DSAP_GI_BIT ?
|
1999-12-13 23:39:59 +00:00
|
|
|
"Group" : "Individual",
|
2000-05-11 22:04:18 +00:00
|
|
|
val_to_str(ssap & SAP_MASK, sap_vals, "%02x"),
|
|
|
|
ssap & SSAP_CR_BIT ?
|
2000-04-09 18:33:26 +00:00
|
|
|
"Response" : "Command"
|
1999-12-13 23:39:59 +00:00
|
|
|
);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
2000-05-16 04:44:14 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, llc_header_len, -1, -1);
|
2000-01-24 02:05:39 +00:00
|
|
|
if (XDLC_IS_INFORMATION(control)) {
|
1999-08-23 22:47:13 +00:00
|
|
|
/* non-SNAP */
|
2000-04-17 00:32:43 +00:00
|
|
|
/* do lookup with the subdissector table */
|
|
|
|
if (!dissector_try_port(subdissector_table, dsap,
|
Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.
Have the code that calls those dissectors translate the arguments as
necessary. (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation. Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)
This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so. It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.
Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.
Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_". Update the
dissectors that use those routines appropriately.
Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".
svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
|
|
|
next_tvb, pinfo, tree)) {
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
1999-08-23 22:47:13 +00:00
|
|
|
}
|
2000-04-09 18:33:26 +00:00
|
|
|
} else {
|
2000-11-16 07:35:43 +00:00
|
|
|
dissect_data(next_tvb, 0, pinfo, tree);
|
2000-04-09 18:33:26 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
1999-07-07 22:52:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_llc(void)
|
|
|
|
{
|
1999-12-13 21:48:18 +00:00
|
|
|
static struct true_false_string ig_bit = { "Group", "Individual" };
|
|
|
|
static struct true_false_string cr_bit = { "Response", "Command" };
|
|
|
|
|
1999-07-15 15:33:52 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_llc_dsap,
|
1999-12-13 21:48:18 +00:00
|
|
|
{ "DSAP", "llc.dsap", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(sap_vals), 0x0, "" }},
|
|
|
|
|
|
|
|
{ &hf_llc_dsap_ig,
|
|
|
|
{ "IG Bit", "llc.dsap.ig", FT_BOOLEAN, BASE_HEX,
|
|
|
|
&ig_bit, 0x0, "Individual/Group" }},
|
1999-07-07 22:52:57 +00:00
|
|
|
|
1999-07-15 15:33:52 +00:00
|
|
|
{ &hf_llc_ssap,
|
1999-12-13 21:48:18 +00:00
|
|
|
{ "SSAP", "llc.ssap", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(sap_vals), 0x0, "" }},
|
|
|
|
|
|
|
|
{ &hf_llc_ssap_cr,
|
|
|
|
{ "CR Bit", "llc.ssap.cr", FT_BOOLEAN, BASE_HEX,
|
|
|
|
&cr_bit, 0x0, "Command/Response" }},
|
1999-07-07 22:52:57 +00:00
|
|
|
|
1999-07-15 15:33:52 +00:00
|
|
|
{ &hf_llc_ctrl,
|
2000-04-13 02:36:35 +00:00
|
|
|
{ "Control", "llc.control", FT_UINT16, BASE_HEX,
|
2000-04-08 07:55:11 +00:00
|
|
|
NULL, 0x0, "" }},
|
1999-07-15 15:33:52 +00:00
|
|
|
|
|
|
|
/* registered here but handled in ethertype.c */
|
|
|
|
{ &hf_llc_type,
|
1999-12-13 21:48:18 +00:00
|
|
|
{ "Type", "llc.type", FT_UINT16, BASE_HEX,
|
|
|
|
VALS(etype_vals), 0x0, "" }},
|
1999-07-15 15:33:52 +00:00
|
|
|
|
|
|
|
{ &hf_llc_oui,
|
1999-12-13 21:48:18 +00:00
|
|
|
{ "Organization Code", "llc.oui", FT_UINT24, BASE_HEX,
|
1999-12-29 05:20:00 +00:00
|
|
|
VALS(oui_vals), 0x0, ""}},
|
1999-12-05 09:45:32 +00:00
|
|
|
|
|
|
|
{ &hf_llc_pid,
|
1999-12-13 21:48:18 +00:00
|
|
|
{ "Protocol ID", "llc.pid", FT_UINT16, BASE_HEX,
|
|
|
|
NULL, 0x0, ""}}
|
1999-07-07 22:52:57 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_llc,
|
|
|
|
&ett_llc_ctrl,
|
|
|
|
};
|
1999-07-07 22:52:57 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_llc = proto_register_protocol("Logical-Link Control", "LLC", "llc");
|
1999-07-07 22:52:57 +00:00
|
|
|
proto_register_field_array(proto_llc, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-04-17 00:32:43 +00:00
|
|
|
|
|
|
|
/* subdissector code */
|
|
|
|
subdissector_table = register_dissector_table("llc.dsap");
|
Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.
Add a new subdissector table in the LLC dissector for protocol IDs with
a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that
table, rather than calling them via a switch statement.
Register the ISL dissector by name, and have the Ethernet dissector call
it via a handle.
Fix the handling of the checksum field in the CDP dissector.
The strings in CDP are counted, not null-terminated; treat them as such.
Fix the handling of the encapsulated frame CRC, and the encapsulated
frame, in the ISL dissector, at least for Ethernet frames; it may not be
correct for encapsulated Token Ring frames.
svn path=/trunk/; revision=2792
2000-12-28 09:49:09 +00:00
|
|
|
cisco_subdissector_table = register_dissector_table("llc.cisco_pid");
|
2001-01-03 10:34:42 +00:00
|
|
|
|
|
|
|
register_dissector("llc", dissect_llc);
|
1999-07-07 22:52:57 +00:00
|
|
|
}
|
2000-11-16 07:35:43 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_llc(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Get a handle for the BPDU dissector.
|
|
|
|
*/
|
|
|
|
bpdu_handle = find_dissector("bpdu");
|
Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.
Add a new subdissector table in the LLC dissector for protocol IDs with
a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that
table, rather than calling them via a switch statement.
Register the ISL dissector by name, and have the Ethernet dissector call
it via a handle.
Fix the handling of the checksum field in the CDP dissector.
The strings in CDP are counted, not null-terminated; treat them as such.
Fix the handling of the encapsulated frame CRC, and the encapsulated
frame, in the ISL dissector, at least for Ethernet frames; it may not be
correct for encapsulated Token Ring frames.
svn path=/trunk/; revision=2792
2000-12-28 09:49:09 +00:00
|
|
|
|
2000-11-29 05:16:15 +00:00
|
|
|
dissector_add("wtap_encap", WTAP_ENCAP_ATM_RFC1483, dissect_llc);
|
2000-11-16 07:35:43 +00:00
|
|
|
}
|