From Vaibhav Katkade via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9011 :
Add support for the Cisco MetaData (0x8909) ethertype. From me: Don't try to register the "eth.type" abbreviation; use "cmd.type" instead. Add SVN id. Clean up trailing white space and fix up some indentation. Don't declare a variable static that need not be. svn path=/trunk/; revision=51198
This commit is contained in:
parent
c44883cb1a
commit
a018f63bca
4
AUTHORS
4
AUTHORS
|
@ -3523,6 +3523,10 @@ Rupesh Patro <rbpatro[AT]ncsu.edu> {
|
|||
Support for Upstream-Assigned Label TLVs and Sub-TLVs as per RFC 6389
|
||||
}
|
||||
|
||||
Vaibhav Katkade <katkade_v[AT]yahoo.com> {
|
||||
Support for Cisco MetaData (CMD) ethertype
|
||||
}
|
||||
|
||||
and by:
|
||||
|
||||
Georgi Guninski <guninski[AT]guninski.com>
|
||||
|
|
|
@ -374,6 +374,7 @@ DISSECTOR_SRC = \
|
|||
packet-clique-rm.c \
|
||||
packet-clnp.c \
|
||||
packet-cmpp.c \
|
||||
packet-cmd.c \
|
||||
packet-cnip.c \
|
||||
packet-coap.c \
|
||||
packet-collectd.c \
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/* packet-cmd.c
|
||||
* Routines for dissection of Cisco's MetaData protocol.
|
||||
* Added 3rd Aug 2013 by Vaibhav Katkade (vkatkade[AT]cisco.com)
|
||||
*
|
||||
* $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#include "packet-ieee8023.h"
|
||||
|
||||
static int proto_cmd = -1;
|
||||
|
||||
static int hf_cmd_version = -1;
|
||||
static int hf_cmd_length = -1;
|
||||
static int hf_cmd_options = -1;
|
||||
static int hf_cmd_sgt = -1;
|
||||
|
||||
static int hf_eth_type = -1;
|
||||
static int hf_cmd_trailer = -1;
|
||||
|
||||
static gint ett_cmd = -1;
|
||||
|
||||
static void
|
||||
dissect_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
guint16 encap_proto;
|
||||
|
||||
proto_tree *cmd_tree = NULL;
|
||||
gint offset = 0;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMD");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
if (tree) {
|
||||
proto_item *ti = proto_tree_add_item(tree, proto_cmd, tvb, 0, 6, ENC_NA);
|
||||
|
||||
cmd_tree = proto_item_add_subtree(ti, ett_cmd);
|
||||
proto_tree_add_item(cmd_tree, hf_cmd_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_item(cmd_tree, hf_cmd_length, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_item(cmd_tree, hf_cmd_options, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(cmd_tree, hf_cmd_sgt, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
encap_proto = tvb_get_ntohs(tvb, 6);
|
||||
|
||||
/* This Logic to identify and decode IEEE 802.3 frames is not working correctly. Carry over code from packet-vlan.c
|
||||
* Commenting it out for now will display as Unknown for L2 control frames instead of showing a wrong decode.
|
||||
*/
|
||||
#if 0
|
||||
if (encap_proto <= IEEE_802_3_MAX_LEN) {
|
||||
gboolean is_802_2 = TRUE;
|
||||
|
||||
/* Don't throw an exception for this check (even a BoundsError) */
|
||||
if (tvb_length_remaining(tvb, 4) >= 2) {
|
||||
if (tvb_get_ntohs(tvb, 4) == 0xffff)
|
||||
is_802_2 = FALSE;
|
||||
}
|
||||
|
||||
dissect_802_3(encap_proto, is_802_2, tvb, 4, pinfo, tree, cmd_tree, hf_eth_type, hf_cmd_trailer, 0);
|
||||
} else {
|
||||
#endif
|
||||
|
||||
ethertype(encap_proto, tvb, 8, pinfo, tree, cmd_tree,
|
||||
hf_eth_type, hf_cmd_trailer, 0);
|
||||
}
|
||||
|
||||
void
|
||||
proto_register_cmd(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_cmd_version,
|
||||
{ "Version", "cmd.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_cmd_length,
|
||||
{ "Length", "cmd.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_cmd_options,
|
||||
{ "Options", "cmd.options", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_cmd_sgt,
|
||||
{ "SGT", "cmd.sgt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_eth_type,
|
||||
{ "Type", "cmd.type", FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_cmd_trailer,
|
||||
{ "Trailer", "cmd.trailer", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_cmd
|
||||
};
|
||||
|
||||
proto_cmd = proto_register_protocol("Cisco MetaData", "Cisco MetaData", "cmd");
|
||||
proto_register_field_array(proto_cmd, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_cmd(void)
|
||||
{
|
||||
dissector_handle_t cmd_handle;
|
||||
|
||||
cmd_handle = create_dissector_handle(dissect_cmd, proto_cmd);
|
||||
dissector_add_uint("ethertype", ETHERTYPE_CMD, cmd_handle);
|
||||
}
|
|
@ -179,6 +179,7 @@ const value_string etype_vals[] = {
|
|||
{ ETHERTYPE_WAI, "WAI Authentication Protocol" },
|
||||
{ ETHERTYPE_HSR, "High-availability Seamless Redundancy (IEC62439 Part 3)" },
|
||||
{ ETHERTYPE_BPQ, "AX.25"},
|
||||
{ ETHERTYPE_CMD, "CiscoMetaData"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
#define IEEE_802_3_MAX_LEN 1500
|
||||
|
||||
/*
|
||||
/*
|
||||
* Minimum length of an Ethernet II frame; Ethernet type/length values
|
||||
* greater than or equal to it are types.
|
||||
*/
|
||||
|
@ -487,6 +487,10 @@
|
|||
#define ETHERTYPE_FCOE 0x8906 /* Fibre Channel over Ethernet */
|
||||
#endif
|
||||
|
||||
#ifndef ETHERTYPE_CMD
|
||||
#define ETHERTYPE_CMD 0x8909 /* Cisco Systems Inc - Cisco MetaData */
|
||||
#endif
|
||||
|
||||
#ifndef ETHERTYPE_IEEE80211_DATA_ENCAP
|
||||
#define ETHERTYPE_IEEE80211_DATA_ENCAP 0x890d /* IEEE 802.11 data encapsulation */
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue