# OBSOLETE: Please use http://dev.laptop.org/~wad/wireshark-0.99.7.mesh.patch # diff -Naur wireshark-0.99.5.orig/epan/dissectors/Makefile.common wireshark-0.99.5/epan/dissectors/Makefile.common --- wireshark-0.99.5.orig/epan/dissectors/Makefile.common 2007-02-01 15:00:42.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/Makefile.common 2007-10-23 12:43:26.000000000 -0700 @@ -448,6 +448,7 @@ packet-mbtcp.c \ packet-mdshdr.c \ packet-media.c \ + packet-mesh.c \ packet-mip.c \ packet-mip6.c \ packet-mms.c \ diff -Naur wireshark-0.99.5.orig/epan/dissectors/packet-ethertype.c wireshark-0.99.5/epan/dissectors/packet-ethertype.c --- wireshark-0.99.5.orig/epan/dissectors/packet-ethertype.c 2007-02-01 15:00:37.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/packet-ethertype.c 2007-10-23 12:43:26.000000000 -0700 @@ -43,6 +43,7 @@ static dissector_table_t ethertype_dissector_table; static dissector_handle_t data_handle; +static dissector_handle_t mesh_header_handle; const value_string etype_vals[] = { {ETHERTYPE_IP, "IP" }, @@ -174,6 +175,7 @@ guint length_before; volatile gboolean dissector_found = FALSE; const char *saved_proto; + guint mesh_header_size; /* Add the Ethernet type to the protocol tree */ if (tree) { @@ -186,6 +188,15 @@ pinfo->ethertype = etype; + /* try to dissect a mesh header */ + if (mesh_header_handle == NULL) + mesh_header_handle = find_dissector("mesh"); + mesh_header_size = call_dissector(mesh_header_handle, next_tvb, pinfo, tree); + if (mesh_header_size) { + next_tvb = tvb_new_subset(tvb, + offset_after_etype + mesh_header_size, -1, -1); + } + /* Remember how much data there is in it. */ length_before = tvb_reported_length(next_tvb); @@ -310,4 +321,5 @@ proto_reg_handoff_ethertype(void) { data_handle = find_dissector("data"); + mesh_header_handle = NULL; } diff -Naur wireshark-0.99.5.orig/epan/dissectors/packet-ieee80211.c wireshark-0.99.5/epan/dissectors/packet-ieee80211.c --- wireshark-0.99.5.orig/epan/dissectors/packet-ieee80211.c 2007-02-01 15:00:47.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/packet-ieee80211.c 2007-10-23 12:43:26.000000000 -0700 @@ -280,7 +280,7 @@ #define DATA_FRAME 0x02 /* Frame type is Data */ #define DATA_SHORT_HDR_LEN 24 -#define DATA_LONG_HDR_LEN 30 +#define DATA_LONG_HDR_LEN 32 #define MGT_FRAME_HDR_LEN 24 /* Length of Managment frame-headers */ /* @@ -366,6 +366,11 @@ #define FIELD_SRC_MAC_ADDR 0X15 /* DLS source MAC address */ #define FIELD_DLS_TIMEOUT 0X16 /* DLS timeout value */ #define FIELD_SCHEDULE_INFO 0X17 /* Schedule Info field */ +#define FIELD_VENDOR_OUI 0X18 /* Vendor Organization Unique Identifier */ +#define FIELD_ACTION_TYPE 0x19 /* Vendor specific action type */ +#define FIELD_MESH_RREQ 0x1A +#define FIELD_MESH_RREP 0x1B +#define FIELD_MESH_RERR 0x1C /* ************************************************************************* */ /* Logical field codes (IEEE 802.11 encoding of tags) */ @@ -413,6 +418,7 @@ #define WPA_OUI (const guint8 *) "\x00\x50\xF2" #define RSN_OUI (const guint8 *) "\x00\x0F\xAC" #define WME_OUI (const guint8 *) "\x00\x50\xF2" +#define MRVL_OUI (const guint8 *) "\x00\x50\x43" #define PMKID_LEN 16 @@ -504,6 +510,7 @@ #define CAT_DLS 2 #define CAT_BLOCK_ACK 3 #define CAT_MGMT_NOTIFICATION 17 +#define CAT_VENDOR_SPECIFIC 127 #define SM_ACTION_MEASUREMENT_REQUEST 0 #define SM_ACTION_MEASUREMENT_REPORT 1 @@ -520,6 +527,13 @@ #define SM_ACTION_DLS_RESPONSE 1 #define SM_ACTION_DLS_TEARDOWN 2 +#define MRVL_ACTION_MESH_MANAGEMENT 1 + +#define MRVL_MESH_MGMT_ACTION_RREQ 0 +#define MRVL_MESH_MGMT_ACTION_RREP 1 +#define MRVL_MESH_MGMT_ACTION_RERR 2 +#define MRVL_MESH_MGMT_ACTION_PLDM 3 + static int proto_wlan = -1; static packet_info * g_pinfo; @@ -636,6 +650,23 @@ static int ff_dst_mac_addr = -1; /* DLS destination MAC addressi */ static int ff_src_mac_addr = -1; /* DLS source MAC addressi */ static int ff_dls_timeout = -1; /* DLS timeout value */ +static int ff_vendor_oui = -1; /* Vendor OUI */ +static int ff_action_type = -1; /* Action Type */ +static int ff_mesh_mgt_action_code = -1;/* Mesh Management action code */ +static int ff_mesh_mgt_length = -1; /* Mesh Management length */ +static int ff_mesh_mgt_mode = -1; /* Mesh Management mode */ +static int ff_mesh_mgt_ttl = -1; /* Mesh Management TTL */ +static int ff_mesh_mgt_dstcount = -1; /* Mesh Management dst count */ +static int ff_mesh_mgt_hopcount = -1; /* Mesh Management hop count */ +static int ff_mesh_mgt_rreqid = -1; /* Mesh Management RREQ ID */ +static int ff_mesh_mgt_sa = -1; /* Mesh Management src addr */ +static int ff_mesh_mgt_ssn = -1; /* Mesh Management src sequence number */ +static int ff_mesh_mgt_metric = -1; /* Mesh Management metric */ +static int ff_mesh_mgt_flags = -1; /* Mesh Management RREQ flags */ +static int ff_mesh_mgt_da = -1; /* Mesh Management dst addr */ +static int ff_mesh_mgt_dsn = -1; /* Mesh Management dst sequence number */ +static int ff_mesh_mgt_lifetime = -1; /* Mesh Management lifetime */ + /* ************************************************************************* */ /* Flags found in the capability field (fixed field) */ @@ -694,6 +725,15 @@ static int hf_aironet_ie_qos_paramset = -1; static int hf_aironet_ie_qos_val = -1; + +static int hf_marvell_ie_mesh_type = -1; +static int hf_marvell_ie_mesh_subtype = -1; +static int hf_marvell_ie_mesh_version = -1; +static int hf_marvell_ie_mesh_active_proto_id = -1; +static int hf_marvell_ie_mesh_active_metric_id = -1; +static int hf_marvell_ie_mesh_cap = -1; + + /*QBSS - Version 1,2,802.11e*/ static int hf_qbss2_cal = -1; @@ -1178,6 +1218,52 @@ proto_tree_add_item (tree, ff_dls_timeout, tvb, offset, 2, TRUE); break; + case FIELD_VENDOR_OUI: + proto_tree_add_item (tree, ff_vendor_oui, tvb, offset, 3, TRUE); + break; + + case FIELD_ACTION_TYPE: + proto_tree_add_item (tree, ff_action_type, tvb, offset, 1, TRUE); + break; + + case FIELD_MESH_RREQ: + proto_tree_add_item (tree, ff_mesh_mgt_action_code, tvb, offset, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_length, tvb, offset + 1, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_mode, tvb, offset + 2, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_hopcount, tvb, offset + 3, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_ttl, tvb, offset + 4, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_rreqid, tvb, offset + 5, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_sa, tvb, offset + 9, 6, FALSE); + proto_tree_add_item (tree, ff_mesh_mgt_ssn, tvb, offset + 15, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_lifetime, tvb, offset + 19, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_metric, tvb, offset + 23, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_dstcount, tvb, offset + 27, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_flags, tvb, offset + 28, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_da, tvb, offset + 29, 6, FALSE); + proto_tree_add_item (tree, ff_mesh_mgt_dsn, tvb, offset + 35, 4, TRUE); + break; + case FIELD_MESH_RREP: + proto_tree_add_item (tree, ff_mesh_mgt_action_code, tvb, offset, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_length, tvb, offset + 1, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_mode, tvb, offset + 2, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_hopcount, tvb, offset + 3, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_ttl, tvb, offset + 4, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_da, tvb, offset + 5, 6, FALSE); + proto_tree_add_item (tree, ff_mesh_mgt_dsn, tvb, offset + 11, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_lifetime, tvb, offset + 15, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_metric, tvb, offset + 19, 4, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_sa, tvb, offset + 23, 6, FALSE); + proto_tree_add_item (tree, ff_mesh_mgt_ssn, tvb, offset + 29, 4, TRUE); + break; + case FIELD_MESH_RERR: + proto_tree_add_item (tree, ff_mesh_mgt_action_code, tvb, offset, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_length, tvb, offset + 1, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_mode, tvb, offset + 2, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_dstcount, tvb, offset + 3, 1, TRUE); + proto_tree_add_item (tree, ff_mesh_mgt_da, tvb, offset + 4, 6, FALSE); + proto_tree_add_item (tree, ff_mesh_mgt_dsn, tvb, offset + 10, 4, TRUE); + break; + case FIELD_SCHEDULE_INFO: { proto_item *sched_item; @@ -1444,6 +1530,33 @@ { 0, NULL } }; +typedef enum { + MARVELL_IE_MESH = 4 +} marvell_ie_type_t; + +static void +dissect_vendor_ie_marvell(proto_item * item, proto_tree * ietree, + tvbuff_t * tvb, int offset, guint32 tag_len) +{ + guint8 type; + int i; + gboolean dont_change = FALSE; /* Don't change the IE item text to default */ + + type = tvb_get_guint8(tvb, offset); + proto_tree_add_item (ietree, hf_marvell_ie_mesh_type, tvb, offset, 1, TRUE); + offset += 1; + + switch (type) { + case MARVELL_IE_MESH: + proto_tree_add_item (ietree, hf_marvell_ie_mesh_subtype, tvb, offset++, 1, TRUE); + proto_tree_add_item (ietree, hf_marvell_ie_mesh_version, tvb, offset++, 1, TRUE); + proto_tree_add_item (ietree, hf_marvell_ie_mesh_active_proto_id, tvb, offset++, 1, TRUE); + proto_tree_add_item (ietree, hf_marvell_ie_mesh_active_metric_id, tvb, offset++, 1, TRUE); + proto_tree_add_item (ietree, hf_marvell_ie_mesh_cap, tvb, offset++, 1, TRUE); + break; + } +} + static void dissect_vendor_ie_aironet(proto_item * aironet_item, proto_tree * ietree, tvbuff_t * tvb, int offset, guint32 tag_len) @@ -2207,6 +2320,9 @@ case OUI_CISCOWL: /* Cisco Wireless (Aironet) */ dissect_vendor_ie_aironet(ti, tree, tvb, offset + 5, tag_len - 3); break; + case OUI_MARVELL: + dissect_vendor_ie_marvell(ti, tree, tvb, offset + 5, tag_len - 3); + break; default: tag_data_ptr = tvb_get_ptr(tag_tvb, 0, 3); proto_tree_add_bytes_format (tree, tag_oui, tvb, offset + 2, 3, @@ -2550,6 +2666,42 @@ offset = 4; /* Size of fixed fields */ break; + case CAT_VENDOR_SPECIFIC: /* Vendor Specific Category */ + switch (tvb_get_guint8(tvb, 4)) + { + /* defined values */ + case MRVL_ACTION_MESH_MANAGEMENT: + switch (tvb_get_guint8(tvb,5)) /* Action Detail, or Action Code */ + { + case MRVL_MESH_MGMT_ACTION_RREQ: + fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 44); + add_fixed_field (fixed_tree, tvb, 0, FIELD_CATEGORY_CODE); + add_fixed_field (fixed_tree, tvb, 1, FIELD_VENDOR_OUI); + add_fixed_field (fixed_tree, tvb, 4, FIELD_ACTION_TYPE); + add_fixed_field (fixed_tree, tvb, 5, FIELD_MESH_RREQ); + offset = 44; /* Size of fixed fields */ + break; + case MRVL_MESH_MGMT_ACTION_RREP: + fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 38); + add_fixed_field (fixed_tree, tvb, 0, FIELD_CATEGORY_CODE); + add_fixed_field (fixed_tree, tvb, 1, FIELD_VENDOR_OUI); + add_fixed_field (fixed_tree, tvb, 4, FIELD_ACTION_TYPE); + add_fixed_field (fixed_tree, tvb, 5, FIELD_MESH_RREP); + offset = 38; /* Size of fixed fields */ + break; + case MRVL_MESH_MGMT_ACTION_RERR: + fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 19); + add_fixed_field (fixed_tree, tvb, 0, FIELD_CATEGORY_CODE); + add_fixed_field (fixed_tree, tvb, 1, FIELD_VENDOR_OUI); + add_fixed_field (fixed_tree, tvb, 4, FIELD_ACTION_TYPE); + add_fixed_field (fixed_tree, tvb, 5, FIELD_MESH_RERR); + offset = 19; /* Size of fixed fields */ + break; + } + break; + } + break; + default: fixed_tree = get_fixed_parameter_tree (mgt_tree, tvb, 0, 1); add_fixed_field (fixed_tree, tvb, 0, FIELD_CATEGORY_CODE); @@ -4133,6 +4285,7 @@ {CAT_DLS, "DLS"}, {CAT_BLOCK_ACK, "Block Ack"}, {CAT_MGMT_NOTIFICATION, "Management notification frame"}, + {CAT_VENDOR_SPECIFIC, "Vendor specific action frame"}, {0, NULL} }; @@ -4145,6 +4298,29 @@ {0, NULL} }; + static const value_string vendor_action_types[] ={ + {MRVL_ACTION_MESH_MANAGEMENT, "Mesh Management"}, + {0, NULL} + }; + + static const value_string mesh_mgt_action_codes[] ={ + {MRVL_MESH_MGMT_ACTION_RREQ, "Route Request"}, + {MRVL_MESH_MGMT_ACTION_RREP, "Route Response"}, + {MRVL_MESH_MGMT_ACTION_RERR, "Route Error"}, + {MRVL_MESH_MGMT_ACTION_PLDM, "Peer Link Down"}, + {0, NULL} + }; + + static const value_string mesh_path_selection_codes[] ={ + {0x0, "Hybrid Wireless Mesh Protocol"}, + {0, NULL} + }; + + static const value_string mesh_metric_codes[] ={ + {0x0, "Airtime Link Metric"}, + {0, NULL} + }; + static const value_string wme_action_codes[] = { {0x00, "Setup request"}, {0x01, "Setup response"}, @@ -4583,11 +4759,77 @@ FT_UINT16, BASE_DEC, VALS (&category_codes), 0, "Management action category", HFILL }}, + {&ff_vendor_oui, + {"Vendor OUI", "wlan_mgt.fixed.vendor_oui", + FT_BYTES, BASE_NONE, NULL, 0, "OUI of vendor specific Mgmt Frame", HFILL }}, + {&ff_action_code, {"Action code", "wlan_mgt.fixed.action_code", FT_UINT16, BASE_DEC, VALS (&action_codes), 0, "Management action code", HFILL }}, + {&ff_action_type, + {"Action type", "wlan_mgt.fixed.action_type", + FT_UINT16, BASE_DEC, VALS (&vendor_action_types), 0, + "Vendor Specific Action Type", HFILL }}, + + {&ff_mesh_mgt_action_code, + {"Mesh action", "wlan_mgt.fixed.mesh_action", + FT_UINT16, BASE_HEX, VALS (&mesh_mgt_action_codes), 0, + "Mesh action code", HFILL }}, + + {&ff_mesh_mgt_length, + {"Message Length", "wlan_mgt.fixed.length", + FT_UINT8, BASE_DEC, NULL, 0, "Message Length", HFILL }}, + + {&ff_mesh_mgt_mode, + {"Message Mode", "wlan_mgt.fixed.mode", + FT_UINT8, BASE_HEX, NULL, 0, "Message Mode", HFILL }}, + + {&ff_mesh_mgt_ttl, + {"Message TTL", "wlan_mgt.fixed.ttl", + FT_UINT8, BASE_DEC, NULL, 0, "Message TTL", HFILL }}, + + {&ff_mesh_mgt_dstcount, + {"Destination Count", "wlan_mgt.fixed.dstcount", + FT_UINT8, BASE_DEC, NULL, 0, "Destination Count", HFILL }}, + + {&ff_mesh_mgt_hopcount, + {"Hop Count", "wlan_mgt.fixed.hopcount", + FT_UINT8, BASE_DEC, NULL, 0, "Hop Count", HFILL }}, + + {&ff_mesh_mgt_rreqid, + {"RREQ ID", "wlan_mgt.fixed.rreqid", + FT_UINT32, BASE_DEC, NULL, 0, "RREQ ID", HFILL }}, + + {&ff_mesh_mgt_sa, + {"Source Address", "wlan_mgt.fixed.sa", + FT_ETHER, BASE_NONE, NULL, 0, "Source MAC address", HFILL }}, + + {&ff_mesh_mgt_ssn, + {"SSN", "wlan_mgt.fixed.ssn", + FT_UINT32, BASE_DEC, NULL, 0, "Source Sequence Number", HFILL }}, + + {&ff_mesh_mgt_metric, + {"Metric", "wlan_mgt.fixed.metric", + FT_UINT32, BASE_DEC, NULL, 0, "Route Metric", HFILL }}, + + {&ff_mesh_mgt_flags, + {"RREQ Flags", "wlan_mgt.fixed.hopcount", + FT_UINT8, BASE_HEX, NULL, 0, "RREQ Flags", HFILL }}, + + {&ff_mesh_mgt_da, + {"Destination Address", "wlan_mgt.fixed.da", + FT_ETHER, BASE_NONE, NULL, 0, "Destination MAC address", HFILL }}, + + {&ff_mesh_mgt_dsn, + {"DSN", "wlan_mgt.fixed.dsn", + FT_UINT32, BASE_DEC, NULL, 0, "Destination Sequence Number", HFILL }}, + + {&ff_mesh_mgt_lifetime, + {"Lifetime", "wlan_mgt.fixed.lifetime", + FT_UINT32, BASE_DEC, NULL, 0, "Route Lifetime", HFILL }}, + {&ff_dialog_token, {"Dialog token", "wlan_mgt.fixed.dialog_token", FT_UINT16, BASE_HEX, NULL, 0, "Management action dialog token", HFILL }}, @@ -4731,6 +4973,30 @@ {"Station Count", "wlan_mgt.qbss2.scount", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }}, + {&hf_marvell_ie_mesh_type, + {"Type", "wlan_mgt.marvell.ie.type", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }}, + + {&hf_marvell_ie_mesh_subtype, + {"Subtype", "wlan_mgt.marvell.ie.subtype", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }}, + + {&hf_marvell_ie_mesh_version, + {"Version", "wlan_mgt.marvell.ie.version", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }}, + + {&hf_marvell_ie_mesh_active_proto_id, + {"Path Selection Protocol", "wlan_mgt.marvell.ie.proto_id", + FT_UINT8, BASE_HEX, VALS(mesh_path_selection_codes), 0, "", HFILL }}, + + {&hf_marvell_ie_mesh_active_metric_id, + {"Path Selection Metric", "wlan_mgt.marvell.ie.metric_id", + FT_UINT8, BASE_HEX, VALS(mesh_metric_codes), 0, "", HFILL }}, + + {&hf_marvell_ie_mesh_cap, + {"Mesh Capabilities", "wlan_mgt.marvell.ie.cap", + FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }}, + {&hf_aironet_ie_qos_unk1, {"Aironet IE QoS unknown1", "wlan_mgt.aironet.qos.unk1", FT_UINT8, BASE_HEX, NULL, 0, "", HFILL }}, diff -Naur wireshark-0.99.5.orig/epan/dissectors/packet-llc.c wireshark-0.99.5/epan/dissectors/packet-llc.c --- wireshark-0.99.5.orig/epan/dissectors/packet-llc.c 2007-02-01 15:00:47.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/packet-llc.c 2007-10-23 12:43:26.000000000 -0700 @@ -210,6 +210,7 @@ { OUI_SIEMENS, "Siemens AG" }, { OUI_APPLE_ATALK, "Apple (AppleTalk)" }, { OUI_HP, "Hewlett-Packard" }, + { OUI_MARVELL, "Marvell Semiconductors" }, { 0, NULL } }; @@ -351,6 +352,7 @@ case OUI_ENCAP_ETHER: case OUI_CISCO_90: case OUI_APPLE_ATALK: + case OUI_MARVELL: /* No, I have no idea why Apple used one of their own OUIs, rather than OUI_ENCAP_ETHER, and an Ethernet @@ -594,6 +596,8 @@ switch (oui) { + case OUI_MARVELL: + pinfo->private_data = (void *) OUI_MARVELL; case OUI_ENCAP_ETHER: case OUI_CISCO_90: case OUI_APPLE_ATALK: @@ -811,6 +815,7 @@ { &hf_llc_pid, { "Protocol ID", "llc.pid", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }}, + }; static gint *ett[] = { &ett_llc, diff -Naur wireshark-0.99.5.orig/epan/dissectors/packet-mesh.c wireshark-0.99.5/epan/dissectors/packet-mesh.c --- wireshark-0.99.5.orig/epan/dissectors/packet-mesh.c 1969-12-31 16:00:00.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/packet-mesh.c 2007-10-23 12:44:03.000000000 -0700 @@ -0,0 +1,149 @@ +/* packet-mesh-header.c + * Routines for Mesh Header dissection + * Javier Cardona + * Copyright 2007, Marvell Semiconductors Inc. + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include + +#include + +#include +#include +#include +#include + +/* Forward declaration we need below */ +void proto_reg_handoff_mesh(void); + +static dissector_table_t mesh_dissector_table = NULL; + +/* Initialize the protocol and registered fields */ +static int proto_mesh = -1; +static int hf_mesh_ttl = -1; +static int hf_mesh_e2eseq = -1; + +/* Initialize the subtree pointers */ +static gint ett_mesh = -1; + +/* Code to actually dissect the packets */ +static int +dissect_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + +/* Set up structures needed to add the protocol subtree and manage it */ + proto_item *ti; + proto_tree *mesh_tree; + guint8 mesh_ttl; + guint16 mesh_e2eseq; + + /* Mesh frames have Marvell OUI in SNAP header */ + if ( (pinfo->ethertype != ETHERTYPE_IP && + pinfo->ethertype != ETHERTYPE_ARP) + || pinfo->private_data != (void*) OUI_MARVELL) + return 0; + +/* Make entries in Protocol column and Info column on summary display */ + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Mesh"); + + if (tree) { + + /* create display subtree for the protocol */ + ti = proto_tree_add_item(tree, proto_mesh, tvb, 0, -1, FALSE); + + mesh_tree = proto_item_add_subtree(ti, ett_mesh); + + mesh_ttl = tvb_get_guint8(tvb, 2); + mesh_e2eseq = tvb_get_ntohs(tvb, 3); + + /* add an item to the subtree, see section 1.6 for more information */ + proto_tree_add_uint(mesh_tree, + hf_mesh_ttl, tvb, 2, 1, mesh_ttl); + proto_tree_add_uint(mesh_tree, + hf_mesh_e2eseq, tvb, 3, 2, mesh_e2eseq); + } + + /* Return the amount of data this dissector was able to dissect */ + return 5; +} + + +/* Register the protocol with Wireshark */ + +/* this format is require because a script is used to build the C function + that calls all the protocol registration. +*/ + +void +proto_register_mesh(void) +{ + module_t *mesh_module; + +/* Setup list of header fields See Section 1.6.1 for details*/ + static hf_register_info hf[] = { + { &hf_mesh_ttl, + { "Mesh TTL", "mesh.ttl", FT_UINT8, BASE_DEC, + NULL, 0x0, "", HFILL }}, + + { &hf_mesh_e2eseq, + { "Mesh End-to-end Seq", "mesh.e2eseq", FT_UINT16, BASE_HEX, + NULL, 0x0, "", HFILL }}, + }; + +/* Setup protocol subtree array */ + static gint *ett[] = { + &ett_mesh + }; + +/* Register the protocol name and description */ + proto_mesh = proto_register_protocol("Mesh Header", + "Mesh", "mesh"); + +/* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_mesh, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +/* Register preferences module (See Section 2.6 for more on preferences) */ + mesh_module = prefs_register_protocol(proto_mesh, + proto_reg_handoff_mesh); + +} + + +void +proto_reg_handoff_mesh(void) +{ + static gboolean inited = FALSE; + + if (!inited) { + new_register_dissector("mesh", dissect_mesh, proto_mesh); + inited = TRUE; + } +} diff -Naur wireshark-0.99.5.orig/epan/dissectors/register.c wireshark-0.99.5/epan/dissectors/register.c --- wireshark-0.99.5.orig/epan/dissectors/register.c 2007-02-01 15:09:21.000000000 -0800 +++ wireshark-0.99.5/epan/dissectors/register.c 2007-10-23 12:43:26.000000000 -0700 @@ -368,6 +368,7 @@ {extern void proto_register_manolito (void); proto_register_manolito ();} {extern void proto_register_mdshdr (void); proto_register_mdshdr ();} {extern void proto_register_media (void); proto_register_media ();} + {extern void proto_register_mesh (void); proto_register_mesh ();} {extern void proto_register_message_http (void); proto_register_message_http ();} {extern void proto_register_mgmt (void); proto_register_mgmt ();} {extern void proto_register_mip (void); proto_register_mip ();} @@ -1055,6 +1056,7 @@ {extern void proto_reg_handoff_manolito (void); proto_reg_handoff_manolito ();} {extern void proto_reg_handoff_mbtcp (void); proto_reg_handoff_mbtcp ();} {extern void proto_reg_handoff_mdshdr (void); proto_reg_handoff_mdshdr ();} + {extern void proto_reg_handoff_mesh (void); proto_reg_handoff_mesh ();} {extern void proto_reg_handoff_message_http (void); proto_reg_handoff_message_http ();} {extern void proto_reg_handoff_mgmt (void); proto_reg_handoff_mgmt ();} {extern void proto_reg_handoff_mip (void); proto_reg_handoff_mip ();} diff -Naur wireshark-0.99.5.orig/epan/oui.h wireshark-0.99.5/epan/oui.h --- wireshark-0.99.5.orig/epan/oui.h 2007-02-01 15:01:02.000000000 -0800 +++ wireshark-0.99.5/epan/oui.h 2007-10-23 12:43:26.000000000 -0700 @@ -65,6 +65,7 @@ #define OUI_SIEMENS 0x080006 /* Siemens AG */ #define OUI_APPLE_ATALK 0x080007 /* Appletalk */ #define OUI_HP 0x080009 /* Hewlett-Packard */ +#define OUI_MARVELL 0x005043 /* * Defined in packet-llc.c