2001-01-07 22:08:31 +00:00
|
|
|
/* packet-fr.c
|
|
|
|
* Routines for Frame Relay dissection
|
|
|
|
*
|
2012-05-03 19:31:03 +00:00
|
|
|
* Copyright 2001, Paul Ionescu <paul@acorp.ro>
|
2001-01-07 22:08:31 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-01-07 22:08:31 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-01-07 22:08:31 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-01-07 22:08:31 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-01-07 22:08:31 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-03-23 19:22:02 +00:00
|
|
|
*
|
|
|
|
* References:
|
|
|
|
*
|
|
|
|
* http://www.protocols.com/pbook/frame.htm
|
2004-07-01 08:35:49 +00:00
|
|
|
* http://www.mplsforum.org/frame/Approved/FRF.3/FRF.3.2.pdf
|
2003-09-02 18:33:11 +00:00
|
|
|
* ITU Recommendations Q.922 and Q.933
|
2001-03-30 11:14:41 +00:00
|
|
|
* RFC-1490
|
|
|
|
* RFC-2427
|
2001-03-23 19:22:02 +00:00
|
|
|
* Cisco encapsulation
|
2003-09-02 23:37:48 +00:00
|
|
|
* http://www.trillium.com/assets/legacyframe/white_paper/8771019.pdf
|
2001-01-07 22:08:31 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2001-01-07 22:08:31 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2013-12-21 17:23:17 +00:00
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-12-21 17:23:17 +00:00
|
|
|
#include <wiretap/wtap.h>
|
|
|
|
|
2001-01-10 09:07:35 +00:00
|
|
|
#include "packet-llc.h"
|
Add a new Wiretap encapsulation type for Cisco HDLC. Map the NetBSD
DLT_HDLC to it.
Make a separate dissector for Cisco HDLC, and add a dissector for Cisco
SLARP. Have the PPP dissector call the Cisco HDLC dissector if the
address field is the Cisco HDLC unicast or multicast address. Use the
Cisco HDLC dissector for the Cisco HDLC Wiretap encapsulation type.
Add a new dissector table "chdlctype", for Cisco HDLC packet types
(they're *almost* the same as Ethernet types, but 0x8035 is SLARP, not
Reverse ARP, and 0x2000 is the Cisco Discovery protocol, for example),
replacing "fr.chdlc".
Have a "chdlctype()" routine, similar to "ethertype()", used both by the
Cisco HDLC and Frame Relay dissectors. Have a "chdlc_vals[]"
"value_string" table for Cisco HDLC types and protocol names. Split the
packet type field in the Frame Relay dissector into separate SNAP and
Cisco HDLC fields, and give them the Ethernet type and Cisco HDLC type
"value_string" tables, respectively.
svn path=/trunk/; revision=3133
2001-03-15 09:11:03 +00:00
|
|
|
#include "packet-chdlc.h"
|
2005-03-21 03:55:50 +00:00
|
|
|
#include "packet-eth.h"
|
|
|
|
#include "packet-ip.h"
|
|
|
|
#include "packet-ipv6.h"
|
|
|
|
#include "packet-ppp.h"
|
|
|
|
#include "packet-fr.h"
|
2004-09-28 23:48:02 +00:00
|
|
|
#include <epan/xdlc.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
|
|
|
#include <epan/oui.h>
|
|
|
|
#include <epan/nlpid.h>
|
|
|
|
#include <epan/greproto.h>
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_fr(void);
|
|
|
|
void proto_reg_handoff_fr(void);
|
|
|
|
|
2001-03-23 19:22:02 +00:00
|
|
|
/*
|
|
|
|
* Bits in the address field.
|
|
|
|
*/
|
2012-05-03 19:31:03 +00:00
|
|
|
#define FRELAY_EA 0x01 /* Address field extension bit */
|
|
|
|
|
|
|
|
#define FRELAY_UPPER_DLCI 0xFC /* Upper DLCI */
|
|
|
|
#define FRELAY_CR 0x02 /* Command/response bit in first octet */
|
|
|
|
|
|
|
|
#define FRELAY_SECOND_DLCI 0xF0 /* DLCI bits in FECN/BECN/DE octet */
|
|
|
|
#define FRELAY_FECN 0x08 /* Forward Explicit Congestion Notification */
|
|
|
|
#define FRELAY_BECN 0x04 /* Backward Explicit Congestion Notification */
|
|
|
|
#define FRELAY_DE 0x02 /* Discard Eligibility */
|
|
|
|
|
|
|
|
#define FRELAY_THIRD_DLCI 0xFE /* DLCI bits in third octet, if any */
|
|
|
|
|
|
|
|
#define FRELAY_LOWER_DLCI 0xFC /* Lower DLCI */
|
|
|
|
#define FRELAY_DC 0x02 /* DLCI or DL-CORE control indicator in last octet */
|
|
|
|
|
|
|
|
#define FROM_DCE 0x80 /* for direction setting */
|
|
|
|
|
|
|
|
static gint proto_fr = -1;
|
|
|
|
static gint ett_fr = -1;
|
|
|
|
static gint ett_fr_address = -1;
|
|
|
|
static gint ett_fr_control = -1;
|
|
|
|
static gint hf_fr_ea = -1;
|
|
|
|
static gint hf_fr_upper_dlci = -1;
|
|
|
|
static gint hf_fr_cr = -1;
|
|
|
|
static gint hf_fr_second_dlci = -1;
|
|
|
|
static gint hf_fr_fecn = -1;
|
|
|
|
static gint hf_fr_becn = -1;
|
|
|
|
static gint hf_fr_de = -1;
|
|
|
|
static gint hf_fr_third_dlci = -1;
|
|
|
|
static gint hf_fr_dlcore_control = -1;
|
|
|
|
static gint hf_fr_lower_dlci = -1;
|
|
|
|
static gint hf_fr_dc = -1;
|
|
|
|
static gint hf_fr_dlci = -1;
|
|
|
|
static gint hf_fr_control = -1;
|
|
|
|
static gint hf_fr_n_r = -1;
|
|
|
|
static gint hf_fr_n_s = -1;
|
|
|
|
static gint hf_fr_p = -1;
|
|
|
|
static gint hf_fr_p_ext = -1;
|
|
|
|
static gint hf_fr_f = -1;
|
|
|
|
static gint hf_fr_f_ext = -1;
|
|
|
|
static gint hf_fr_s_ftype = -1;
|
|
|
|
static gint hf_fr_u_modifier_cmd = -1;
|
2004-01-03 03:51:27 +00:00
|
|
|
static gint hf_fr_u_modifier_resp = -1;
|
2012-05-03 19:31:03 +00:00
|
|
|
static gint hf_fr_ftype_i = -1;
|
|
|
|
static gint hf_fr_ftype_s_u = -1;
|
|
|
|
static gint hf_fr_ftype_s_u_ext = -1;
|
|
|
|
static gint hf_fr_nlpid = -1;
|
|
|
|
static gint hf_fr_oui = -1;
|
|
|
|
static gint hf_fr_pid = -1;
|
|
|
|
static gint hf_fr_snaptype = -1;
|
|
|
|
static gint hf_fr_chdlctype = -1;
|
2001-01-10 09:07:35 +00:00
|
|
|
|
2004-11-24 09:13:52 +00:00
|
|
|
static dissector_handle_t eth_withfcs_handle;
|
2003-09-03 22:26:38 +00:00
|
|
|
static dissector_handle_t gprs_ns_handle;
|
2001-11-26 01:03:35 +00:00
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2013-09-12 20:34:19 +00:00
|
|
|
static dissector_table_t osinl_incl_subdissector_table;
|
2003-04-29 17:56:49 +00:00
|
|
|
|
2003-09-03 22:26:38 +00:00
|
|
|
/*
|
|
|
|
* Encapsulation type.
|
|
|
|
* XXX - this should be per-DLCI as well.
|
|
|
|
*/
|
2012-05-03 19:31:03 +00:00
|
|
|
#define FRF_3_2 0 /* FRF 3.2 or Cisco HDLC */
|
|
|
|
#define GPRS_NS 1 /* GPRS Network Services (3GPP TS 08.16) */
|
|
|
|
#define RAW_ETHER 2 /* Raw Ethernet */
|
2003-09-03 22:26:38 +00:00
|
|
|
|
|
|
|
static gint fr_encap = FRF_3_2;
|
|
|
|
|
2001-03-23 19:22:02 +00:00
|
|
|
static const true_false_string ctrl_string = {
|
2012-05-03 19:31:03 +00:00
|
|
|
"DLCI Address",
|
|
|
|
"Control"
|
|
|
|
};
|
2001-03-23 19:22:02 +00:00
|
|
|
static const true_false_string ea_string = {
|
2012-05-03 19:31:03 +00:00
|
|
|
"Last Octet",
|
|
|
|
"More Follows"
|
|
|
|
};
|
2001-03-23 19:22:02 +00:00
|
|
|
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
/*
|
|
|
|
* This isn't the same as "nlpid_vals[]"; 0x08 is Q.933, not Q.931,
|
2001-12-02 00:07:46 +00:00
|
|
|
* and 0x09 is LMI, not Q.2931, and we assume that it's an initial
|
|
|
|
* protocol identifier, so 0x01 is T.70, not X.29.
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
*/
|
|
|
|
static const value_string fr_nlpid_vals[] = {
|
2012-05-03 19:31:03 +00:00
|
|
|
{ NLPID_NULL, "NULL" },
|
|
|
|
{ NLPID_IPI_T_70, "T.70" }, /* XXX - IPI, or SPI? */
|
|
|
|
{ NLPID_X_633, "X.633" },
|
|
|
|
{ NLPID_Q_931, "Q.933" },
|
|
|
|
{ NLPID_LMI, "LMI" },
|
|
|
|
{ NLPID_Q_2119, "Q.2119" },
|
|
|
|
{ NLPID_SNAP, "SNAP" },
|
|
|
|
{ NLPID_ISO8473_CLNP, "CLNP" },
|
|
|
|
{ NLPID_ISO9542_ESIS, "ESIS" },
|
|
|
|
{ NLPID_ISO10589_ISIS, "ISIS" },
|
|
|
|
{ NLPID_ISO10747_IDRP, "IDRP" },
|
|
|
|
{ NLPID_ISO9542X25_ESIS, "ESIS (X.25)" },
|
|
|
|
{ NLPID_ISO10030, "ISO 10030" },
|
|
|
|
{ NLPID_ISO11577, "ISO 11577" },
|
|
|
|
{ NLPID_COMPRESSED, "Data compression protocol" },
|
|
|
|
{ NLPID_IP, "IP" },
|
|
|
|
{ NLPID_IP6, "IPv6" },
|
|
|
|
{ NLPID_PPP, "PPP" },
|
|
|
|
{ 0, NULL },
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
};
|
|
|
|
|
2001-11-30 04:39:45 +00:00
|
|
|
static dissector_table_t fr_subdissector_table;
|
2003-09-03 05:39:21 +00:00
|
|
|
static dissector_table_t fr_osinl_subdissector_table;
|
2001-01-07 22:08:31 +00:00
|
|
|
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
static void dissect_fr_nlpid(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
2012-05-03 19:31:03 +00:00
|
|
|
proto_tree *tree, proto_item *ti,
|
|
|
|
proto_tree *fr_tree, guint8 fr_ctrl);
|
2001-01-10 09:07:35 +00:00
|
|
|
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);
|
|
|
|
|
2004-01-03 03:51:27 +00:00
|
|
|
/* Used only for U frames */
|
|
|
|
static const xdlc_cf_items fr_cf_items = {
|
2012-05-03 19:31:03 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&hf_fr_p,
|
|
|
|
&hf_fr_f,
|
|
|
|
NULL,
|
|
|
|
&hf_fr_u_modifier_cmd,
|
|
|
|
&hf_fr_u_modifier_resp,
|
|
|
|
NULL,
|
|
|
|
&hf_fr_ftype_s_u
|
2004-01-03 03:51:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Used only for I and S frames */
|
|
|
|
static const xdlc_cf_items fr_cf_items_ext = {
|
2012-05-03 19:31:03 +00:00
|
|
|
&hf_fr_n_r,
|
|
|
|
&hf_fr_n_s,
|
|
|
|
&hf_fr_p_ext,
|
|
|
|
&hf_fr_f_ext,
|
|
|
|
&hf_fr_s_ftype,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&hf_fr_ftype_i,
|
|
|
|
&hf_fr_ftype_s_u_ext
|
2004-01-03 03:51:27 +00:00
|
|
|
};
|
|
|
|
|
2005-03-21 03:55:50 +00:00
|
|
|
void
|
|
|
|
capture_fr(const guchar *pd, int offset, int len, packet_counts *ld)
|
|
|
|
{
|
|
|
|
guint8 fr_octet;
|
2008-06-27 16:15:30 +00:00
|
|
|
guint32 addr;
|
2005-03-21 03:55:50 +00:00
|
|
|
guint8 fr_ctrl;
|
|
|
|
guint8 fr_nlpid;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OK, fetch the address field - keep going until we get an EA bit.
|
|
|
|
*/
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_octet = pd[offset];
|
|
|
|
if (fr_octet & FRELAY_EA) {
|
|
|
|
/*
|
|
|
|
* Bogus! There should be at least 2 octets.
|
|
|
|
* XXX - is this FRF.12 frame relay fragmentation? If so, can
|
|
|
|
* we handle that?
|
|
|
|
*/
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* The first octet contains the upper 6 bits of the DLCI, as well
|
|
|
|
* as the C/R bit.
|
|
|
|
*/
|
2008-06-27 16:15:30 +00:00
|
|
|
addr = (fr_octet & FRELAY_UPPER_DLCI) >> 2;
|
2005-03-21 03:55:50 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The second octet contains 4 more bits of DLCI, as well as FECN,
|
|
|
|
* BECN, and DE.
|
|
|
|
*/
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_octet = pd[offset];
|
2008-06-27 16:15:30 +00:00
|
|
|
addr = (addr << 4) | ((fr_octet & FRELAY_SECOND_DLCI) >> 4);
|
2005-03-21 03:55:50 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
if (!(fr_octet & FRELAY_EA)) {
|
|
|
|
/*
|
|
|
|
* We have 3 or more address octets.
|
|
|
|
*
|
|
|
|
* The third octet contains 7 more bits of DLCI if EA isn't set,
|
|
|
|
* and lower DLCI or DL-CORE control plus the DLCI or DL-CORE
|
|
|
|
* control indicator flag if EA is set.
|
|
|
|
*/
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_octet = pd[offset];
|
|
|
|
if (!(fr_octet & FRELAY_EA)) {
|
|
|
|
/*
|
|
|
|
* 7 more bits of DLCI.
|
|
|
|
*/
|
2008-06-27 16:15:30 +00:00
|
|
|
addr = (addr << 7) | ((fr_octet & FRELAY_THIRD_DLCI) >> 1);
|
2005-03-21 03:55:50 +00:00
|
|
|
offset++;
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_octet = pd[offset];
|
|
|
|
while (!(fr_octet & FRELAY_EA)) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* Bogus! More than 4 octets of address.
|
|
|
|
*/
|
2005-03-21 03:55:50 +00:00
|
|
|
offset++;
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 19:31:03 +00:00
|
|
|
fr_octet = pd[offset];
|
2005-03-21 03:55:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Last octet - contains lower DLCI or DL-CORE control, DLCI or
|
|
|
|
* DL-CORE control indicator flag.
|
|
|
|
*/
|
|
|
|
if (fr_octet & FRELAY_DC) {
|
|
|
|
/*
|
|
|
|
* DL-CORE.
|
|
|
|
*/
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Last 6 bits of DLCI.
|
|
|
|
*/
|
2008-06-27 16:15:30 +00:00
|
|
|
addr = (addr << 6) | ((fr_octet & FRELAY_LOWER_DLCI) >> 2);
|
2005-03-21 03:55:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (fr_encap) {
|
|
|
|
|
|
|
|
case FRF_3_2:
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_ctrl = pd[offset];
|
|
|
|
if (fr_ctrl == XDLC_U) {
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX - treat DLCI 0 specially? On DLCI 0, an NLPID of 0x08
|
|
|
|
* means Q.933, but on other circuits it could be the "for
|
|
|
|
* protocols which do not have an NLPID assigned or do not
|
|
|
|
* have a SNAP encapsulation" stuff from RFC 2427.
|
|
|
|
*/
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fr_nlpid = pd[offset];
|
|
|
|
if (fr_nlpid == 0) {
|
2012-05-03 19:31:03 +00:00
|
|
|
offset++;
|
2005-03-21 03:55:50 +00:00
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
|
|
|
ld->other++;
|
|
|
|
return;
|
|
|
|
}
|
2012-05-03 19:31:03 +00:00
|
|
|
fr_nlpid = pd[offset];
|
2005-03-21 03:55:50 +00:00
|
|
|
}
|
|
|
|
offset++;
|
|
|
|
switch (fr_nlpid) {
|
|
|
|
|
|
|
|
case NLPID_IP:
|
|
|
|
capture_ip(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NLPID_IP6:
|
|
|
|
capture_ipv6(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NLPID_PPP:
|
|
|
|
capture_ppp_hdlc(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NLPID_SNAP:
|
|
|
|
capture_snap(pd, offset, len, ld);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ld->other++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2008-06-27 16:15:30 +00:00
|
|
|
if (addr == 0) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* This must be some sort of LAPF on DLCI 0 for SVC
|
|
|
|
* because DLCI 0 is reserved for LMI and SVC signaling
|
|
|
|
* encapsulated in LAPF, and LMI is transmitted in
|
|
|
|
* unnumbered information (03), so this must be LAPF
|
|
|
|
* (guessing).
|
|
|
|
*
|
|
|
|
* XXX - but what is it? Is Q.933 carried inside UI
|
|
|
|
* frames or other types of frames or both?
|
|
|
|
*/
|
|
|
|
ld->other++;
|
|
|
|
return;
|
2005-03-21 03:55:50 +00:00
|
|
|
}
|
|
|
|
if (fr_ctrl == (XDLC_U|XDLC_XID)) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* XID.
|
|
|
|
*/
|
|
|
|
ld->other++;
|
|
|
|
return;
|
2005-03-21 03:55:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the data does not start with unnumbered information (03) and
|
|
|
|
* the DLCI# is not 0, then there may be Cisco Frame Relay encapsulation.
|
|
|
|
*/
|
|
|
|
capture_chdlc(pd, offset, len, ld);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GPRS_NS:
|
|
|
|
ld->other++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RAW_ETHER:
|
2008-06-27 16:15:30 +00:00
|
|
|
if (addr != 0)
|
2005-03-21 03:55:50 +00:00
|
|
|
capture_eth(pd, offset, len, ld);
|
|
|
|
else
|
|
|
|
ld->other++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-02 18:45:06 +00:00
|
|
|
static void
|
|
|
|
dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
2012-05-03 19:31:03 +00:00
|
|
|
gboolean has_direction, gboolean decode_address )
|
2001-01-07 22:08:31 +00:00
|
|
|
{
|
2012-05-03 19:31:03 +00:00
|
|
|
int offset = 0;
|
|
|
|
proto_item *ti = NULL;
|
|
|
|
proto_tree *fr_tree = NULL;
|
|
|
|
proto_item *octet_item = NULL;
|
|
|
|
proto_tree *octet_tree = NULL;
|
|
|
|
guint8 fr_octet;
|
|
|
|
int is_response = FALSE;
|
|
|
|
guint32 addr = 0;
|
|
|
|
guint8 fr_ctrl;
|
|
|
|
guint16 fr_type;
|
|
|
|
tvbuff_t *next_tvb;
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FR");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-01-07 22:08:31 +00:00
|
|
|
|
2003-09-02 18:45:06 +00:00
|
|
|
if (has_direction) {
|
|
|
|
if (pinfo->pseudo_header->x25.flags & FROM_DCE) {
|
2009-08-09 07:14:16 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
|
|
|
|
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
|
2003-09-02 18:45:06 +00:00
|
|
|
} else {
|
2009-08-09 07:14:16 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
|
|
|
|
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
|
2003-09-02 18:45:06 +00:00
|
|
|
}
|
2002-10-19 00:40:05 +00:00
|
|
|
}
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2003-09-02 18:33:11 +00:00
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_fr, tvb, 0, -1, "Frame Relay");
|
|
|
|
fr_tree = proto_item_add_subtree(ti, ett_fr);
|
|
|
|
}
|
|
|
|
|
2009-03-27 07:17:05 +00:00
|
|
|
if (decode_address)
|
|
|
|
{
|
2003-09-02 18:33:11 +00:00
|
|
|
/*
|
2009-03-27 07:17:05 +00:00
|
|
|
* OK, fetch the address field - keep going until we get an EA bit.
|
2003-09-02 18:33:11 +00:00
|
|
|
*/
|
|
|
|
fr_octet = tvb_get_guint8(tvb, offset);
|
|
|
|
|
2009-03-27 07:17:05 +00:00
|
|
|
if (fr_octet & FRELAY_EA) {
|
|
|
|
/*
|
|
|
|
* Bogus! There should be at least 2 octets.
|
|
|
|
* XXX - is this FRF.12 frame relay fragmentation? If so, we
|
|
|
|
* should dissect it as such, if possible.
|
|
|
|
*/
|
|
|
|
addr = 0;
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_text(fr_tree, tvb, offset, 1,
|
2012-05-03 19:31:03 +00:00
|
|
|
"Bogus 1-octet address field");
|
2009-03-27 07:17:05 +00:00
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* The first octet contains the upper 6 bits of the DLCI, as well
|
|
|
|
* as the C/R bit.
|
|
|
|
*/
|
|
|
|
addr = (fr_octet & FRELAY_UPPER_DLCI) >> 2;
|
|
|
|
is_response = (fr_octet & FRELAY_CR);
|
|
|
|
if (tree) {
|
|
|
|
octet_item = proto_tree_add_text(fr_tree, tvb, offset, 1,
|
2012-05-03 19:31:03 +00:00
|
|
|
"First address octet: 0x%02x", fr_octet);
|
2009-03-27 07:17:05 +00:00
|
|
|
octet_tree = proto_item_add_subtree(octet_item, ett_fr_address);
|
|
|
|
proto_tree_add_uint(octet_tree, hf_fr_upper_dlci, tvb, offset, 1, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_cr, tvb, offset, 1, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_ea, tvb, offset, 1, fr_octet);
|
|
|
|
}
|
|
|
|
offset++;
|
|
|
|
|
2003-09-02 18:33:11 +00:00
|
|
|
/*
|
2009-03-27 07:17:05 +00:00
|
|
|
* The second octet contains 4 more bits of DLCI, as well as FECN,
|
|
|
|
* BECN, and DE.
|
2003-09-02 18:33:11 +00:00
|
|
|
*/
|
|
|
|
fr_octet = tvb_get_guint8(tvb, offset);
|
2009-03-27 07:17:05 +00:00
|
|
|
addr = (addr << 4) | ((fr_octet & FRELAY_SECOND_DLCI) >> 4);
|
|
|
|
if (tree) {
|
|
|
|
octet_item = proto_tree_add_text(fr_tree, tvb, offset, 1,
|
2012-05-03 19:31:03 +00:00
|
|
|
"Second address octet: 0x%02x",
|
|
|
|
fr_octet);
|
2009-03-27 07:17:05 +00:00
|
|
|
octet_tree = proto_item_add_subtree(octet_item, ett_fr_address);
|
|
|
|
proto_tree_add_uint(octet_tree, hf_fr_second_dlci, tvb, offset, 1, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_fecn, tvb, 0, offset, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_becn, tvb, 0, offset, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_de, tvb, 0, offset, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_ea, tvb, offset, 1, fr_octet);
|
|
|
|
}
|
|
|
|
offset++;
|
|
|
|
|
2003-09-02 18:33:11 +00:00
|
|
|
if (!(fr_octet & FRELAY_EA)) {
|
2009-03-27 07:17:05 +00:00
|
|
|
/*
|
|
|
|
* We have 3 or more address octets.
|
|
|
|
*
|
|
|
|
* The third octet contains 7 more bits of DLCI if EA isn't set,
|
|
|
|
* and lower DLCI or DL-CORE control plus the DLCI or DL-CORE
|
|
|
|
* control indicator flag if EA is set.
|
|
|
|
*/
|
|
|
|
fr_octet = tvb_get_guint8(tvb, offset);
|
|
|
|
if (!(fr_octet & FRELAY_EA)) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* 7 more bits of DLCI.
|
|
|
|
*/
|
|
|
|
addr = (addr << 7) | ((fr_octet & FRELAY_THIRD_DLCI) >> 1);
|
|
|
|
if (tree) {
|
|
|
|
octet_item = proto_tree_add_text(fr_tree, tvb, offset, 1,
|
|
|
|
"Third address octet: 0x%02x",
|
|
|
|
fr_octet);
|
|
|
|
octet_tree = proto_item_add_subtree(octet_item, ett_fr_address);
|
|
|
|
proto_tree_add_uint(octet_tree, hf_fr_third_dlci, tvb, offset, 1, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_ea, tvb, offset, 1, fr_octet);
|
|
|
|
}
|
|
|
|
offset++;
|
|
|
|
fr_octet = tvb_get_guint8(tvb, offset);
|
|
|
|
while (!(fr_octet & FRELAY_EA)) {
|
|
|
|
/*
|
|
|
|
* Bogus! More than 4 octets of address.
|
|
|
|
*/
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_text(fr_tree, tvb, offset, 1,
|
|
|
|
"Bogus extra address octet");
|
|
|
|
}
|
|
|
|
offset++;
|
|
|
|
fr_octet = tvb_get_guint8(tvb, offset);
|
|
|
|
}
|
2009-03-27 07:17:05 +00:00
|
|
|
}
|
|
|
|
if (tree) {
|
2012-05-03 19:31:03 +00:00
|
|
|
octet_item = proto_tree_add_text(fr_tree, tvb, offset, 1,
|
|
|
|
"Final address octet: 0x%02x",
|
|
|
|
fr_octet);
|
|
|
|
octet_tree = proto_item_add_subtree(octet_item, ett_fr_address);
|
2010-09-23 21:46:31 +00:00
|
|
|
}
|
2003-09-02 18:33:11 +00:00
|
|
|
|
2009-03-27 07:17:05 +00:00
|
|
|
/*
|
|
|
|
* Last octet - contains lower DLCI or DL-CORE control, DLCI or
|
|
|
|
* DL-CORE control indicator flag.
|
|
|
|
*/
|
|
|
|
if (fr_octet & FRELAY_DC) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* DL-CORE.
|
|
|
|
*/
|
|
|
|
proto_tree_add_uint(octet_tree, hf_fr_dlcore_control, tvb, offset, 1, fr_octet);
|
2009-03-27 07:17:05 +00:00
|
|
|
} else {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* Last 6 bits of DLCI.
|
|
|
|
*/
|
|
|
|
addr = (addr << 6) | ((fr_octet & FRELAY_LOWER_DLCI) >> 2);
|
|
|
|
proto_tree_add_uint(octet_tree, hf_fr_lower_dlci, tvb, offset, 1, fr_octet);
|
2009-03-27 07:17:05 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_dc, tvb, offset, 1, fr_octet);
|
|
|
|
proto_tree_add_boolean(octet_tree, hf_fr_ea, tvb, offset, 1, fr_octet);
|
2010-09-23 21:46:31 +00:00
|
|
|
|
2009-03-27 07:17:05 +00:00
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tree) {
|
|
|
|
/* Put the full DLCI into the protocol tree. */
|
|
|
|
proto_tree_add_uint(fr_tree, hf_fr_dlci, tvb, 0, offset, addr);
|
2003-09-02 18:33:11 +00:00
|
|
|
}
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2009-03-27 07:17:05 +00:00
|
|
|
pinfo->ctype = CT_DLCI;
|
|
|
|
pinfo->circuit_id = addr;
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2013-06-14 01:02:11 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", addr);
|
2009-03-27 07:17:05 +00:00
|
|
|
}
|
2001-03-23 19:22:02 +00:00
|
|
|
|
2003-09-03 22:26:38 +00:00
|
|
|
switch (fr_encap) {
|
|
|
|
|
|
|
|
case FRF_3_2:
|
|
|
|
fr_ctrl = tvb_get_guint8(tvb, offset);
|
|
|
|
if (fr_ctrl == XDLC_U) {
|
2003-09-02 19:18:52 +00:00
|
|
|
dissect_xdlc_control(tvb, offset, pinfo, fr_tree, hf_fr_control,
|
2012-05-03 19:31:03 +00:00
|
|
|
ett_fr_control, &fr_cf_items, &fr_cf_items_ext,
|
|
|
|
NULL, NULL, is_response, TRUE, TRUE);
|
2001-01-10 09:07:35 +00:00
|
|
|
offset++;
|
|
|
|
|
2003-10-17 23:43:21 +00:00
|
|
|
/*
|
|
|
|
* XXX - treat DLCI 0 specially? On DLCI 0, an NLPID of 0x08
|
|
|
|
* means Q.933, but on other circuits it could be the "for
|
|
|
|
* protocols which do not have an NLPID assigned or do not
|
|
|
|
* have a SNAP encapsulation" stuff from RFC 2427.
|
|
|
|
*/
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
dissect_fr_nlpid(tvb, offset, pinfo, tree, ti, fr_tree, fr_ctrl);
|
2003-09-03 22:26:38 +00:00
|
|
|
} else {
|
2008-06-27 16:15:30 +00:00
|
|
|
if (addr == 0) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/*
|
|
|
|
* This must be some sort of LAPF on DLCI 0 for SVC
|
|
|
|
* because DLCI 0 is reserved for LMI and SVC signaling
|
|
|
|
* encapsulated in LAPF, and LMI is transmitted in
|
|
|
|
* unnumbered information (03), so this must be LAPF
|
|
|
|
* (guessing).
|
|
|
|
*
|
|
|
|
* XXX - but what is it? Is Q.933 carried inside UI
|
|
|
|
* frames or other types of frames or both?
|
|
|
|
*/
|
|
|
|
dissect_xdlc_control(tvb, offset, pinfo, fr_tree,
|
|
|
|
hf_fr_control, ett_fr_control,
|
|
|
|
&fr_cf_items, &fr_cf_items_ext,
|
|
|
|
NULL, NULL, is_response, TRUE, TRUE);
|
|
|
|
dissect_lapf(tvb_new_subset_remaining(tvb,offset),pinfo,tree);
|
|
|
|
return;
|
2001-01-10 09:07:35 +00:00
|
|
|
}
|
|
|
|
if (fr_ctrl == (XDLC_U|XDLC_XID)) {
|
2012-05-03 19:31:03 +00:00
|
|
|
dissect_xdlc_control(tvb, offset, pinfo, fr_tree,
|
|
|
|
hf_fr_control, ett_fr_control,
|
|
|
|
&fr_cf_items, &fr_cf_items_ext,
|
|
|
|
NULL, NULL, is_response, TRUE, TRUE);
|
|
|
|
dissect_fr_xid(tvb_new_subset_remaining(tvb,offset),pinfo,tree);
|
|
|
|
return;
|
2001-01-10 09:07:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the data does not start with unnumbered information (03) and
|
|
|
|
* the DLCI# is not 0, then there may be Cisco Frame Relay encapsulation.
|
|
|
|
*/
|
Add a new Wiretap encapsulation type for Cisco HDLC. Map the NetBSD
DLT_HDLC to it.
Make a separate dissector for Cisco HDLC, and add a dissector for Cisco
SLARP. Have the PPP dissector call the Cisco HDLC dissector if the
address field is the Cisco HDLC unicast or multicast address. Use the
Cisco HDLC dissector for the Cisco HDLC Wiretap encapsulation type.
Add a new dissector table "chdlctype", for Cisco HDLC packet types
(they're *almost* the same as Ethernet types, but 0x8035 is SLARP, not
Reverse ARP, and 0x2000 is the Cisco Discovery protocol, for example),
replacing "fr.chdlc".
Have a "chdlctype()" routine, similar to "ethertype()", used both by the
Cisco HDLC and Frame Relay dissectors. Have a "chdlc_vals[]"
"value_string" table for Cisco HDLC types and protocol names. Split the
packet type field in the Frame Relay dissector into separate SNAP and
Cisco HDLC fields, and give them the Ethernet type and Cisco HDLC type
"value_string" tables, respectively.
svn path=/trunk/; revision=3133
2001-03-15 09:11:03 +00:00
|
|
|
fr_type = tvb_get_ntohs(tvb, offset);
|
2001-03-30 11:14:41 +00:00
|
|
|
if (ti != NULL) {
|
2012-05-03 19:31:03 +00:00
|
|
|
/* Include the Cisco HDLC type in the top-level protocol
|
|
|
|
tree item. */
|
|
|
|
proto_item_set_end(ti, tvb, offset+2);
|
2001-03-30 11:14:41 +00:00
|
|
|
}
|
Add a new Wiretap encapsulation type for Cisco HDLC. Map the NetBSD
DLT_HDLC to it.
Make a separate dissector for Cisco HDLC, and add a dissector for Cisco
SLARP. Have the PPP dissector call the Cisco HDLC dissector if the
address field is the Cisco HDLC unicast or multicast address. Use the
Cisco HDLC dissector for the Cisco HDLC Wiretap encapsulation type.
Add a new dissector table "chdlctype", for Cisco HDLC packet types
(they're *almost* the same as Ethernet types, but 0x8035 is SLARP, not
Reverse ARP, and 0x2000 is the Cisco Discovery protocol, for example),
replacing "fr.chdlc".
Have a "chdlctype()" routine, similar to "ethertype()", used both by the
Cisco HDLC and Frame Relay dissectors. Have a "chdlc_vals[]"
"value_string" table for Cisco HDLC types and protocol names. Split the
packet type field in the Frame Relay dissector into separate SNAP and
Cisco HDLC fields, and give them the Ethernet type and Cisco HDLC type
"value_string" tables, respectively.
svn path=/trunk/; revision=3133
2001-03-15 09:11:03 +00:00
|
|
|
chdlctype(fr_type, tvb, offset+2, pinfo, tree, fr_tree, hf_fr_chdlctype);
|
2003-09-03 22:26:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GPRS_NS:
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2012-12-20 21:18:26 +00:00
|
|
|
call_dissector(gprs_ns_handle, next_tvb, pinfo, tree);
|
2003-09-03 22:26:38 +00:00
|
|
|
break;
|
2003-09-06 12:31:32 +00:00
|
|
|
|
|
|
|
case RAW_ETHER:
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2008-06-27 16:15:30 +00:00
|
|
|
if (addr != 0)
|
2004-11-24 09:13:52 +00:00
|
|
|
call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree);
|
2003-09-06 12:31:32 +00:00
|
|
|
else
|
|
|
|
dissect_lapf(next_tvb, pinfo, tree);
|
|
|
|
break;
|
2001-01-07 22:08:31 +00:00
|
|
|
}
|
2001-01-10 09:07:35 +00:00
|
|
|
}
|
|
|
|
|
2003-09-02 18:45:06 +00:00
|
|
|
static void
|
|
|
|
dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2009-03-27 07:17:05 +00:00
|
|
|
dissect_fr_common(tvb, pinfo, tree, FALSE, TRUE );
|
2003-09-02 18:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_fr_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2009-03-27 07:17:05 +00:00
|
|
|
dissect_fr_common(tvb, pinfo, tree, TRUE, TRUE );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_fr_stripped_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
dissect_fr_common(tvb, pinfo, tree, TRUE, FALSE );
|
2003-09-02 18:45:06 +00:00
|
|
|
}
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
|
2012-05-03 19:31:03 +00:00
|
|
|
static void
|
|
|
|
dissect_fr_uncompressed(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
|
proto_tree *tree)
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
{
|
2014-06-26 02:59:50 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *fr_tree;
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FR");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
|
2014-06-26 02:59:50 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_fr, tvb, 0, -1, "Frame Relay");
|
|
|
|
fr_tree = proto_item_add_subtree(ti, ett_fr);
|
|
|
|
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
dissect_fr_nlpid(tvb, 0, pinfo, tree, ti, fr_tree, XDLC_U);
|
|
|
|
}
|
|
|
|
|
2012-05-03 19:31:03 +00:00
|
|
|
static void
|
|
|
|
dissect_fr_nlpid(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, proto_item *ti,
|
|
|
|
proto_tree *fr_tree, guint8 fr_ctrl)
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
{
|
2012-05-03 19:31:03 +00:00
|
|
|
guint8 fr_nlpid;
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
|
2003-09-02 18:33:11 +00:00
|
|
|
/*
|
|
|
|
* Tentatively set the Frame Relay item not to include the NLPID,
|
|
|
|
* as OSI network layer protocols consider it to be part of
|
|
|
|
* the OSI PDU.
|
|
|
|
*/
|
|
|
|
proto_item_set_end(ti, tvb, offset);
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
fr_nlpid = tvb_get_guint8 (tvb,offset);
|
|
|
|
if (fr_nlpid == 0) {
|
2012-05-03 19:31:03 +00:00
|
|
|
if (tree)
|
|
|
|
proto_tree_add_text(fr_tree, tvb, offset, 1, "Padding");
|
|
|
|
offset++;
|
|
|
|
if (ti != NULL) {
|
|
|
|
/* Include the padding in the top-level protocol tree item. */
|
|
|
|
proto_item_set_end(ti, tvb, offset);
|
|
|
|
}
|
|
|
|
fr_nlpid=tvb_get_guint8( tvb,offset);
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OSI network layer protocols consider the NLPID to be part
|
|
|
|
* of the frame, so we'll pass it as part of the payload and,
|
|
|
|
* if the protocol is one of those, add it as a hidden item here.
|
2003-09-03 05:39:21 +00:00
|
|
|
* We check both the generic OSI NLPID dissector table and
|
|
|
|
* the Frame Relay OSI NLPID dissector table - the latter is for
|
|
|
|
* NLPID's such as 0x08, which is Q.933 in Frame Relay but
|
|
|
|
* other protocols (e.g., Q.931) on other network layers.
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
*
|
2003-10-17 23:43:21 +00:00
|
|
|
* "OSI network layer protocols" includes Q.933.
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
*
|
2003-10-17 23:43:21 +00:00
|
|
|
* XXX - note that an NLPID of 0x08 for Q.933 could either be a
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
* Q.933 signaling message or a message for a protocol
|
|
|
|
* identified by a 2-octet layer 2 protocol type and a
|
|
|
|
* 2-octet layer 3 protocol type, those protocol type
|
|
|
|
* octets having the values from octets 6, 6a, 7, and 7a
|
|
|
|
* of a Q.931 low layer compatibility information element
|
|
|
|
* (section 4.5.19 of Q.931; Q.933 says they have the values
|
|
|
|
* from a Q.933 low layer compatibility information element,
|
|
|
|
* but Q.933 low layer compatibility information elements
|
|
|
|
* don't have protocol values in them).
|
|
|
|
*
|
|
|
|
* Assuming that, as Q.933 seems to imply, that Q.933 messages
|
|
|
|
* look just like Q.931 messages except where it explicitly
|
|
|
|
* says they differ, then the octet after the NLPID would,
|
|
|
|
* in a Q.933 message, have its upper 4 bits zero (that's
|
|
|
|
* the length of the call reference value, in Q.931, and
|
|
|
|
* is limited to 15 or fewer octets). As appears to be the case,
|
|
|
|
* octet 6 of a Q.931 low layer compatibility element has the
|
|
|
|
* 0x40 bit set, so you can distinguish between a Q.933
|
|
|
|
* message and an encapsulated packet by checking whether
|
|
|
|
* the upper 4 bits of the octet after the NLPID are zero.
|
|
|
|
*
|
2003-10-17 23:43:21 +00:00
|
|
|
* Either that, or it's Q.933 iff the DLCI is 0.
|
|
|
|
*/
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb,offset);
|
2013-09-12 20:34:19 +00:00
|
|
|
if (dissector_try_uint(osinl_incl_subdissector_table, fr_nlpid, next_tvb,
|
2012-05-03 19:31:03 +00:00
|
|
|
pinfo, tree) ||
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_try_uint(fr_osinl_subdissector_table, fr_nlpid, next_tvb,
|
2012-05-03 19:31:03 +00:00
|
|
|
pinfo, tree)) {
|
|
|
|
/*
|
|
|
|
* Yes, we got a match. Add the NLPID as a hidden item,
|
|
|
|
* so you can, at least, filter on it.
|
|
|
|
*/
|
|
|
|
if (tree) {
|
|
|
|
proto_item *hidden_item;
|
|
|
|
hidden_item = proto_tree_add_uint(fr_tree, hf_fr_nlpid,
|
|
|
|
tvb, offset, 1, fr_nlpid );
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
}
|
|
|
|
return;
|
2003-10-17 23:43:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All other protocols don't.
|
|
|
|
*
|
|
|
|
* XXX - what about Cisco/Gang-of-Four LMI? Is the 0x09 considered
|
|
|
|
* to be part of the LMI PDU?
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
*/
|
|
|
|
if (tree)
|
2012-05-03 19:31:03 +00:00
|
|
|
proto_tree_add_uint(fr_tree, hf_fr_nlpid, tvb, offset, 1, fr_nlpid );
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
switch (fr_nlpid) {
|
|
|
|
|
|
|
|
case NLPID_SNAP:
|
2012-05-03 19:31:03 +00:00
|
|
|
if (ti != NULL) {
|
|
|
|
/* Include the NLPID and SNAP header in the top-level
|
|
|
|
protocol tree item. */
|
|
|
|
proto_item_set_end(ti, tvb, offset+5);
|
|
|
|
}
|
|
|
|
dissect_snap(tvb, offset, pinfo, tree, fr_tree, fr_ctrl,
|
|
|
|
hf_fr_oui, hf_fr_snaptype, hf_fr_pid, 0);
|
|
|
|
return;
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
|
|
|
|
default:
|
2012-05-03 19:31:03 +00:00
|
|
|
if (ti != NULL) {
|
|
|
|
/* Include the NLPID in the top-level protocol tree item. */
|
|
|
|
proto_item_set_end(ti, tvb, offset);
|
|
|
|
}
|
|
|
|
next_tvb = tvb_new_subset_remaining(tvb,offset);
|
|
|
|
if (!dissector_try_uint(fr_subdissector_table,fr_nlpid,
|
|
|
|
next_tvb, pinfo, tree))
|
|
|
|
call_dissector(data_handle,next_tvb, pinfo, tree);
|
|
|
|
break;
|
NLPID's of 0x08 and 0x09 should be labeled as Q.933 and LMI,
respectively, not Q.931 and Q.2931, in Frame Relay.
When dissecting Q.933-style multiprotocol encapsulated Frame Relay
frames, use the "osinl" dissector table to check for OSI network layer
protocols, include the NLPID in the tvbuff you hand to
"dissector_try_port()" with that dissector table, and put the NLPID into
the protocol tree as an invisible item - the NLPID is considered part of
the PDU for those protocols, so you have to include it in the tvbuff,
and the dissector will put it into the protocol tree.
Also, make sure the top-level entry for the Frame Relay protocol
includes all the bytes preceding the payload, and none of the payload
bytes.
Export a routine to do Q.933-style dissection, and have the WCP
dissector call it, rather than duplicating that code in the WCP
dissector.
Don't register OSI network layer protocols with the "fr.ietf" dissector
table; it's now sufficient to register them with the "osinl" dissector
table, as the Frame Relay dissector now checks that.
Get rid of unnecessary checks for protocols being enabled (if the
dissector is always called through handles or dissector tables, the
common code for handles and dissector tables will do the checks for
you).
Get rid of some unnecessary #includes.
svn path=/trunk/; revision=3211
2001-03-30 10:51:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-03 19:31:03 +00:00
|
|
|
static void
|
|
|
|
dissect_lapf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2001-01-10 09:07:35 +00:00
|
|
|
{
|
2012-05-03 19:31:03 +00:00
|
|
|
proto_tree_add_text(tree, tvb, 0, 0, "Frame relay lapf not yet implemented");
|
|
|
|
call_dissector(data_handle,tvb_new_subset_remaining(tvb,0),pinfo,tree);
|
2001-01-10 09:07:35 +00:00
|
|
|
}
|
2012-05-03 19:31:03 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_fr_xid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2001-01-10 09:07:35 +00:00
|
|
|
{
|
2012-05-03 19:31:03 +00:00
|
|
|
proto_tree_add_text(tree, tvb, 0, 0, "Frame relay xid not yet implemented");
|
|
|
|
call_dissector(data_handle,tvb_new_subset_remaining(tvb,0),pinfo,tree);
|
2001-01-07 22:08:31 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2006-05-21 04:49:01 +00:00
|
|
|
/* Register the protocol with Wireshark */
|
2012-05-03 19:31:03 +00:00
|
|
|
void
|
|
|
|
proto_register_fr(void)
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2001-01-07 22:08:31 +00:00
|
|
|
static hf_register_info hf[] = {
|
2012-05-03 19:31:03 +00:00
|
|
|
{ &hf_fr_ea,
|
|
|
|
{ "EA", "fr.ea",
|
|
|
|
FT_BOOLEAN, 8, TFS(&ea_string), FRELAY_EA,
|
|
|
|
"Extended Address", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_upper_dlci,
|
|
|
|
{ "Upper DLCI", "fr.upper_dlci",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, FRELAY_UPPER_DLCI,
|
|
|
|
"Upper bits of DLCI", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_cr,
|
|
|
|
{ "CR", "fr.cr",
|
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_command_response), FRELAY_CR,
|
|
|
|
"Command/Response", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_second_dlci,
|
|
|
|
{ "Second DLCI", "fr.second_dlci",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, FRELAY_SECOND_DLCI,
|
|
|
|
"Bits below upper bits of DLCI", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_fecn,
|
|
|
|
{ "FECN", "fr.fecn",
|
|
|
|
FT_BOOLEAN, 8, NULL, FRELAY_FECN,
|
|
|
|
"Forward Explicit Congestion Notification", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_becn,
|
|
|
|
{ "BECN", "fr.becn",
|
|
|
|
FT_BOOLEAN, 8, NULL, FRELAY_BECN,
|
|
|
|
"Backward Explicit Congestion Notification", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_de,
|
|
|
|
{ "DE", "fr.de",
|
|
|
|
FT_BOOLEAN, 8, NULL, FRELAY_DE,
|
|
|
|
"Discard Eligibility", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_third_dlci,
|
|
|
|
{ "Third DLCI", "fr.third_dlci",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, FRELAY_THIRD_DLCI,
|
|
|
|
"Additional bits of DLCI", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_dlcore_control,
|
|
|
|
{ "DL-CORE Control", "fr.dlcore_control",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, FRELAY_LOWER_DLCI,
|
|
|
|
"DL-Core control bits", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_lower_dlci,
|
|
|
|
{ "Lower DLCI", "fr.lower_dlci",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, FRELAY_LOWER_DLCI,
|
|
|
|
"Lower bits of DLCI", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_dc,
|
|
|
|
{ "DC", "fr.dc",
|
|
|
|
FT_BOOLEAN, 16, TFS(&ctrl_string), FRELAY_CR,
|
|
|
|
"Address/Control", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_dlci,
|
|
|
|
{ "DLCI", "fr.dlci",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Data-Link Connection Identifier", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_control,
|
|
|
|
{ "Control Field", "fr.control",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_n_r,
|
|
|
|
{ "N(R)", "fr.control.n_r",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, XDLC_N_R_EXT_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_n_s,
|
|
|
|
{ "N(S)", "fr.control.n_s",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, XDLC_N_S_EXT_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_p,
|
|
|
|
{ "Poll", "fr.control.p",
|
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), XDLC_P_F,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_p_ext,
|
|
|
|
{ "Poll", "fr.control.p",
|
|
|
|
FT_BOOLEAN, 16, TFS(&tfs_set_notset), XDLC_P_F_EXT,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_f,
|
|
|
|
{ "Final", "fr.control.f",
|
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), XDLC_P_F,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_f_ext,
|
|
|
|
{ "Final", "fr.control.f",
|
|
|
|
FT_BOOLEAN, 16, TFS(&tfs_set_notset), XDLC_P_F_EXT,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_s_ftype,
|
|
|
|
{ "Supervisory frame type", "fr.control.s_ftype",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(stype_vals), XDLC_S_FTYPE_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_u_modifier_cmd,
|
|
|
|
{ "Command", "fr.control.u_modifier_cmd",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(modifier_vals_cmd), XDLC_U_MODIFIER_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_u_modifier_resp,
|
|
|
|
{ "Response", "fr.control.u_modifier_resp",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(modifier_vals_resp), XDLC_U_MODIFIER_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_ftype_i,
|
|
|
|
{ "Frame type", "fr.control.ftype",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(ftype_vals), XDLC_I_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_ftype_s_u,
|
|
|
|
{ "Frame type", "fr.control.ftype",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(ftype_vals), XDLC_S_U_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_ftype_s_u_ext,
|
|
|
|
{ "Frame type", "fr.control.ftype",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(ftype_vals), XDLC_S_U_MASK,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_nlpid,
|
|
|
|
{ "NLPID", "fr.nlpid",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(fr_nlpid_vals), 0x0,
|
|
|
|
"Frame Relay Encapsulated Protocol NLPID", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_oui,
|
|
|
|
{ "Organization Code", "fr.snap.oui",
|
|
|
|
FT_UINT24, BASE_HEX, VALS(oui_vals), 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_pid,
|
|
|
|
{ "Protocol ID", "fr.snap.pid",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_snaptype,
|
|
|
|
{ "Type", "fr.snaptype",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
|
|
|
|
"Frame Relay SNAP Encapsulated Protocol", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_fr_chdlctype,
|
|
|
|
{ "Type", "fr.chdlctype",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(chdlc_vals), 0x0,
|
|
|
|
"Frame Relay Cisco HDLC Encapsulated Protocol", HFILL }},
|
|
|
|
|
2001-01-07 22:08:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_fr,
|
2003-09-02 18:33:11 +00:00
|
|
|
&ett_fr_address,
|
2003-09-02 19:18:52 +00:00
|
|
|
&ett_fr_control,
|
2001-01-07 22:08:31 +00:00
|
|
|
};
|
2012-11-29 20:15:37 +00:00
|
|
|
static const enum_val_t fr_encap_options[] = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "frf-3.2", "FRF 3.2/Cisco HDLC", FRF_3_2 },
|
|
|
|
{ "gprs-ns", "GPRS Network Service", GPRS_NS },
|
|
|
|
{ "ethernet", "Raw Ethernet", RAW_ETHER },
|
|
|
|
{ NULL, NULL, 0 },
|
2003-09-03 22:26:38 +00:00
|
|
|
};
|
|
|
|
module_t *frencap_module;
|
2001-01-07 22:08:31 +00:00
|
|
|
|
|
|
|
proto_fr = proto_register_protocol("Frame Relay", "FR", "fr");
|
|
|
|
proto_register_field_array(proto_fr, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2013-09-11 21:55:00 +00:00
|
|
|
fr_subdissector_table = register_dissector_table("fr.nlpid",
|
2012-05-03 19:31:03 +00:00
|
|
|
"Frame Relay NLPID", FT_UINT8, BASE_HEX);
|
2003-09-03 05:39:21 +00:00
|
|
|
fr_osinl_subdissector_table = register_dissector_table("fr.osinl",
|
2012-05-03 19:31:03 +00:00
|
|
|
"Frame Relay OSI NLPID", FT_UINT8, BASE_HEX);
|
2001-11-27 07:13:32 +00:00
|
|
|
|
2002-07-31 19:27:57 +00:00
|
|
|
register_dissector("fr_uncompressed", dissect_fr_uncompressed, proto_fr);
|
|
|
|
register_dissector("fr", dissect_fr, proto_fr);
|
2009-03-27 07:17:05 +00:00
|
|
|
register_dissector("fr_stripped_address", dissect_fr_stripped_address, proto_fr);
|
2003-09-03 22:26:38 +00:00
|
|
|
|
|
|
|
frencap_module = prefs_register_protocol(proto_fr, NULL);
|
2004-11-24 09:13:52 +00:00
|
|
|
/*
|
|
|
|
* XXX - this should really be per-circuit - I've seen at least one
|
|
|
|
* capture where different DLCIs have different encapsulations - but
|
|
|
|
* we don't yet have any support for per-circuit encapsulations.
|
|
|
|
*
|
|
|
|
* Even with that, though, we might want a default encapsulation,
|
|
|
|
* so that people dealing with GPRS can make gprs-ns the default.
|
|
|
|
*/
|
2003-09-03 22:26:38 +00:00
|
|
|
prefs_register_enum_preference(frencap_module, "encap", "Encapsulation",
|
2012-05-03 19:31:03 +00:00
|
|
|
"Encapsulation", &fr_encap,
|
|
|
|
fr_encap_options, FALSE);
|
2001-01-13 07:47:49 +00:00
|
|
|
}
|
2001-01-08 22:18:22 +00:00
|
|
|
|
2012-05-03 19:31:03 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_fr(void)
|
2001-01-08 22:18:22 +00:00
|
|
|
{
|
2003-09-02 18:45:06 +00:00
|
|
|
dissector_handle_t fr_handle, fr_phdr_handle;
|
2001-12-03 04:00:26 +00:00
|
|
|
|
2008-09-30 14:49:44 +00:00
|
|
|
fr_handle = find_dissector("fr");
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("gre.proto", ETHERTYPE_RAW_FR, fr_handle);
|
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_FRELAY, fr_handle);
|
2003-09-02 18:45:06 +00:00
|
|
|
|
|
|
|
fr_phdr_handle = create_dissector_handle(dissect_fr_phdr, proto_fr);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_FRELAY_WITH_PHDR, fr_phdr_handle);
|
2003-09-03 22:26:38 +00:00
|
|
|
|
2004-11-24 09:13:52 +00:00
|
|
|
eth_withfcs_handle = find_dissector("eth_withfcs");
|
2003-09-03 22:26:38 +00:00
|
|
|
gprs_ns_handle = find_dissector("gprs_ns");
|
2001-11-26 01:03:35 +00:00
|
|
|
data_handle = find_dissector("data");
|
2003-04-29 17:56:49 +00:00
|
|
|
|
2013-09-12 20:34:19 +00:00
|
|
|
osinl_incl_subdissector_table = find_dissector_table("osinl.incl");
|
2001-01-08 22:18:22 +00:00
|
|
|
}
|