diff options
-rw-r--r-- | AUTHORS | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-hpteam.c | 132 | ||||
-rw-r--r-- | epan/dissectors/packet-llc.c | 14 | ||||
-rw-r--r-- | epan/oui.h | 1 |
4 files changed, 152 insertions, 1 deletions
@@ -2870,10 +2870,14 @@ Alexis La Goutte <alexis.lagoutte [AT] gmail.com> { CAPWAP dissector } -Varun Notibala <nbvarun [AT] gmail.com { +Varun Notibala <nbvarun [AT] gmail.com> { SCTP NR-SACK support } +Nathan Hartwell <nhartwell [AT] gmail.com> { + HP NIC Teaming dissector +} + and by: Pavel Roskin <proski [AT] gnu.org> diff --git a/epan/dissectors/packet-hpteam.c b/epan/dissectors/packet-hpteam.c new file mode 100644 index 0000000000..3ad74e3dcf --- /dev/null +++ b/epan/dissectors/packet-hpteam.c @@ -0,0 +1,132 @@ +/* packet-hpteam.c + * Routines for HP Teaming heartbeat dissection + * Copyright 2009, Nathan Hartwell <nhartwell@gmail.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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> +#include <glib.h> +#include <epan/packet.h> +#include <epan/oui.h> +#include <string.h> +#include <packet-llc.h> + + +static int proto_hpteam = -1; +static dissector_handle_t data_handle; + +/* These are the handles of our subdissectors */ +static dissector_handle_t data_handle=NULL; +static dissector_handle_t hpteam_handle=NULL; + +/* Known HP NIC teaming PID values */ +static const value_string hpteam_pid_vals[] = { + { 0x0002, "Hewlett-Packard" }, + { 0, NULL } +}; + +static gint hf_hpteam = -1; +static gint hf_llc_hpteam_pid = -1; + +/* These are the ids of the subtrees that we may be creating */ +static gint ett_hpteam = -1; + +static void +dissect_hpteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_item *hpteam_item = NULL; + proto_tree *hpteam_tree = NULL; + proto_tree *hpteam_header_tree = NULL; + guint32 offset = 0; + const char *strPtr, *HP_Mac; + const guint8 *mac_addr; + + mac_addr = pinfo->dl_dst.data; + strPtr = ether_to_str(mac_addr); + HP_Mac = "03:00:c7:00:00:ee"; + /* + * Check to see if SNAP frame is a HP Teaming frame or + * if it is really just SNAP + */ + if (memcmp(strPtr, HP_Mac, 17) == 0) { + col_set_str(pinfo->cinfo, COL_PROTOCOL, "HP NIC Team"); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo, COL_INFO); + col_set_str(pinfo->cinfo, COL_INFO, "HP NIC Teaming Heartbeat; "); + col_append_fstr(pinfo->cinfo, COL_INFO, "Port MAC = %s ", strPtr); + + if (tree) { /* we are being asked for details */ + hpteam_item = proto_tree_add_item(tree, proto_hpteam, tvb, 0, -1, FALSE); + hpteam_tree = proto_item_add_subtree(hpteam_item, ett_hpteam); + hpteam_header_tree = proto_item_add_subtree(hpteam_item, ett_hpteam); + proto_tree_add_item(hpteam_tree, hf_hpteam, tvb, offset, 58, FALSE); + } + } + else { + data_handle = find_dissector("data"); + call_dissector(data_handle, tvb, pinfo, tree); + } +} + +void proto_register_hpteam(void) +{ + static hf_register_info hf_pid = { + &hf_llc_hpteam_pid, + { "PID", "llc.hpteam_pid", FT_UINT16, BASE_HEX, + VALS(hpteam_pid_vals), 0x0, NULL, HFILL } + }; + + static hf_register_info hf_data[] = { + {&hf_hpteam, + { "Proprietary Data", "hpteam.data", FT_BYTES, BASE_NONE, + NULL, 0x0, NULL, HFILL }} + }; + + static gint *ett[] = { + &ett_hpteam + }; + + proto_hpteam = proto_register_protocol ("HP NIC Teaming Heartbeat", "HPTEAM", "hpteam"); + + /*Tied into the LLC dissector so register the OUI with LLC*/ + llc_add_oui(OUI_HP_2, "llc.hpteam_pid", "Hewlett Packard OUI PID", &hf_pid); + proto_register_field_array(proto_hpteam, hf_data, array_length(hf_data)); + proto_register_subtree_array(ett, array_length(ett)); + register_dissector("hpteam", dissect_hpteam, proto_hpteam); +} + +void proto_reg_handoff_hpteam(void) +{ + static gboolean initialized = FALSE; + if (!initialized) { + data_handle = find_dissector("data"); + hpteam_handle = create_dissector_handle(dissect_hpteam, proto_hpteam); + /* Register dissector to key off of known PID / OUI combination */ + dissector_add("llc.hpteam_pid", 0x0002, hpteam_handle); + initialized = TRUE; + } +} diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c index 55ce9b6219..67a24bca30 100644 --- a/epan/dissectors/packet-llc.c +++ b/epan/dissectors/packet-llc.c @@ -88,6 +88,7 @@ static dissector_table_t dsap_subdissector_table; static dissector_table_t xid_subdissector_table; static dissector_table_t ethertype_subdissector_table; +static dissector_table_t hpteam_subdissector_table; static dissector_handle_t bpdu_handle; static dissector_handle_t eth_withoutfcs_handle; @@ -219,6 +220,7 @@ http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r { OUI_SIEMENS, "Siemens AG" }, { OUI_APPLE_ATALK, "Apple (AppleTalk)" }, { OUI_HP, "Hewlett-Packard" }, + { OUI_HP_2, "Hewlett-Packard" }, { 0, NULL } }; @@ -607,6 +609,17 @@ dissect_snap(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, switch (oui) { + case OUI_HP_2: + oui_info = get_snap_oui_info(oui); + hf = *oui_info->field_info->p_id; + subdissector_table = oui_info->table; + proto_tree_add_uint(snap_tree, hf, tvb, offset+3, 2, etype); + next_tvb = tvb_new_subset(tvb, offset+5, -1, -1); + + if(!dissector_try_port(hpteam_subdissector_table,etype, next_tvb, pinfo, tree)) + call_dissector(data_handle, next_tvb, pinfo, tree); + break; + case OUI_ENCAP_ETHER: case OUI_CISCO_90: case OUI_APPLE_ATALK: @@ -950,6 +963,7 @@ proto_reg_handoff_llc(void) * Get the Ethertype dissector table. */ ethertype_subdissector_table = find_dissector_table("ethertype"); + hpteam_subdissector_table = find_dissector_table("llc.hpteam_pid"); llc_handle = find_dissector("llc"); dissector_add("wtap_encap", WTAP_ENCAP_ATM_RFC1483, llc_handle); diff --git a/epan/oui.h b/epan/oui.h index 90e860b47f..feefa71eda 100644 --- a/epan/oui.h +++ b/epan/oui.h @@ -70,6 +70,7 @@ #define OUI_SIEMENS 0x080006 /* Siemens AG */ #define OUI_APPLE_ATALK 0x080007 /* Appletalk */ #define OUI_HP 0x080009 /* Hewlett-Packard */ +#define OUI_HP_2 0x00805F /* Hewlett-Packard */ /* * Defined in packet-llc.c |