aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-12-16 22:46:42 +0000
committerGuy Harris <guy@alum.mit.edu>2007-12-16 22:46:42 +0000
commit80039e2976e586f2c016c902ffa663f9500a84d2 (patch)
tree9394f52b3c4949923ec2ddc16553439d9161d3e8
parent0cadc40746be09cfd2b3f5560f7bfafd633e2adb (diff)
For captures on a Linux GRE interface, put a field into the protocol
tree with the GRE protocol type value. svn path=/trunk/; revision=23894
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-gre.c9
-rw-r--r--epan/dissectors/packet-gre.h26
-rw-r--r--epan/dissectors/packet-sll.c9
4 files changed, 41 insertions, 4 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 33b6106f89..e56f2356df 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -889,6 +889,7 @@ DISSECTOR_INCLUDES = \
packet-giop.h \
packet-gnm.h \
packet-gnutella.h \
+ packet-gre.h \
packet-gsm_a.h \
packet-gsm_map.h \
packet-gsm_sms.h \
diff --git a/epan/dissectors/packet-gre.c b/epan/dissectors/packet-gre.c
index dc146fffb2..b4ec3f71df 100644
--- a/epan/dissectors/packet-gre.c
+++ b/epan/dissectors/packet-gre.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include "packet-gre.h"
#include "packet-wccp.h"
#include <epan/in_cksum.h>
#include <epan/etypes.h>
@@ -82,7 +83,7 @@ static dissector_handle_t data_handle;
static void add_flags_and_ver(proto_tree *, guint16, tvbuff_t *, int, int);
static void dissect_gre_wccp2_redirect_header(tvbuff_t *, int, proto_tree *);
-static const value_string typevals[] = {
+const value_string gre_typevals[] = {
{ ETHERTYPE_PPP, "PPP" },
{ ETHERTYPE_IP, "IP" },
{ SAP_OSINL5, "OSI"},
@@ -235,7 +236,7 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, "Encapsulated %s",
- val_to_str(type, typevals, "0x%04X (unknown)"));
+ val_to_str(type, gre_typevals, "0x%04X (unknown)"));
}
if (flags_and_ver & GH_B_C || flags_and_ver & GH_B_R)
@@ -272,7 +273,7 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_gre, tvb, offset, len,
"Generic Routing Encapsulation (%s)",
- val_to_str(type, typevals, "0x%04X - unknown"));
+ val_to_str(type, gre_typevals, "0x%04X - unknown"));
gre_tree = proto_item_add_subtree(ti, ett_gre);
add_flags_and_ver(gre_tree, flags_and_ver, tvb, offset, is_ppp);
}
@@ -495,7 +496,7 @@ proto_register_gre(void)
{
static hf_register_info hf[] = {
{ &hf_gre_proto,
- { "Protocol Type", "gre.proto", FT_UINT16, BASE_HEX, VALS(typevals), 0x0,
+ { "Protocol Type", "gre.proto", FT_UINT16, BASE_HEX, VALS(gre_typevals), 0x0,
"The protocol that is GRE encapsulated", HFILL }
},
{ &hf_gre_key,
diff --git a/epan/dissectors/packet-gre.h b/epan/dissectors/packet-gre.h
new file mode 100644
index 0000000000..e5c9c57b6e
--- /dev/null
+++ b/epan/dissectors/packet-gre.h
@@ -0,0 +1,26 @@
+/* packet-gre.h
+ * Routines and data exported by the dissection code for the
+ * Generic Routing Encapsulation (GRE) protocol
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 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.
+ */
+
+extern const value_string gre_typevals[];
diff --git a/epan/dissectors/packet-sll.c b/epan/dissectors/packet-sll.c
index 598a2d80a1..54ea07d8a2 100644
--- a/epan/dissectors/packet-sll.c
+++ b/epan/dissectors/packet-sll.c
@@ -36,6 +36,7 @@
#include "packet-ipx.h"
#include "packet-llc.h"
#include "packet-ppp.h"
+#include "packet-gre.h"
#include <epan/addr_resolv.h>
#include <epan/etypes.h>
@@ -47,6 +48,7 @@ static int hf_sll_src_eth = -1;
static int hf_sll_src_ipv4 = -1;
static int hf_sll_src_other = -1;
static int hf_sll_ltype = -1;
+static int hf_sll_gretype = -1;
static int hf_sll_etype = -1;
static int hf_sll_trailer = -1;
@@ -270,6 +272,8 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
switch (hatype) {
case ARPHRD_IPGRE:
+ proto_tree_add_uint(fh_tree, hf_sll_gretype, tvb, 14, 2,
+ protocol);
dissector_try_port(gre_dissector_table,
protocol, next_tvb, pinfo, tree);
break;
@@ -318,6 +322,11 @@ proto_register_sll(void)
{ "Protocol", "sll.ltype", FT_UINT16, BASE_HEX,
VALS(ltype_vals), 0x0, "Linux protocol type", HFILL }},
+ /* if the protocol field is a GRE protocol type */
+ { &hf_sll_gretype,
+ { "Protocol", "sll.gretype", FT_UINT16, BASE_HEX,
+ VALS(gre_typevals), 0x0, "GRE protocol type", HFILL }},
+
/* registered here but handled in ethertype.c */
{ &hf_sll_etype,
{ "Protocol", "sll.etype", FT_UINT16, BASE_HEX,