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
This commit is contained in:
Guy Harris 2007-12-16 22:46:42 +00:00
parent 0cadc40746
commit 80039e2976
4 changed files with 41 additions and 4 deletions

View File

@ -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 \

View File

@ -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,

View File

@ -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[];

View File

@ -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,