aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-03-30 06:10:54 +0000
committerGuy Harris <guy@alum.mit.edu>2001-03-30 06:10:54 +0000
commit949888c04a7a85b847da144d14bf51eedb5bad94 (patch)
tree7b517fc86bf7ab944a63d61eb54f9c9c8c11df1c
parente30bc52b6af6cd5975885c4bcd7221d9d9a50650 (diff)
Call the dissector for PPP-in-HDLC-like-framing (RFC 1662) the
"ppp_hdlc" dissector, and call the dissector for "raw" PPP (just RFC 1661, no HDLC encapsulation) the "ppp" dissector. Have the common routine used by both those dissectors take the offset in the tvbuff of the PPP protocol field as an argument, rather than assuming that the protocol field begins at the beginning of the tvbuff, so we don't have to construct a new tvbuff in the PPP-in-HDLC-like-framing dissector. Use the PPP dissector, not the PPP-in-HDLC-like-framing dissector, for PPP over Frame Relay - there's no HDLC header in PPP over Frame Relay, at least according to http://www.cisco.com/univercd/cc/td/doc/product/software/ios120/120newft/120t/120t1/pppframe.htm svn path=/trunk/; revision=3208
-rw-r--r--packet-ascend.c10
-rw-r--r--packet-l2tp.c10
-rw-r--r--packet-null.c10
-rw-r--r--packet-ppp.c45
-rw-r--r--packet-pppoe.c10
-rw-r--r--packet-raw.c14
6 files changed, 46 insertions, 53 deletions
diff --git a/packet-ascend.c b/packet-ascend.c
index d9f4e23aaf..ce351ce6b2 100644
--- a/packet-ascend.c
+++ b/packet-ascend.c
@@ -1,7 +1,7 @@
/* packet-ascend.c
* Routines for decoding Lucent/Ascend packet traces
*
- * $Id: packet-ascend.c,v 1.24 2001/01/25 06:14:13 guy Exp $
+ * $Id: packet-ascend.c,v 1.25 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -50,7 +50,7 @@ static const value_string encaps_vals[] = {
{0, NULL } };
static dissector_handle_t eth_handle;
-static dissector_handle_t ppp_handle;
+static dissector_handle_t ppp_hdlc_handle;
static void
dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -97,7 +97,7 @@ dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pseudo_header->ascend.type) {
case ASCEND_PFX_WDS_X:
case ASCEND_PFX_WDS_R:
- call_dissector(ppp_handle, tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, tvb, pinfo, tree);
break;
case ASCEND_PFX_WDD:
call_dissector(eth_handle, tvb, pinfo, tree);
@@ -149,9 +149,9 @@ void
proto_reg_handoff_ascend(void)
{
/*
- * Get handles for the Ethernet and PPP dissectors.
+ * Get handles for the Ethernet and PPP-in-HDLC-like-framing dissectors.
*/
eth_handle = find_dissector("eth");
- ppp_handle = find_dissector("ppp");
+ ppp_hdlc_handle = find_dissector("ppp_hdlc");
dissector_add("wtap_encap", WTAP_ENCAP_ASCEND, dissect_ascend, proto_ascend);
}
diff --git a/packet-l2tp.c b/packet-l2tp.c
index 13b5a7a931..a5be3a8310 100644
--- a/packet-l2tp.c
+++ b/packet-l2tp.c
@@ -7,7 +7,7 @@
* Laurent Cazalet <laurent.cazalet@mailclub.net>
* Thomas Parvais <thomas.parvais@advalvas.be>
*
- * $Id: packet-l2tp.c,v 1.21 2001/01/25 06:14:14 guy Exp $
+ * $Id: packet-l2tp.c,v 1.22 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -261,7 +261,7 @@ static const char *avptypestr[NUM_AVP_TYPES] = {
static gchar textbuffer[200];
-static dissector_handle_t ppp_handle;
+static dissector_handle_t ppp_hdlc_handle;
static void
dissect_l2tp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -439,7 +439,7 @@ dissect_l2tp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* If we have data, signified by having a length bit, dissect it */
if (tvb_offset_exists(tvb, index)) {
next_tvb = tvb_new_subset(tvb, index, -1, proto_length - index);
- call_dissector(ppp_handle, next_tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree);
}
return;
}
@@ -834,7 +834,7 @@ proto_reg_handoff_l2tp(void)
proto_l2tp);
/*
- * Get a handle for the PPP dissector.
+ * Get a handle for the PPP-in-HDLC-like-framing dissector.
*/
- ppp_handle = find_dissector("ppp");
+ ppp_hdlc_handle = find_dissector("ppp_hdlc");
}
diff --git a/packet-null.c b/packet-null.c
index c857cde8c1..aa163a9dba 100644
--- a/packet-null.c
+++ b/packet-null.c
@@ -1,7 +1,7 @@
/* packet-null.c
* Routines for null packet disassembly
*
- * $Id: packet-null.c,v 1.41 2001/03/22 16:24:14 gram Exp $
+ * $Id: packet-null.c,v 1.42 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -74,7 +74,7 @@ static const value_string family_vals[] = {
{0, NULL }
};
-static dissector_handle_t ppp_handle;
+static dissector_handle_t ppp_hdlc_handle;
void
capture_null( const u_char *pd, packet_counts *ld )
@@ -225,7 +225,7 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Hand it to PPP.
*/
- call_dissector(ppp_handle, tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, tvb, pinfo, tree);
} else {
/* load the top pane info. This should be overwritten by
@@ -315,8 +315,8 @@ void
proto_reg_handoff_null(void)
{
/*
- * Get a handle for the PPP dissector.
+ * Get a handle for the PPP-in-HDLC-like-framing dissector.
*/
- ppp_handle = find_dissector("ppp");
+ ppp_hdlc_handle = find_dissector("ppp_hdlc");
dissector_add("wtap_encap", WTAP_ENCAP_NULL, dissect_null, proto_null);
}
diff --git a/packet-ppp.c b/packet-ppp.c
index da71cf4b86..3f52f9c6cc 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.58 2001/03/29 09:18:34 guy Exp $
+ * $Id: packet-ppp.c,v 1.59 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -522,7 +522,7 @@ static const ip_tcp_opt ipcp_opts[] = {
#define N_IPCP_OPTS (sizeof ipcp_opts / sizeof ipcp_opts[0])
-static void dissect_payload_ppp(tvbuff_t *tvb, packet_info *pinfo,
+static void dissect_ppp(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree);
const unsigned int fcstab_32[256] =
@@ -1157,20 +1157,20 @@ dissect_cp( tvbuff_t *tvb, int proto_id, int proto_subtree_index,
#define PFC_BIT 0x01
static void
-dissect_ppp_stuff( tvbuff_t *tvb, packet_info *pinfo,
+dissect_ppp_common( tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, proto_tree *fh_tree,
proto_item *ti ) {
guint16 ppp_prot;
int proto_len;
tvbuff_t *next_tvb;
- ppp_prot = tvb_get_guint8(tvb, 0);
+ ppp_prot = tvb_get_guint8(tvb, offset);
if (ppp_prot & PFC_BIT) {
/* Compressed protocol field - just the byte we fetched. */
proto_len = 1;
} else {
/* Uncompressed protocol field - fetch all of it. */
- ppp_prot = tvb_get_ntohs(tvb, 0);
+ ppp_prot = tvb_get_ntohs(tvb, offset);
proto_len = 2;
}
@@ -1182,11 +1182,11 @@ dissect_ppp_stuff( tvbuff_t *tvb, packet_info *pinfo,
proto_item_set_len(ti, proto_item_get_len(ti) + proto_len);
if (tree) {
- proto_tree_add_text(fh_tree, tvb, 0, proto_len, "Protocol: %s (0x%04x)",
+ proto_tree_add_text(fh_tree, tvb, offset, proto_len, "Protocol: %s (0x%04x)",
val_to_str(ppp_prot, ppp_vals, "Unknown"), ppp_prot);
}
- next_tvb = tvb_new_subset(tvb, proto_len, -1, -1);
+ next_tvb = tvb_new_subset(tvb, offset + proto_len, -1, -1);
/* do lookup with the subdissector table */
if (!dissector_try_port(subdissector_table, ppp_prot, next_tvb, pinfo, tree)) {
@@ -1276,15 +1276,15 @@ dissect_mp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_reported_length_remaining(tvb, 4) > 0) {
next_tvb = tvb_new_subset(tvb, 4, -1, -1);
- dissect_payload_ppp(next_tvb, pinfo, tree);
+ dissect_ppp(next_tvb, pinfo, tree);
}
}
/*
- * Handles PPP without HDLC headers, just a protocol field.
+ * Handles PPP without HDLC framing, just a protocol field (RFC 1661).
*/
static void
-dissect_payload_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
+dissect_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
proto_item *ti = NULL;
proto_tree *fh_tree = NULL;
@@ -1293,25 +1293,19 @@ dissect_payload_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
fh_tree = proto_item_add_subtree(ti, ett_ppp);
}
- dissect_ppp_stuff(tvb, pinfo, tree, fh_tree, ti);
+ dissect_ppp_common(tvb, 0, pinfo, tree, fh_tree, ti);
}
/*
- * Handles link-layer encapsulations where the frame might be:
- *
- * a PPP frame with no HDLC header;
- *
- * a PPP frame with an HDLC header (FF 03);
- *
- * a Cisco HDLC frame.
+ * Handles link-layer encapsulations where the frame might be
+ * a PPP in HDLC-like Framing frame (RFC 1662) or a Cisco HDLC frame.
*/
static void
-dissect_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
+dissect_ppp_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
proto_item *ti = NULL;
proto_tree *fh_tree = NULL;
guint8 byte0;
int proto_offset;
- tvbuff_t *next_tvb;
int rx_fcs_offset;
guint32 rx_fcs_exp;
guint32 rx_fcs_got;
@@ -1356,8 +1350,7 @@ dissect_ppp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
}
}
- next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1);
- dissect_ppp_stuff(next_tvb, pinfo, tree, fh_tree, ti);
+ dissect_ppp_common(tvb, proto_offset, pinfo, tree, fh_tree, ti);
/* Calculate the FCS check */
/* XXX - deal with packets cut off by the snapshot length */
@@ -1410,8 +1403,8 @@ proto_register_ppp(void)
/* subdissector code */
subdissector_table = register_dissector_table("ppp.protocol");
+ register_dissector("ppp_hdlc", dissect_ppp_hdlc, proto_ppp);
register_dissector("ppp", dissect_ppp, proto_ppp);
- register_dissector("payload_ppp", dissect_payload_ppp, proto_ppp);
/* Register the preferences for the ppp protocol */
ppp_module = prefs_register_protocol(proto_ppp, NULL);
@@ -1432,10 +1425,10 @@ proto_reg_handoff_ppp(void)
*/
chdlc_handle = find_dissector("chdlc");
- 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("wtap_encap", WTAP_ENCAP_PPP, dissect_ppp_hdlc, proto_ppp);
+ dissector_add("wtap_encap", WTAP_ENCAP_PPP_WITH_PHDR, dissect_ppp_hdlc, proto_ppp);
dissector_add("fr.ietf", NLPID_PPP, dissect_ppp, proto_ppp);
- dissector_add("gre.proto", ETHERTYPE_PPP, dissect_ppp, proto_ppp);
+ dissector_add("gre.proto", ETHERTYPE_PPP, dissect_ppp_hdlc, proto_ppp);
}
void
diff --git a/packet-pppoe.c b/packet-pppoe.c
index 58230d5050..d4958926a8 100644
--- a/packet-pppoe.c
+++ b/packet-pppoe.c
@@ -1,7 +1,7 @@
/* packet-pppoe.c
* Routines for PPP Over Ethernet (PPPoE) packet disassembly (RFC2516)
*
- * $Id: packet-pppoe.c,v 1.16 2001/01/21 22:51:46 guy Exp $
+ * $Id: packet-pppoe.c,v 1.17 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -43,7 +43,7 @@ static gint ett_pppoed_tags = -1;
static int proto_pppoes = -1;
-static dissector_handle_t payload_ppp_handle;
+static dissector_handle_t ppp_handle;
/* For lack of a better source, I made up the following defines. -jsj */
@@ -277,7 +277,7 @@ dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
* Im gonna try fudging it.
*/
next_tvb = tvb_new_subset(tvb,6,-1,-1);
- call_dissector(payload_ppp_handle,next_tvb,pinfo,tree);
+ call_dissector(ppp_handle,next_tvb,pinfo,tree);
}
void
proto_register_pppoes(void)
@@ -293,7 +293,7 @@ proto_reg_handoff_pppoes(void)
proto_pppoes);
/*
- * Get a handle for the PPP payload dissector.
+ * Get a handle for the PPP dissector.
*/
- payload_ppp_handle = find_dissector("payload_ppp");
+ ppp_handle = find_dissector("ppp");
}
diff --git a/packet-raw.c b/packet-raw.c
index 807e4aab9a..be9d2b0681 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.24 2001/01/09 06:31:40 guy Exp $
+ * $Id: packet-raw.c,v 1.25 2001/03/30 06:10:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -44,7 +44,7 @@ static gint ett_raw = -1;
static const char zeroes[10];
static dissector_handle_t ip_handle;
-static dissector_handle_t ppp_handle;
+static dissector_handle_t ppp_hdlc_handle;
void
capture_raw(const u_char *pd, packet_counts *ld)
@@ -114,20 +114,20 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* sometimes. This check should be removed when 2.2 is out.
*/
if (tvb_get_ntohs(tvb, 0) == 0xff03) {
- call_dissector(ppp_handle, tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, tvb, pinfo, tree);
return;
}
/* The Linux ISDN driver sends a fake MAC address before the PPP header
* on its ippp interfaces... */
else if (tvb_get_ntohs(tvb, 6) == 0xff03) {
next_tvb = tvb_new_subset(tvb, 6, -1, -1);
- call_dissector(ppp_handle, next_tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree);
return;
}
/* ...except when it just puts out one byte before the PPP header... */
else if (tvb_get_ntohs(tvb, 1) == 0xff03) {
next_tvb = tvb_new_subset(tvb, 1, -1, -1);
- call_dissector(ppp_handle, next_tvb, pinfo, tree);
+ call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree);
return;
}
/* ...and if the connection is currently down, it sends 10 bytes of zeroes
@@ -159,9 +159,9 @@ void
proto_reg_handoff_raw(void)
{
/*
- * Get handles for the IP and PPP dissectors.
+ * Get handles for the IP and PPP-in-HDLC-like-framing dissectors.
*/
ip_handle = find_dissector("ip");
- ppp_handle = find_dissector("ppp");
+ ppp_hdlc_handle = find_dissector("ppp_hdlc");
dissector_add("wtap_encap", WTAP_ENCAP_RAW_IP, dissect_raw, -1);
}