* Routines for the Generic Routing Encapsulation (GRE) protocol
* Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
*
- * $Id: packet-gre.c,v 1.23 2000/06/15 03:48:40 gram Exp $
+ * $Id: packet-gre.c,v 1.28 2000/11/19 02:00:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#include <glib.h>
#include "packet.h"
#include "packet-ip.h"
-#include "packet-ppp.h"
#include "packet-ipx.h"
static int proto_gre = -1;
{ 0, NULL }
};
+static dissector_handle_t ip_handle;
+static dissector_handle_t ppp_handle;
+
static void
dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
guint8 sre_length;
tvbuff_t *next_tvb;
+ OLD_CHECK_DISPLAY_AS_DATA(proto_gre, pd, offset, fd, tree);
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "GRE");
switch (type) {
case GRE_PPP:
- next_tvb = tvb_create_from_top(offset);
- dissect_ppp(next_tvb, &pi, tree);
+ old_call_dissector(ppp_handle, pd, offset, fd, 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:
- dissect_ipx(pd, offset, fd, tree);
+ next_tvb = tvb_create_from_top(offset);
+ dissect_ipx(next_tvb, &pi, tree);
break;
default:
- dissect_data(pd, offset, fd, gre_tree);
+ next_tvb = tvb_create_from_top(offset);
+ dissect_data(next_tvb, 0, &pi, gre_tree);
break;
}
}
void
proto_reg_handoff_gre(void)
{
- dissector_add("ip.proto", IP_PROTO_GRE, dissect_gre);
+ old_dissector_add("ip.proto", IP_PROTO_GRE, dissect_gre);
+
+ /*
+ * Get handles for the IP and PPP dissectors.
+ */
+ ip_handle = find_dissector("ip");
+ ppp_handle = find_dissector("ppp");
}