aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-01-10 09:07:35 +0000
committerGuy Harris <guy@alum.mit.edu>2001-01-10 09:07:35 +0000
commit039bd984c0791b345ef12806a24cb5c44cf0e2f7 (patch)
tree8ada65a0f30fde1bc3c7eb46db802a42af046f93
parent2a8ac23dd2b55b88c264312fce9a65f895f71bdd (diff)
Make the stuff to handle SNAP frames (OUI, PID, payload) a routine of
its own; it's used not only by LLC, but by Frame Relay with RFC 2427 and ATM with RFC 2684. Support for RFC 2427-encapsulation Frame Relay packets, from Paul Ionescu. Get rid of the CISCO_IP PPP protocol type - Cisco HDLC uses, in most cases, Ethernet packet types, so use ETHERTYPE_IP instead (they're both 0x0800). svn path=/trunk/; revision=2854
-rw-r--r--Makefile.am3
-rw-r--r--bridged_pids.h51
-rw-r--r--oui.h5
-rw-r--r--packet-cdp.c3
-rw-r--r--packet-clnp.c4
-rw-r--r--packet-esis.c3
-rw-r--r--packet-fddi.c8
-rw-r--r--packet-fr.c170
-rw-r--r--packet-ip.c8
-rw-r--r--packet-ipx.c3
-rw-r--r--packet-isis.c3
-rw-r--r--packet-llc.c245
-rw-r--r--packet-llc.h5
-rw-r--r--packet-ppp.c17
-rw-r--r--packet-tr.c3
-rw-r--r--ppptypes.h40
16 files changed, 422 insertions, 149 deletions
diff --git a/Makefile.am b/Makefile.am
index 73c734f4b1..bffd4a91ea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.268 2001/01/07 22:08:31 guy Exp $
+# $Id: Makefile.am,v 1.269 2001/01/10 09:07:35 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@@ -269,6 +269,7 @@ ETHEREAL_COMMON_SOURCES = \
alignment.h \
asn1.c \
asn1.h \
+ bridged_pids.h \
column.c \
column.h \
color.h \
diff --git a/bridged_pids.h b/bridged_pids.h
new file mode 100644
index 0000000000..a0b331075e
--- /dev/null
+++ b/bridged_pids.h
@@ -0,0 +1,51 @@
+/* bridged_pids.h
+ * Definitions of protocol IDs for the 00-80-C2 OUI, used for
+ * bridging various networks over ATM (RFC 2684) or Frame Relay (RFC 2427).
+ *
+ * $Id: bridged_pids.h,v 1.1 2001/01/10 09:07:35 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * Copyright 1998 - 2000 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.
+ */
+
+#ifndef __BRIDGED_PID_H__
+#define __BRIDGED_PID_H__
+
+#define BPID_ETH_WITH_FCS 0x0001 /* 802.3/Ethernet with preserved FCS */
+#define BPID_ETH_WITHOUT_FCS 0x0007 /* 802.3/Ethernet without preserved FCS */
+
+#define BPID_802_4_WITH_FCS 0x0002 /* 802.4 with preserved FCS */
+#define BPID_802_4_WITHOUT_FCS 0x0008 /* 802.4 without preserved FCS */
+
+#define BPID_802_5_WITH_FCS 0x0003 /* 802.5 with preserved FCS */
+#define BPID_802_5_WITHOUT_FCS 0x0009 /* 802.5 without preserved FCS */
+
+#define BPID_FDDI_WITH_FCS 0x0004 /* FDDI with preserved FCS */
+#define BPID_FDDI_WITHOUT_FCS 0x000A /* FDDI without preserved FCS */
+
+#define BPID_802_6_WITH_FCS 0x0005 /* 802.6 with preserved FCS */
+#define BPID_802_6_WITHOUT_FCS 0x000B /* 802.6 without preserved FCS */
+
+#define BPID_FRAGMENTS 0x000D
+
+#define BPID_BPDU 0x000E /* 802.1(d) or 802.1(g) BPDUs */
+
+#define BPID_SR_BPDU 0x000F /* Source Routing BPDUs */
+
+#endif
diff --git a/oui.h b/oui.h
index 89149b641b..c6f8115cc1 100644
--- a/oui.h
+++ b/oui.h
@@ -2,7 +2,7 @@
* Definitions of OUIs
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: oui.h,v 1.7 2000/08/11 13:34:18 deniel Exp $
+ * $Id: oui.h,v 1.8 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,8 @@
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
#define OUI_CISCO 0x00000C /* Cisco (future use) */
#define OUI_CISCO_90 0x0000F8 /* Cisco (IOS 9.0 and above?) */
-#define OUI_BFR 0x0080C2 /* Bridged Frame-Relay, RFC 2427 */
+#define OUI_BRIDGED 0x0080C2 /* Bridged Frame-Relay, RFC 2427 */
+ /* and Bridged ATM, RFC 2684 */
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
#define OUI_APPLE_ATALK 0x080007 /* Appletalk */
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
diff --git a/packet-cdp.c b/packet-cdp.c
index f6b7e5902b..e41d188561 100644
--- a/packet-cdp.c
+++ b/packet-cdp.c
@@ -2,7 +2,7 @@
* Routines for the disassembly of the "Cisco Discovery Protocol"
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-cdp.c,v 1.31 2001/01/09 06:31:34 guy Exp $
+ * $Id: packet-cdp.c,v 1.32 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -525,4 +525,5 @@ void
proto_reg_handoff_cdp(void)
{
dissector_add("llc.cisco_pid", 0x2000, dissect_cdp, proto_cdp);
+ dissector_add("fr.cisco", 0x2000, dissect_cdp, proto_cdp);
}
diff --git a/packet-clnp.c b/packet-clnp.c
index 5bd4e90ff9..6a65b639a9 100644
--- a/packet-clnp.c
+++ b/packet-clnp.c
@@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-clnp.c,v 1.22 2001/01/09 06:31:34 guy Exp $
+ * $Id: packet-clnp.c,v 1.23 2001/01/10 09:07:35 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@@ -1932,4 +1932,6 @@ proto_reg_handoff_clnp(void)
proto_clnp);
dissector_add("osinl", NLPID_NULL, dissect_clnp,
proto_clnp); /* Inactive subset */
+ dissector_add("fr.ietf", NLPID_ISO8473_CLNP, dissect_clnp,
+ proto_clnp); /* Inactive subset */
}
diff --git a/packet-esis.c b/packet-esis.c
index 2f05363fd3..41e2c436ab 100644
--- a/packet-esis.c
+++ b/packet-esis.c
@@ -2,7 +2,7 @@
* Routines for ISO/OSI End System to Intermediate System
* Routeing Exchange Protocol ISO 9542.
*
- * $Id: packet-esis.c,v 1.11 2001/01/09 06:31:35 guy Exp $
+ * $Id: packet-esis.c,v 1.12 2001/01/10 09:07:35 guy Exp $
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
* Ethereal - Network traffic analyzer
@@ -433,4 +433,5 @@ void
proto_reg_handoff_esis(void)
{
dissector_add("osinl", NLPID_ISO9542_ESIS, dissect_esis, proto_esis);
+ dissector_add("fr.ietf", NLPID_ISO9542_ESIS, dissect_esis, proto_esis);
}
diff --git a/packet-fddi.c b/packet-fddi.c
index 0bbe7c87ef..1e707f2806 100644
--- a/packet-fddi.c
+++ b/packet-fddi.c
@@ -3,7 +3,7 @@
*
* Laurent Deniel <deniel@worldnet.fr>
*
- * $Id: packet-fddi.c,v 1.46 2001/01/09 06:31:35 guy Exp $
+ * $Id: packet-fddi.c,v 1.47 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -375,6 +375,12 @@ proto_register_fddi(void)
"FDDI", "fddi");
proto_register_field_array(proto_fddi, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ /*
+ * Called from various dissectors for encapsulated FDDI frames.
+ * We assume the MAC addresses in them aren't bitswapped.
+ */
+ register_dissector("fddi", dissect_fddi_not_bitswapped, proto_fddi);
}
void
diff --git a/packet-fr.c b/packet-fr.c
index 53f2d21a3d..76066c2ace 100644
--- a/packet-fr.c
+++ b/packet-fr.c
@@ -3,7 +3,7 @@
*
* Copyright 2001, Paul Ionescu <paul@acorp.ro>
*
- * $Id: packet-fr.c,v 1.5 2001/01/09 09:59:28 guy Exp $
+ * $Id: packet-fr.c,v 1.6 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -36,10 +36,10 @@
#include <string.h>
#include <glib.h>
#include "packet.h"
-#include "packet-ip.h"
-#include "packet-ipx.h"
-#include "packet-arp.h"
-
+#include "packet-llc.h"
+#include "xdlc.h"
+#include "oui.h"
+#include "nlpid.h"
static gint proto_fr = -1;
static gint ett_fr = -1;
@@ -48,17 +48,26 @@ static gint hf_fr_cr = -1;
static gint hf_fr_becn = -1;
static gint hf_fr_fecn = -1;
static gint hf_fr_de = -1;
-static gint hf_fr_proto = -1;
+static gint hf_fr_nlpid = -1;
+static gint hf_fr_oui = -1;
+static gint hf_fr_pid = -1;
+static gint hf_fr_type = -1;
+
+static dissector_table_t fr_subdissector_table;
+static dissector_table_t fr_cisco_subdissector_table;
-static dissector_handle_t ip_handle;
-static dissector_handle_t ipx_handle;
+static void dissect_lapf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static void dissect_fr_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
+/* see RFC2427 / RFC1490 and Cisco encapsulation */
static void dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
- proto_tree *fr_tree;
- guint16 fr_header,fr_proto;
- tvbuff_t *next_tvb;
+ proto_tree *fr_tree = NULL;
+ guint16 fr_header,fr_type,offset=2; /* default header length of FR is 2 bytes */
+
+ guint8 fr_nlpid,fr_ctrl;
CHECK_DISPLAY_AS_DATA(proto_fr, tvb, pinfo, tree);
@@ -69,14 +78,14 @@ static void dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->fd, COL_INFO);
fr_header = tvb_get_ntohs( tvb, 0 );
- fr_proto = tvb_get_ntohs( tvb, 2 );
if (check_col(pinfo->fd, COL_INFO))
- col_add_fstr(pinfo->fd, COL_INFO, "DLCI %u, proto 0x%04x",
- ((fr_header&0x00FF)>>4)+((fr_header&0xFC00)>>6),
- fr_proto);
+ col_add_fstr(pinfo->fd, COL_INFO, "DLCI %u",
+ ((fr_header&0x00FF)>>4)+((fr_header&0xFC00)>>6));
+ fr_header = tvb_get_ntohs( tvb, 0 );
+ fr_ctrl = tvb_get_guint8( tvb,offset);
+
if (tree) {
-
ti = proto_tree_add_protocol_format(tree, proto_fr, tvb, 0, 4, "Frame Relay");
fr_tree = proto_item_add_subtree(ti, ett_fr);
@@ -86,28 +95,94 @@ static void dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_boolean(fr_tree, hf_fr_fecn, tvb, 1, 1, fr_header);
proto_tree_add_boolean(fr_tree, hf_fr_becn, tvb, 1, 1, fr_header);
proto_tree_add_boolean(fr_tree, hf_fr_de, tvb, 1, 1, fr_header);
- proto_tree_add_uint(fr_tree, hf_fr_proto,tvb, 2, 2, fr_proto );
}
- next_tvb = tvb_new_subset(tvb, 4, -1, -1);
-
- switch (fr_proto){
-/* case 0x0703:
- dissect_lmi(next_tvb,pinfo,tree);
- break;
- this is not yet implemented
-*/
- case 0x0800:
- call_dissector(ip_handle,next_tvb,pinfo,tree);
- break;
- case 0x8137:
- call_dissector(ipx_handle,next_tvb,pinfo,tree);
- break;
- default:
- dissect_data(next_tvb,0,pinfo,tree);
- break;
+ if (fr_ctrl == XDLC_U) {
+ if (tree) {
+ proto_tree_add_text(fr_tree, tvb, offset, 0, "------- IETF Encapsulation -------");
+ /*
+ * XXX - if we're going to show this as Unnumbered
+ * Information, should we just hand it to
+ * "dissect_xdlc_control()"?
+ */
+ proto_tree_add_text(fr_tree, tvb, offset, 1, "Unnumbered Information");
+ }
+ offset++;
+ fr_nlpid = tvb_get_guint8 (tvb,offset);
+ if (fr_nlpid == 0) {
+ if (tree)
+ proto_tree_add_text(fr_tree, tvb, offset, 1, "Padding");
+ offset++;
+ fr_nlpid=tvb_get_guint8( tvb,offset);
+ }
+ if (tree)
+ proto_tree_add_uint(fr_tree, hf_fr_nlpid, tvb, offset, 1, fr_nlpid );
+ offset++;
+
+ if (fr_nlpid == NLPID_SNAP) {
+ dissect_snap(tvb, offset, pinfo, tree, fr_tree, fr_ctrl,
+ hf_fr_oui, hf_fr_type, hf_fr_pid, 0);
+ return;
+ }
+
+ /*
+ * XXX - we should just call "dissect_osi()" here, but
+ * some of the routines "dissect_osi()" calls themselves put
+ * the NLPID into the tree, and not everything registered with
+ * "fr.ietf" is also registered with "osinl".
+ *
+ * We'd need to figure out what to do with the NLPID.
+ * "dissect_osi()" is registered with the "llc.dsap" dissector
+ * table, so if it were to put the NLPID into the protocol
+ * tree it'd have to create its own subtree for it - not all its
+ * callers can do that for it (without knowing whether they're
+ * going to call it or not, and the LLC dissector doesn't).
+ *
+ * Currently, it hands the NLPID as part of the tvbuff to
+ * the sub-dissectors it calls; if none of them need to look
+ * at it, we could perhaps have it put the NLPID into the
+ * tree and *not* have the subdissectors expect it - that's
+ * what would have to be done for IP, for example, as IP,
+ * unlike CLNP, doesn't expect an NLPID as the first byte.
+ */
+ if (!dissector_try_port(fr_subdissector_table,fr_nlpid, tvb_new_subset(tvb,offset,-1,-1), pinfo, tree))
+ dissect_data(tvb_new_subset(tvb,offset,-1,-1), 0, pinfo, tree);
+ return;
+ } else {
+ if ((fr_header && 0xFCF0) == 0) {
+ /* this must be some sort of lapf on DLCI 0 for SVC */
+ /* because DLCI 0 is rezerved for LMI and SVC signaling encaplulated in lapf */
+ /* and LMI is transmitted in unnumbered information (03) */
+ /* so this must be lapf (guessing) */
+ dissect_lapf(tvb_new_subset(tvb,offset,-1,-1),pinfo,tree);
+ return;
+ }
+ if (fr_ctrl == (XDLC_U|XDLC_XID)) {
+ dissect_fr_xid(tvb_new_subset(tvb,offset,-1,-1),pinfo,tree);
+ return;
+ }
+
+ /*
+ * If the data does not start with unnumbered information (03) and
+ * the DLCI# is not 0, then there may be Cisco Frame Relay encapsulation.
+ */
+ proto_tree_add_text(fr_tree, tvb, offset, 0, "------- Cisco Encapsulation -------");
+ fr_type = tvb_get_ntohs( tvb, offset);
+ proto_tree_add_uint(fr_tree, hf_fr_type,tvb, offset, 2, fr_type );
+ if (!dissector_try_port(fr_cisco_subdissector_table,fr_type, tvb_new_subset(tvb,offset+2,-1,-1), pinfo, tree))
+ dissect_data(tvb_new_subset(tvb,offset+2,-1,-1), offset+2, pinfo, tree);
}
- return;
+}
+
+static void dissect_lapf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_tree_add_text(tree, tvb, 0, 0, "Frame relay lapf not yet implemented");
+ dissect_data(tvb_new_subset(tvb,0,-1,-1),0,pinfo,tree);
+}
+static void dissect_fr_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_tree_add_text(tree, tvb, 0, 0, "Frame relay xid not yet implemented");
+ dissect_data(tvb_new_subset(tvb,0,-1,-1),0,pinfo,tree);
}
/* Register the protocol with Ethereal */
@@ -129,9 +204,18 @@ void proto_register_fr(void)
{ &hf_fr_de, {
"DE", "fr.de", FT_BOOLEAN, 16,
NULL, 0x0002, "Discard Eligibility" }},
- { &hf_fr_proto, {
- "Encapsulated Protocol", "fr.proto", FT_UINT16, BASE_HEX,
- NULL, 0x0, "FrameRelay Encapsulated Protocol" }},
+ { &hf_fr_nlpid, {
+ "NLPID", "fr.nlpid", FT_UINT8, BASE_HEX,
+ NULL, 0x0, "FrameRelay Encapsulated Protocol NLPID" }},
+ { &hf_fr_oui, {
+ "Organization Code", "fr.snap.oui", FT_UINT24, BASE_HEX,
+ VALS(oui_vals), 0x0, ""}},
+ { &hf_fr_pid, {
+ "Protocol ID", "fr.snap.pid", FT_UINT16, BASE_HEX,
+ NULL, 0x0, ""}},
+ { &hf_fr_type, {
+ "Type", "fr.type", FT_UINT16, BASE_HEX,
+ NULL, 0x0, "FrameRelay SNAP Encapsulated Protocol" }},
};
@@ -145,15 +229,13 @@ void proto_register_fr(void)
proto_register_subtree_array(ett, array_length(ett));
register_dissector("fr", dissect_fr, proto_fr);
+
+ fr_subdissector_table = register_dissector_table("fr.ietf");
+ fr_cisco_subdissector_table = register_dissector_table("fr.cisco");
+
};
void proto_reg_handoff_fr(void)
{
- /*
- * Get handles for the IP and IPX dissectors.
- */
- ip_handle = find_dissector("ip");
- ipx_handle = find_dissector("ipx");
-
dissector_add("wtap_encap", WTAP_ENCAP_FRELAY, dissect_fr, proto_fr);
}
diff --git a/packet-ip.c b/packet-ip.c
index 3bfef03767..e3beb3c186 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.119 2001/01/09 06:31:36 guy Exp $
+ * $Id: packet-ip.c,v 1.120 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -53,6 +53,7 @@
#include "packet-ip.h"
#include "packet-ipsec.h"
#include "in_cksum.h"
+#include "nlpid.h"
static void dissect_icmp(tvbuff_t *, packet_info *, proto_tree *);
static void dissect_igmp(tvbuff_t *, packet_info *, proto_tree *);
@@ -1481,11 +1482,14 @@ proto_reg_handoff_ip(void)
{
dissector_add("ethertype", ETHERTYPE_IP, dissect_ip, proto_ip);
dissector_add("ppp.protocol", PPP_IP, dissect_ip, proto_ip);
- dissector_add("ppp.protocol", CISCO_IP, dissect_ip, proto_ip);
+ dissector_add("ppp.protocol", ETHERTYPE_IP, dissect_ip, proto_ip);
dissector_add("llc.dsap", SAP_IP, dissect_ip, proto_ip);
dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip, proto_ip);
dissector_add("ip.proto", IP_PROTO_IPIP, dissect_ip, proto_ip);
dissector_add("null.type", BSD_AF_INET, dissect_ip, proto_ip);
+ dissector_add("fr.cisco", ETHERTYPE_IP, dissect_ip, proto_ip);
+ dissector_add("fr.ietf", NLPID_IP, dissect_ip, proto_ip);
+
}
void
diff --git a/packet-ipx.c b/packet-ipx.c
index b96bbf70c8..53e79ad8e6 100644
--- a/packet-ipx.c
+++ b/packet-ipx.c
@@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-ipx.c,v 1.74 2001/01/09 09:59:28 guy Exp $
+ * $Id: packet-ipx.c,v 1.75 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -916,6 +916,7 @@ proto_reg_handoff_ipx(void)
dissector_add("udp.port", UDP_PORT_IPX, dissect_ipx, proto_ipx);
dissector_add("ethertype", ETHERTYPE_IPX, dissect_ipx, proto_ipx);
+ dissector_add("fr.cisco", ETHERTYPE_IPX, dissect_ipx, proto_ipx);
dissector_add("ppp.protocol", PPP_IPX, dissect_ipx, proto_ipx);
dissector_add("llc.dsap", SAP_NETWARE, dissect_ipx, proto_ipx);
dissector_add("null.type", BSD_AF_IPX, dissect_ipx, proto_ipx);
diff --git a/packet-isis.c b/packet-isis.c
index 5a710debc1..67376fbecc 100644
--- a/packet-isis.c
+++ b/packet-isis.c
@@ -2,7 +2,7 @@
* Routines for ISO/OSI network and transport protocol packet disassembly, core
* bits.
*
- * $Id: packet-isis.c,v 1.17 2001/01/09 06:31:37 guy Exp $
+ * $Id: packet-isis.c,v 1.18 2001/01/10 09:07:35 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -338,4 +338,5 @@ void
proto_reg_handoff_isis(void)
{
old_dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis, proto_isis);
+ old_dissector_add("fr.ietf", NLPID_ISO10589_ISIS, dissect_isis, proto_isis);
}
diff --git a/packet-llc.c b/packet-llc.c
index ce94ea5bab..a41b9e2fcc 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-llc.c,v 1.78 2001/01/09 06:31:38 guy Exp $
+ * $Id: packet-llc.c,v 1.79 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -38,12 +38,15 @@
#include "xdlc.h"
#include "etypes.h"
#include "llcsaps.h"
+#include "bridged_pids.h"
#include "packet-ip.h"
#include "packet-ipx.h"
#include "packet-netbios.h"
#include "packet-osi.h"
#include "packet-sna.h"
+#include "packet-llc.h"
+
static int proto_llc = -1;
static int hf_llc_dsap = -1;
static int hf_llc_ssap = -1;
@@ -61,6 +64,9 @@ static dissector_table_t subdissector_table;
static dissector_table_t cisco_subdissector_table;
static dissector_handle_t bpdu_handle;
+static dissector_handle_t eth_handle;
+static dissector_handle_t fddi_handle;
+static dissector_handle_t tr_handle;
typedef void (capture_func_t)(const u_char *, int, packet_counts *);
@@ -161,7 +167,8 @@ http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r
*/
{ OUI_CISCO, "Cisco" },
{ OUI_CISCO_90, "Cisco IOS 9.0 Compatible" },
- { OUI_BFR, "Bridged Frame-Relay" }, /* RFC 2427 */
+ { OUI_BRIDGED, "Frame Relay or ATM bridged frames" },
+ /* RFC 2427, RFC 2684 */
{ OUI_ATM_FORUM, "ATM Forum" },
{ OUI_APPLE_ATALK, "Apple (AppleTalk)" },
{ OUI_CABLE_BPDU, "DOCSIS Spanning Tree" }, /* DOCSIS spanning tree BPDU */
@@ -270,12 +277,8 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
int is_snap;
guint16 control;
int llc_header_len;
- guint32 oui;
- guint16 etype;
guint8 dsap, ssap;
tvbuff_t *next_tvb;
- const guint8 *pd;
- int offset;
CHECK_DISPLAY_AS_DATA(proto_llc, tvb, pinfo, tree);
@@ -328,76 +331,8 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_len(ti, llc_header_len);
if (is_snap) {
- oui = tvb_get_ntoh24(tvb, 3);
- etype = tvb_get_ntohs(tvb, 6);
-
- if (check_col(pinfo->fd, COL_INFO)) {
- col_append_fstr(pinfo->fd, COL_INFO, "; SNAP, OUI 0x%06X (%s), PID 0x%04X",
- oui, val_to_str(oui, oui_vals, "Unknown"),
- etype);
- }
- if (tree) {
- proto_tree_add_uint(llc_tree, hf_llc_oui, tvb, 3, 3,
- oui);
- }
-
- next_tvb = tvb_new_subset(tvb, 8, -1, -1);
- tvb_compat(next_tvb, &pd, &offset);
-
- 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. */
- if (XDLC_IS_INFORMATION(control)) {
- ethertype(etype, tvb, 8,
- pinfo, tree, llc_tree, hf_llc_type);
- } else
- dissect_data(next_tvb, 0, pinfo, tree);
- 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) {
- proto_tree_add_uint(llc_tree,
- hf_llc_pid, tvb, 6, 2, etype);
- }
- if (XDLC_IS_INFORMATION(control)) {
- /* 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))
- dissect_data(next_tvb, 0, pinfo, tree);
- } else
- dissect_data(next_tvb, 0, pinfo, tree);
- break;
-
- case OUI_CABLE_BPDU: /* DOCSIS cable modem spanning tree BPDU */
- if (tree) {
- proto_tree_add_uint(llc_tree,
- hf_llc_pid, tvb, 6, 2, etype);
- }
- call_dissector(bpdu_handle, next_tvb, pinfo, tree);
- break;
-
- default:
- if (tree) {
- proto_tree_add_uint(llc_tree,
- hf_llc_pid, tvb, 6, 2, etype);
- }
- dissect_data(next_tvb, 0, pinfo, tree);
- break;
- }
+ dissect_snap(tvb, 3, pinfo, tree, llc_tree, control,
+ hf_llc_oui, hf_llc_type, hf_llc_pid, -1);
}
else {
if (check_col(pinfo->fd, COL_INFO)) {
@@ -426,6 +361,158 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
+/*
+ * Dissect SNAP header; used elsewhere, e.g. in the Frame Relay dissector.
+ */
+void
+dissect_snap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
+ proto_tree *snap_tree, int control, int hf_oui, int hf_type, int hf_pid,
+ int bridge_pad)
+{
+ guint32 oui;
+ guint16 etype;
+ tvbuff_t *next_tvb;
+
+ oui = tvb_get_ntoh24(tvb, offset);
+ etype = tvb_get_ntohs(tvb, offset+3);
+
+ if (check_col(pinfo->fd, COL_INFO)) {
+ col_append_fstr(pinfo->fd, COL_INFO,
+ "; SNAP, OUI 0x%06X (%s), PID 0x%04X",
+ oui, val_to_str(oui, oui_vals, "Unknown"), etype);
+ }
+ if (tree) {
+ proto_tree_add_uint(snap_tree, hf_oui, tvb, offset, 3, oui);
+ }
+
+ 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. */
+ if (XDLC_IS_INFORMATION(control)) {
+ ethertype(etype, tvb, offset+5,
+ pinfo, tree, snap_tree, hf_type);
+ } else {
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ dissect_data(next_tvb, 0, pinfo, tree);
+ }
+ break;
+
+ case OUI_BRIDGED:
+ /*
+ * MAC frames bridged over ATM (RFC 2684) or Frame Relay
+ * (RFC 2427).
+ *
+ * We have to figure out how much padding to put
+ * into the frame. We were handed a "bridge_pad"
+ * argument which should be 0 for Frame Relay and
+ * 2 for ATM; we add to that the amount of padding
+ * common to both bridging types.
+ */
+ if (tree) {
+ proto_tree_add_uint(snap_tree, hf_pid, tvb, offset+3, 2,
+ etype);
+ }
+
+ if (bridge_pad == -1) {
+ /*
+ * This is LLC, for example, which, as far as I
+ * know, doesn't support that type of bridging.
+ */
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ dissect_data(next_tvb, 0, pinfo, tree);
+ break;
+ }
+
+ switch (etype) {
+
+ case BPID_ETH_WITH_FCS:
+ case BPID_ETH_WITHOUT_FCS:
+ next_tvb = tvb_new_subset(tvb, offset+5+bridge_pad,
+ -1, -1);
+ call_dissector(eth_handle, next_tvb, pinfo, tree);
+ break;
+
+ case BPID_802_5_WITH_FCS:
+ case BPID_802_5_WITHOUT_FCS:
+ /*
+ * We treat the last padding byte as the Access
+ * Control byte, as that's what the Token
+ * Ring dissector expects the first byte to
+ * be.
+ */
+ next_tvb = tvb_new_subset(tvb, offset+5+bridge_pad,
+ -1, -1);
+ call_dissector(tr_handle, next_tvb, pinfo, tree);
+ break;
+
+ case BPID_FDDI_WITH_FCS:
+ case BPID_FDDI_WITHOUT_FCS:
+ next_tvb = tvb_new_subset(tvb, offset+5+1+bridge_pad,
+ -1, -1);
+ call_dissector(fddi_handle, next_tvb, pinfo, tree);
+ break;
+
+ case BPID_BPDU:
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ call_dissector(bpdu_handle, next_tvb, pinfo, tree);
+ break;
+
+ default:
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ dissect_data(next_tvb, 0, pinfo, tree);
+ break;
+ }
+ 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) {
+ proto_tree_add_uint(snap_tree, hf_pid, tvb, offset+3, 2,
+ etype);
+ }
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ if (XDLC_IS_INFORMATION(control)) {
+ /* 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))
+ dissect_data(next_tvb, 0, pinfo, tree);
+ } else
+ dissect_data(next_tvb, 0, pinfo, tree);
+ break;
+
+ case OUI_CABLE_BPDU: /* DOCSIS cable modem spanning tree BPDU */
+ if (tree) {
+ proto_tree_add_uint(snap_tree, hf_pid, tvb, offset+3, 2,
+ etype);
+ }
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ call_dissector(bpdu_handle, next_tvb, pinfo, tree);
+ break;
+
+ default:
+ if (tree) {
+ proto_tree_add_uint(snap_tree, hf_pid, tvb, offset+3, 2,
+ etype);
+ }
+ next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
+ dissect_data(next_tvb, 0, pinfo, tree);
+ break;
+ }
+}
+
void
proto_register_llc(void)
{
@@ -486,9 +573,13 @@ void
proto_reg_handoff_llc(void)
{
/*
- * Get a handle for the BPDU dissector.
+ * Get handles for the BPDU, Ethernet, FDDI, and Token Ring
+ * dissectors.
*/
bpdu_handle = find_dissector("bpdu");
+ eth_handle = find_dissector("eth");
+ fddi_handle = find_dissector("fddi");
+ tr_handle = find_dissector("tr");
dissector_add("wtap_encap", WTAP_ENCAP_ATM_RFC1483, dissect_llc,
proto_llc);
diff --git a/packet-llc.h b/packet-llc.h
index a228605d87..a3ed1fd6c9 100644
--- a/packet-llc.h
+++ b/packet-llc.h
@@ -1,6 +1,6 @@
/* packet-llc.h
*
- * $Id: packet-llc.h,v 1.4 2001/01/03 10:34:41 guy Exp $
+ * $Id: packet-llc.h,v 1.5 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -27,4 +27,7 @@
void capture_llc(const u_char *, int, packet_counts *);
+void dissect_snap(tvbuff_t *, int, packet_info *, proto_tree *,
+ proto_tree *, int, int, int, int, int);
+
#endif
diff --git a/packet-ppp.c b/packet-ppp.c
index 5f770c6acd..ebea398650 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.51 2001/01/09 06:31:40 guy Exp $
+ * $Id: packet-ppp.c,v 1.52 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -37,11 +37,13 @@
#include "packet.h"
#include "packet-ppp.h"
#include "ppptypes.h"
+#include "etypes.h"
#include "packet-atalk.h"
#include "packet-ip.h"
#include "packet-ipv6.h"
#include "packet-ipx.h"
#include "packet-vines.h"
+#include "nlpid.h"
static int proto_ppp = -1;
@@ -108,8 +110,8 @@ static const value_string ppp_vals[] = {
{PPP_CBCP, "Callback Control Protocol" },
{PPP_MPLS_UNI, "MPLS Uni-cast"},
{PPP_MPLS_MULTI, "MPLS Multi-cast"},
- {CISCO_IP, "CISCO HDLC IP"},
- {CISCO_SLARP, "CISCO HDLC SLARP"},
+ {ETHERTYPE_IP, "Cisco HDLC IP"},
+ {CISCO_SLARP, "Cisco HDLC SLARP"},
{0, NULL }
};
@@ -662,9 +664,9 @@ fcs32(guint32 fcs,
return(0x00000000);
while (len--) {
- val = tvb_get_guint8(tvbuff, offset++);
- fcs = (((fcs) >> 8) ^ fcstab_32[((fcs) ^ (val)) & 0xff]);
- }
+ val = tvb_get_guint8(tvbuff, offset++);
+ fcs = (((fcs) >> 8) ^ fcstab_32[((fcs) ^ (val)) & 0xff]);
+ }
return (fcs ^ 0xffffffff);
}
@@ -672,7 +674,7 @@ void
capture_ppp( const u_char *pd, int offset, packet_counts *ld ) {
switch (pntohs(&pd[offset + 2])) {
case PPP_IP:
- case CISCO_IP:
+ case ETHERTYPE_IP:
capture_ip(pd, offset + 4, ld);
break;
case PPP_IPX:
@@ -1470,4 +1472,5 @@ proto_reg_handoff_ppp(void)
{
dissector_add("wtap_encap", WTAP_ENCAP_PPP, dissect_ppp, proto_ppp);
dissector_add("wtap_encap", WTAP_ENCAP_PPP_WITH_PHDR, dissect_ppp, proto_ppp);
+ dissector_add("fr.ietf", NLPID_PPP, dissect_ppp, proto_ppp);
}
diff --git a/packet-tr.c b/packet-tr.c
index 69dfca9770..d8e30be2b2 100644
--- a/packet-tr.c
+++ b/packet-tr.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-tr.c,v 1.55 2001/01/09 06:31:44 guy Exp $
+ * $Id: packet-tr.c,v 1.56 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -671,6 +671,7 @@ proto_register_tr(void)
proto_tr = proto_register_protocol("Token-Ring", "Token-Ring", "tr");
proto_register_field_array(proto_tr, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("tr", dissect_tr, proto_tr);
}
void
diff --git a/ppptypes.h b/ppptypes.h
index 69aeca3299..bf4ea5fd9b 100644
--- a/ppptypes.h
+++ b/ppptypes.h
@@ -1,7 +1,7 @@
/* ppptypes.h
* Defines PPP packet types.
*
- * $Id: ppptypes.h,v 1.2 2000/12/14 08:20:30 guy Exp $
+ * $Id: ppptypes.h,v 1.3 2001/01/10 09:07:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -40,8 +40,8 @@
#define PPP_MP 0x3d /* Multilink PPP */
#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
#define PPP_COMP 0xfd /* compressed packet */
-#define PPP_MPLS_UNI 0x281 /* MPLS Unicast */
-#define PPP_MPLS_MULTI 0x281 /* MPLS Multicast */
+#define PPP_MPLS_UNI 0x281 /* MPLS Unicast */
+#define PPP_MPLS_MULTI 0x281 /* MPLS Multicast */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
#define PPP_IPXCP 0x802b /* IPX Control Protocol */
@@ -52,12 +52,36 @@
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
#define PPP_CBCP 0xc029 /* Callback Control Protocol */
-/* Protocol types for the CISCO HDLC Format */
-#define CISCO_IP 0x0800 /* Internet Protocol */
-#define CISCO_SLARP 0x8035 /* CISCO SLARP protocol */
-
-/* Address and control field for CISCO HDLC */
+/*
+ * Address and control field for Cisco HDLC.
+ * RFC 1547, "Requirements for an Internet Standard Point-to-Point Protocol",
+ * section 4.3.1 "Cisco Systems point-to-point protocols", says
+ *
+ * The Cisco Systems gateway supports both asynchronous links using SLIP
+ * and synchronous links using either simple HDLC framing, X.25 LAPB or
+ * full X.25. The HDLC framing procedure includes a four byte header.
+ * The first octet (address) is either 0x0F (unicast intent) or 0x8F
+ * (multicast intent). The second octet (control byte) is left zero and
+ * is not checked on reception. The third and fourth octets contain a
+ * standard 16 bit Ethernet protocol type code.
+ *
+ * This is the first two octets for unicast intent frames.
+ */
#define CISCO_HDLC_ADDR_CTRL 0x0F00 /* Internet Protocol */
+/*
+ * Protocol types for the Cisco HDLC format.
+ *
+ * As per the above, according to RFC 1547, these are "standard 16 bit
+ * Ethernet protocol type code[s]", but 0x8035 is Reverse ARP, so, unless
+ * Cisco SLARP looks just like Reverse ARP, that's not quite true.
+ * In addition, 0x2000 is apparently the Cisco Discovery Protocol, but
+ * on Ethernet those are encapsulated inside SNAP with an OUI of
+ * OUI_CISCO, not OUI_ENCAP_ETHER.
+ *
+ * If it *is* true, that'd be lovely, as we could just use
+ * "ethertype()" to handle Cisco HDLC.
+ */
+#define CISCO_SLARP 0x8035 /* Cisco SLARP protocol */
#endif /* ppptypes.h */