components/wireshark/patches/evb.patch
author Petr Cvachoucek <petr.cvachoucek@oracle.com>
Thu, 23 Aug 2012 09:57:42 -0700
changeset 955 d73530a1bcea
parent 883 50516829ab64
child 1488 04528ffd139d
permissions -rw-r--r--
7193164 upgrade wireshark to version 1.8.2 7192448 Problem with network/wireshark

Index: epan/oui.h
===================================================================
--- epan/oui.h	(revision 41973)
+++ epan/oui.h	(working copy)
@@ -47,6 +47,7 @@
 #define OUI_ERICSSON        0x0001EC    /* Ericsson Group */
 #define OUI_CATENA          0x00025A    /* Catena Networks */
 #define OUI_ATHEROS         0x00037F    /* Atheros Communications */
+#define OUI_ORACLE          0x0003BA    /* Oracle */
 #define OUI_SONY_ERICSSON   0x000AD9    /* Sony Ericsson Mobile Communications AB */
 #define OUI_SONY_ERICSSON_2 0x000E07    /* Sony Ericsson Mobile Communications AB */
 #define OUI_PROFINET        0x000ECF    /* PROFIBUS Nutzerorganisation e.V. */
Index: epan/etypes.h
===================================================================
--- epan/etypes.h	(revision 41973)
+++ epan/etypes.h	(working copy)
@@ -492,6 +492,10 @@
 #define ETHERTYPE_HSR			0x892F  /* High-availability Seamless Redundancy (IEC62439 Part 3) */
 #endif
 
+#ifndef ETHERTYPE_ECP
+#define ETHERTYPE_ECP                   0x8940  /* Edge Control Protocol */
+#endif
+
 #ifndef ETHERTYPE_LOOP
 #define ETHERTYPE_LOOP			0x9000 	/* used for layer 2 testing (do i see my own frames on the wire) */
 #endif
Index: epan/dissectors/packet-ecp.c
===================================================================
--- epan/dissectors/packet-ecp.c	(revision 0)
+++ epan/dissectors/packet-ecp.c	(revision 0)
@@ -0,0 +1,616 @@
+/* packet-ecp.c
+ * Routines for Solaris ECP/VDP dissection based on IEEE 802.1Qbg Draft 2.1
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <[email protected]>
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <epan/packet.h>
+#include <epan/etypes.h>
+#include <epan/oui.h>
+
+static int proto_ecp = -1;
+static int hf_ecp_version = -1;
+static int hf_ecp_op = -1;
+static int hf_ecp_subtype = -1;
+static int hf_ecp_seqno = -1;
+
+static int proto_vdp = -1;
+static int hf_vdp_tlv_type = -1;
+static int hf_vdp_tlv_len = -1;
+static int hf_vdp_tlv_assoc_reason = -1;
+static int hf_vdp_tlv_org_oui = -1;
+static int hf_vdp_vsitypeid = -1;
+static int hf_vdp_vsiversion = -1;
+static int hf_vdp_vsiid_format = -1;
+static int hf_vdp_filter_format = -1;
+
+static int hf_oui_oracle_subtype = -1;
+static int hf_oui_oracle_encoding = -1;
+
+static gint ett_ecp = -1;
+static gint ett_vdp_tlv = -1;
+static gint ett_vdp_tlv_mgrid = -1;
+static gint ett_vdp_tlv_assoc = -1;
+static gint ett_vdp_tlv_org = -1;
+
+static dissector_handle_t data_handle;
+
+#define	ECP_OP_REQ		0x0
+#define	ECP_OP_ACK		0x1
+
+#define	ECP_SUBTYPE_VDP		0x0001
+#define	ECP_SUBTYPE_PECSP	0x0002
+
+#define VDP_TLV_PREASSOC	0x01
+#define VDP_TLV_PREASSOCRR	0x02
+#define VDP_TLV_ASSOC		0x03
+#define VDP_TLV_DEASSOC		0x04
+#define VDP_TLV_MGRID		0x05
+#define	VDP_TLV_ORG		0x7F
+
+#define	VSI_FMT_IPv4		0x01
+#define	VSI_FMT_IPv6		0x02
+#define	VSI_FMT_MAC		0x03
+#define	VSI_FMT_LOCAL		0x04
+#define	VSI_FMT_UUID		0x05
+
+#define	VDP_FILTER_VID		0x01
+#define	VDP_FILTER_MACVID	0x02
+#define	VDP_FILTER_GRPVID	0x03
+#define	VDP_FILTER_GRPMACVID	0x04
+
+/* Masks - from packet-lldp.c */
+#define TLV_TYPE_MASK		0xFE00
+#define TLV_TYPE(value)		(((value) & TLV_TYPE_MASK) >> 9)
+#define TLV_INFO_LEN_MASK	0x01FF
+#define TLV_INFO_LEN(value)	((value) & TLV_INFO_LEN_MASK)
+
+#define	ECP_VERSION_MASK	0xF000
+#define	ECP_OP_MASK		0x0C00
+#define	ECP_SUBTYPE_MASK	0x03FF
+
+#define	ECP_VERSION(value)	(((value) & ECP_VERSION_MASK) >> 12)
+#define	ECP_OP(value)		(((value) & ECP_OP_MASK) >> 10)
+#define	ECP_SUBTYPE(value)	(((value) & ECP_SUBTYPE_MASK))
+
+#define	OUI_ORACLE_VSIMGR_SUBTYPE	0x01
+
+/*
+ * Hash table for translating OUIs to a dissector table/field info pair;
+ * the dissector table maps PID values to dissectors, and the field
+ * corresponds to the PID for that OUI.
+ */
+typedef struct {
+	dissector_table_t table;
+	hf_register_info *field_info;
+} oui_info_t;
+
+static GHashTable *oui_info_table = NULL;
+
+static const value_string ecp_op_vals[] = {
+	{ ECP_OP_REQ,	"ECP request" },
+	{ ECP_OP_ACK,	"ECP acknowledgement" },
+	{ 0,	NULL }
+};
+
+static const value_string ecp_subtype_vals[] = {
+	{ ECP_SUBTYPE_VDP,	"VDP" },
+	{ 0,			NULL }
+};
+
+static const value_string vdp_tlv_type_vals[] = {
+	{ VDP_TLV_PREASSOC,		"PreAssociate" },
+	{ VDP_TLV_PREASSOCRR,		"PreAssociate with RR" },
+	{ VDP_TLV_ASSOC,		"Associate" },
+	{ VDP_TLV_DEASSOC,		"DeAssociate" },
+	{ VDP_TLV_MGRID,		"VSI Manager ID" },
+	{ VDP_TLV_ORG,			"Orgnaizationally defined TLV" },
+	{ 0x0,				NULL }
+};
+
+static const value_string vdp_tlv_oui_vals[] = {
+	{ OUI_ORACLE,		"Oracle" },
+	{ 0x0,			NULL }
+};
+
+static const value_string oui_oracle_subtype_vals[] = {
+	{ OUI_ORACLE_VSIMGR_SUBTYPE,		"VSI Manager Subtype" },
+	{ 0x0,					NULL }
+};
+
+static const value_string oui_oracle_encoding_vals[] = {
+	{ 0x1,		"oracle_vsi_v1" },
+	{ 0x0,		NULL }
+};
+
+static const value_string vdp_response_error_type_vals[] = {
+	{ 0x0,	"Success" },
+	{ 0x1,	"Invalid Format" },
+	{ 0x2,	"Insufficient Resource" },
+	{ 0x3,	"Unable to Contact VSI Manager" },
+	{ 0x4,	"Other Failure" },
+	{ 0x5,	"Invalid VID, GroupID, or Mac address" },
+	{ 0x0,	NULL }
+};
+
+static const value_string vdp_vsiid_format_vals[] = {
+	{ VSI_FMT_IPv4,		"IPv4" },
+	{ VSI_FMT_IPv6,		"IPv6" },
+	{ VSI_FMT_MAC,		"MAC" },
+	{ VSI_FMT_LOCAL,	"Local" },
+	{ VSI_FMT_UUID,		"UUID" },
+	{ 0x0,	NULL }
+};
+
+static const value_string vdp_filter_format_vals[] = {
+	{ VDP_FILTER_VID,		"VID" },
+	{ VDP_FILTER_MACVID,		"MAC/VID" },
+	{ VDP_FILTER_GRPVID,		"GroupID/VID" },
+	{ VDP_FILTER_GRPMACVID,		"GroupID/MAC/VID" },
+	{ 0x0,				NULL }
+};
+
+static void
+vdp_add_vidstr(tvbuff_t *tvb, proto_tree *tree, guint32 offset, proto_item *ti)
+{
+	guint16 val;
+	guint ps, pcp, vid;
+
+	val = tvb_get_ntohs(tvb, offset);
+	ps = (val >> 12) & 0x8;
+	pcp = (val >> 12) & 0x7;
+	vid = val & 0x0FFF;
+	if (tree) {
+		if (ti == NULL)
+			proto_tree_add_text(tree, tvb, offset, 2,
+			    "PS %u, PCP %u, VID %u", ps, pcp, vid);
+		else
+			proto_item_append_text(ti,
+			    "PS %u, PCP %u, VID %u", ps, pcp, vid);
+	}	
+}
+
+static gint32
+dissect_vdp_tlv_assoc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint8 tlvtype)
+{
+	proto_tree *vdp_tlv_assoc_tree;	 
+	proto_item *ti;
+	guint16 tlvhdr;
+	guint32 tlvlen = 0;
+	guint8 reason, flags;
+	gboolean request;
+
+	if (tree) {
+		if (tlvtype == VDP_TLV_ASSOC)
+			ti = proto_tree_add_text(tree, tvb, offset, 2,
+			    "VDP Associate");
+		else
+			ti = proto_tree_add_text(tree, tvb, offset, 2,
+			    "VDP DeAssociate");
+		vdp_tlv_assoc_tree = proto_item_add_subtree(ti,
+		    ett_vdp_tlv_assoc);
+	}
+
+	tlvhdr = tvb_get_ntohs(tvb, offset);
+	tlvlen = TLV_INFO_LEN(tlvhdr);
+	offset += 2;
+
+	/* Reason */
+	reason = tvb_get_bits8(tvb, offset, 8);
+	flags = reason >> 4;
+	request = !(flags & 0x4);
+	if (tree) {
+		ti = proto_tree_add_item(vdp_tlv_assoc_tree,
+		    hf_vdp_tlv_assoc_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
+		if (request) {
+			proto_item_append_text(ti, " Request");
+			if (flags != 0) {
+				proto_item_append_text(ti, "; Flags (%x)",
+				    flags);
+				if (flags & 0x1)
+					proto_item_append_text(ti, " M-Bit");
+				if (flags & 0x2)
+					proto_item_append_text(ti, " S-Bit");
+			}
+		} else {
+			guint8 error = reason & 0x0F;
+			const char *errorstr;
+
+			proto_item_append_text(ti, " Response");
+			errorstr = val_to_str(error,
+			    vdp_response_error_type_vals, "Unknown error");
+			proto_item_append_text(ti, "%s", errorstr); 
+			if ((flags & 0x0F) != 0) {
+				proto_item_append_text(ti, "; Flags (%x)",
+				    flags);
+				if (flags & 0x1)
+					proto_item_append_text(ti,
+					    " Hard Error");
+				if (flags & 0x2)
+					proto_item_append_text(ti, " Keep");
+			}
+		}
+	}
+	offset++;
+
+	if (tree) {
+		guint8 filter_format;
+		const char *str;
+
+		/* VSITYPEID/VERSION */
+		proto_tree_add_item(vdp_tlv_assoc_tree,
+		    hf_vdp_vsitypeid, tvb, offset, 3, ENC_BIG_ENDIAN);
+		offset += 3;
+		proto_tree_add_item(vdp_tlv_assoc_tree,
+		    hf_vdp_vsiversion, tvb, offset, 1, ENC_BIG_ENDIAN);
+		offset++;
+
+		/* VSIID Format */
+		proto_tree_add_item(vdp_tlv_assoc_tree,
+		    hf_vdp_vsiid_format, tvb, offset, 1, ENC_BIG_ENDIAN);
+		offset++;
+
+		/* VSIID */
+		str = tvb_bytes_to_str_punct(tvb, offset, 16, ':');
+		proto_tree_add_text(vdp_tlv_assoc_tree, tvb, offset, 16,
+		    "VSIID: %s", str);
+		offset += 16;
+
+		/* Filter Format */
+		proto_tree_add_item(vdp_tlv_assoc_tree,
+		    hf_vdp_filter_format, tvb, offset, 1, ENC_BIG_ENDIAN);
+		filter_format = tvb_get_guint8(tvb, offset);
+		offset++;
+
+		switch (filter_format) {
+		case VDP_FILTER_VID:
+			vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset, NULL);
+			offset += 2;
+			break;
+		case VDP_FILTER_MACVID:
+			str = tvb_ether_to_str(tvb, offset);
+			ti = proto_tree_add_text(vdp_tlv_assoc_tree, tvb,
+			    offset, 6, "MAC %s. ", str);
+			offset += 6;
+			vdp_add_vidstr(tvb, vdp_tlv_assoc_tree, offset, ti);
+			offset += 2;
+			break;
+		}
+	} else {
+		offset += 30;
+	}
+
+	return offset; 
+}
+
+static gint32
+dissect_vdp_tlv_mgrid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset)
+{
+	proto_tree *vdp_tlv_mgrid_tree = NULL;	
+	proto_item *ti = NULL;
+	guint16 tlvhdr;
+	guint32 tlvlen = 0;
+	const char *str;
+
+	if (tree) {
+		ti = proto_tree_add_text(tree, tvb, offset, 2,
+		    "%s", "VDP Manager ID");
+		vdp_tlv_mgrid_tree = proto_item_add_subtree(ti,
+		    ett_vdp_tlv_mgrid);
+	}
+
+	tlvhdr = tvb_get_ntohs(tvb, offset);
+	tlvlen = TLV_INFO_LEN(tlvhdr);
+	if (tlvlen != 16) {
+		if (tree) {
+			proto_tree_add_text(vdp_tlv_mgrid_tree, tvb, offset, 2,
+			    "%s Invalid Length: %u",
+			    decode_boolean_bitfield(tlvlen, TLV_INFO_LEN_MASK,
+			    16, "", ""), tlvlen);
+		}
+		return -1;
+	}
+	offset += 2;
+
+	str = tvb_ip6_to_str(tvb, offset);
+	if (ti != NULL) {
+		proto_item_append_text(ti, ": %s", str);	
+	}
+	offset += 16;
+	return offset;
+}
+
+static gint32
+dissect_oracle_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset)
+{
+	if (tree) {
+		proto_tree_add_item(tree, hf_oui_oracle_encoding, tvb,
+		    offset, 1, ENC_BIG_ENDIAN);
+	}
+
+	return offset + 1;
+}
+
+static gint32
+dissect_vdp_tlv_org(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset)
+{
+	guint16 tlvhdr;
+	guint32 tlvlen = 0;
+	guint32 oui;
+	guint8 subtype;
+	const char *ouistr;
+	const char *subtypestr;
+
+	/* TLV header */
+	tlvhdr = tvb_get_ntohs(tvb, offset);
+	tlvlen = TLV_INFO_LEN(tlvhdr);
+	if (tlvlen < 3) {
+		if (tree) {
+			proto_tree_add_text(tree, tvb, offset, 2,
+			    "%s Invalid Length: %u",
+			    decode_boolean_bitfield(tlvlen, TLV_INFO_LEN_MASK,
+			    16, "", ""), tlvlen);
+		}
+		return -1;
+	}
+	offset += 2;
+
+	oui = tvb_get_ntoh24(tvb, offset);
+	ouistr = val_to_str(oui, vdp_tlv_oui_vals, "Unknown");
+	
+	/* XXX only support Oracle OUI for now */
+	if (oui != OUI_ORACLE)
+		return -1;
+	offset += 3;
+
+	subtype = tvb_get_guint8(tvb, offset);
+	subtypestr = val_to_str(subtype, oui_oracle_subtype_vals,
+	    "Unknown subtype 0x%x"); 
+	offset++;
+
+	if (tree) {
+		proto_tree_add_text(tree, tvb, offset, 0, "%s - %s",
+		    ouistr, subtypestr);
+		/* XXX create a org tlv tree if neccessary */
+	}
+	switch (subtype) {
+	case OUI_ORACLE_VSIMGR_SUBTYPE:
+		offset = dissect_oracle_tlv(tvb, pinfo, tree, offset);
+		break;
+	default:
+		return -1;
+	}
+	return offset;
+}
+
+static void
+dissect_vdp_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint32 offset)
+{
+	proto_tree *vdp_tlv_tree = NULL;
+	proto_item *ti;
+	guint8	tlvtype;
+	guint16 tlvhdr;
+	guint32 tlvlen = 0;
+
+	while (offset > 0) {
+		tlvhdr = tvb_get_ntohs(tvb, offset);
+		tlvtype = TLV_TYPE(tlvhdr);
+		tlvlen = TLV_INFO_LEN(tlvhdr);
+
+		if (tlvtype == 0) /* XXX most likely it's padding */
+			break;
+		if (tree) {
+			ti = proto_tree_add_text(tree, tvb, offset, tlvlen + 2,
+			    "VDP TLV");
+			vdp_tlv_tree = proto_item_add_subtree(ti, ett_vdp_tlv);
+			proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_type, tvb,
+			    offset, 2, ENC_BIG_ENDIAN);
+			proto_tree_add_item(vdp_tlv_tree, hf_vdp_tlv_len, tvb,
+			    offset, 2, ENC_BIG_ENDIAN);
+		}
+
+		switch (tlvtype) {
+		case VDP_TLV_PREASSOC:
+			break;
+		case VDP_TLV_PREASSOCRR:
+			break;
+		case VDP_TLV_ASSOC:
+		case VDP_TLV_DEASSOC:
+			offset = dissect_vdp_tlv_assoc(tvb, pinfo, vdp_tlv_tree,
+			    offset, tlvtype);
+			break;
+		case VDP_TLV_MGRID:
+			offset = dissect_vdp_tlv_mgrid(tvb, pinfo, vdp_tlv_tree,
+			    offset);
+			break;
+		case VDP_TLV_ORG:
+			offset = dissect_vdp_tlv_org(tvb, pinfo, vdp_tlv_tree,
+			    offset);
+			break;
+		default:
+			/* unknown type */
+			goto done;
+		}
+	}
+done: ;
+}
+
+static void
+dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+	proto_item *ti;
+	proto_tree *ecp_tree = NULL;
+	int offset = 0;
+	guint16 hdr, ver, op, subtype, seqno;
+
+	col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECP");
+	col_clear(pinfo->cinfo, COL_INFO);
+
+	/* Version/OP/Subtype */
+	hdr = tvb_get_ntohs(tvb, offset);
+	ver = ECP_VERSION(hdr);
+	op = ECP_OP(hdr);
+	subtype = ECP_SUBTYPE(hdr);
+	if (check_col(pinfo->cinfo, COL_INFO)) {
+		col_append_fstr(pinfo->cinfo, COL_INFO,
+		    "PDU Version = %x OP = %x"
+		    " Subtype = %x", ver, op, subtype);
+	}
+	if (tree) {
+		/* details */
+		ti = proto_tree_add_item(tree, proto_ecp, tvb, 0, -1, ENC_NA);
+		ecp_tree = proto_item_add_subtree(ti, ett_ecp);
+
+		proto_tree_add_item(ecp_tree, hf_ecp_version, tvb, offset, 2,
+		    ENC_BIG_ENDIAN);
+		proto_tree_add_item(ecp_tree, hf_ecp_op, tvb, offset, 2,
+		    ENC_BIG_ENDIAN);
+		proto_tree_add_item(ecp_tree, hf_ecp_subtype, tvb, offset, 2,
+		    ENC_BIG_ENDIAN);
+	}
+	offset += 2;
+
+	/* Seqno */
+	if (tree) {
+		proto_tree_add_item(ecp_tree, hf_ecp_seqno, tvb, offset, 2,
+		    ENC_BIG_ENDIAN);
+	}
+	seqno = tvb_get_ntohs(tvb, offset);
+	switch (op) {
+	case ECP_OP_REQ:
+		col_append_fstr(pinfo->cinfo, COL_INFO,
+		    " SEQ = 0x%x", seqno);
+		break;
+	case ECP_OP_ACK:
+		col_append_fstr(pinfo->cinfo, COL_INFO,
+		    " ACK = 0x%x", seqno);
+		break;
+	}
+	offset += 2;
+
+	/* XXX todo: use sub-dissector */
+	if (subtype == ECP_SUBTYPE_VDP) {
+		dissect_vdp_tlv(tvb, pinfo, ecp_tree, offset);
+	}
+}
+
+void
+proto_register_ecp(void)
+{
+	static hf_register_info hf_ecp[] = {
+		{ &hf_ecp_version,
+		{ "Version",	"ecp.ver", FT_UINT16, BASE_DEC,
+		    NULL, ECP_VERSION_MASK, NULL, HFILL }},
+		{ &hf_ecp_op,
+		{ "Operation", "ecp.op", FT_UINT16, BASE_HEX,
+		    VALS(ecp_op_vals), ECP_OP_MASK, NULL, HFILL }},
+		{ &hf_ecp_subtype,
+		{ "Subtype", "ecp.subtype", FT_UINT16, BASE_HEX,
+		    VALS(ecp_subtype_vals), ECP_SUBTYPE_MASK, NULL, HFILL }},
+		{ &hf_ecp_seqno,
+		{ "Sequence number", "ecp.seqno", FT_UINT16, BASE_DEC,
+		    NULL, 0x0, NULL, HFILL }},
+	};
+
+	static hf_register_info hf_vdp[] = {
+		{ &hf_vdp_tlv_type,
+		{ "VDP TLV Type",	"vdp.tlvtype", FT_UINT16, BASE_DEC,
+			VALS(vdp_tlv_type_vals), TLV_TYPE_MASK, NULL, HFILL }},
+		{ &hf_vdp_tlv_len,
+		{ "VDP TLV Length",	"vdp.tlvlen", FT_UINT16, BASE_DEC,
+			NULL, TLV_INFO_LEN_MASK, NULL, HFILL }},
+
+		{ &hf_vdp_tlv_assoc_reason,
+		{ "Reason/Status",	"vdp.assoc.reason", FT_UINT8, BASE_HEX,
+			NULL, 0x0, NULL, HFILL }},
+		{ &hf_vdp_tlv_org_oui,
+		{ "Org OUI", "vdp.org.oui", FT_UINT24, BASE_HEX,
+			VALS(vdp_tlv_oui_vals), 0x0, NULL, HFILL}},
+		{ &hf_oui_oracle_subtype,
+		{ "Oracle Subtype", "vdp.oracle.subtype", FT_UINT8, BASE_HEX,
+			VALS(oui_oracle_subtype_vals), 0x0, NULL, HFILL}},
+		{ &hf_oui_oracle_encoding,
+		{ "VSI Manager ID Encoding", "vdp.oracle.encoding", FT_UINT8,
+		    	BASE_HEX, VALS(oui_oracle_encoding_vals),
+			0x0, NULL, HFILL}},
+		{ &hf_vdp_vsitypeid,
+		{ "VSI Type ID", "vdp.vsitypeid", FT_UINT24,
+		    	BASE_HEX, NULL, 0x0, NULL, HFILL}},
+		{ &hf_vdp_vsiversion,
+		{ "VSI Version", "vdp.vsiversion", FT_UINT8,
+		    	BASE_HEX, NULL, 0x0, NULL, HFILL}},
+		{ &hf_vdp_vsiid_format,
+		{ "VSIID Format ", "vdp.vsiidformat", FT_UINT8,
+		    	BASE_HEX, VALS(vdp_vsiid_format_vals), 0x0,
+			NULL, HFILL}},
+		{ &hf_vdp_filter_format,
+		{ "VDP Filter Format ", "vdp.filterformat", FT_UINT8,
+		    	BASE_HEX, VALS(vdp_filter_format_vals), 0x0,
+			NULL, HFILL}},
+		
+	};
+		
+	static gint *ett[] = {
+		&ett_ecp,
+		&ett_vdp_tlv,
+		&ett_vdp_tlv_assoc,
+		&ett_vdp_tlv_mgrid,
+		&ett_vdp_tlv_org,
+	};
+
+	proto_ecp = proto_register_protocol("Edge Control Protocol",
+	    "ECP21", "ecp21");
+	proto_register_field_array(proto_ecp, hf_ecp, array_length(hf_ecp));
+
+	proto_vdp = proto_register_protocol("VSI protocol",
+	    "VDP21", "vdp21");
+	proto_register_field_array(proto_vdp, hf_vdp, array_length(hf_vdp));
+
+	proto_register_subtree_array(ett, array_length(ett));
+}
+
+static void
+register_hf(gpointer key _U_, gpointer value, gpointer user_data _U_)
+{
+	oui_info_t *info = value;
+
+	proto_register_field_array(proto_ecp, info->field_info, 1);
+}
+
+void
+proto_reg_handoff_ecp_21(void)
+{
+	dissector_handle_t ecp_handle;
+
+	data_handle = find_dissector("data");
+
+	ecp_handle = create_dissector_handle(dissect_ecp, proto_ecp);
+	dissector_add_uint("ethertype", ETHERTYPE_ECP, ecp_handle);
+
+	/*
+	 * Register all the fields for PIDs for various OUIs.
+	 */
+	if (oui_info_table != NULL)
+		g_hash_table_foreach(oui_info_table, register_hf, NULL);
+}
Index: epan/dissectors/Makefile.common
===================================================================
--- epan/dissectors/Makefile.common	(revision 41973)
+++ epan/dissectors/Makefile.common	(working copy)
@@ -114,6 +114,7 @@
 	packet-dop.c \
 	packet-dsp.c \
 	packet-ess.c \
+	packet-ecp.c \
 	packet-ftam.c \
 	packet-goose.c \
 	packet-HI2Operations.c \