aboutsummaryrefslogtreecommitdiffstats
path: root/packet-gre.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-11-18 10:38:33 +0000
committerGuy Harris <guy@alum.mit.edu>2000-11-18 10:38:33 +0000
commitc8196a1d1ca5a5021388cfc1bcbb64cdda5e9dc3 (patch)
tree5e117f446c6e233d14b642596d67c985e685f328 /packet-gre.c
parent56a0c40c18271046d22bffcc5db10cfb16a2bf6c (diff)
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors. Register the IP dissector and have dissectors that call it directly (rather than through a port table) call it through a handle. Add a routine "tvb_set_reported_length()" which a dissector can use if it was handed a tvbuff that contains more data than is actually in its part of the packet - for example, handing a padded Ethernet frame to IP; the routine sets the reported length of the tvbuff (and also adjusts the actual length, as appropriate). Then use it in IP. Given that, "ethertype()" can determine how much of the Ethernet frame was actually part of an IP datagram (and can do the same for other protocols under Ethernet that use "tvb_set_reported_length()"; have it return the actual length, and have "dissect_eth()" and "dissect_vlan()" use that to mark trailer data in Ethernet II frames as well as in 802.3 frames. svn path=/trunk/; revision=2658
Diffstat (limited to 'packet-gre.c')
-rw-r--r--packet-gre.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/packet-gre.c b/packet-gre.c
index 2af23462a8..bcfc58b269 100644
--- a/packet-gre.c
+++ b/packet-gre.c
@@ -2,7 +2,7 @@
* Routines for the Generic Routing Encapsulation (GRE) protocol
* Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
*
- * $Id: packet-gre.c,v 1.26 2000/11/16 07:35:37 guy Exp $
+ * $Id: packet-gre.c,v 1.27 2000/11/18 10:38:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -74,6 +74,8 @@ static const value_string typevals[] = {
{ 0, NULL }
};
+static dissector_handle_t ip_handle;
+
static void
dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
@@ -212,14 +214,14 @@ dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_ppp(next_tvb, &pi, tree);
break;
case GRE_IP:
- dissect_ip(pd, offset, fd, tree);
+ old_call_dissector(ip_handle, pd, offset, fd, tree);
break;
case GRE_WCCP:
if (is_wccp2) {
proto_tree_add_text(gre_tree, NullTVB, offset, sizeof(guint32), "WCCPv2 Data");
offset += 4;
}
- dissect_ip(pd, offset, fd, tree);
+ old_call_dissector(ip_handle, pd, offset, fd, tree);
break;
case GRE_IPX:
next_tvb = tvb_create_from_top(offset);
@@ -304,4 +306,9 @@ void
proto_reg_handoff_gre(void)
{
old_dissector_add("ip.proto", IP_PROTO_GRE, dissect_gre);
+
+ /*
+ * Get a handle for the IP dissector.
+ */
+ ip_handle = find_dissector("ip");
}