Wireshark-bugs: [Wireshark-bugs] [Bug 7113] Update LLDP dissector to display registered OIDs fro
Date: Mon, 16 Apr 2012 08:49:47 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7113 --- Comment #2 from Alex Lindberg <alindber@xxxxxxxxx> 2012-04-16 08:49:47 PDT --- Comment on attachment 8229 --> https://bugs.wireshark.org/bugzilla/attachment.cgi?id=8229 Patch to update packet-lldp.c to backport SVN main to 1.6.8 stream >Index: epan/dissectors/packet-lldp.c >=================================================================== >--- epan/dissectors/packet-lldp.c (revision 42095) >+++ epan/dissectors/packet-lldp.c (working copy) >@@ -31,33 +31,18 @@ > # include "config.h" > #endif > >-#include <gmodule.h> > #include <glib.h> >- > #include <epan/packet.h> > #include <epan/emem.h> > #include <epan/etypes.h> > #include <epan/oui.h> > #include <epan/afn.h> >+#include <epan/addr_resolv.h> >+#include "packet-lldp.h" > >-/* TLV Types */ >-#define END_OF_LLDPDU_TLV_TYPE 0x00 /* Mandatory */ >-#define CHASSIS_ID_TLV_TYPE 0x01 /* Mandatory */ >-#define PORT_ID_TLV_TYPE 0x02 /* Mandatory */ >-#define TIME_TO_LIVE_TLV_TYPE 0x03 /* Mandatory */ >-#define PORT_DESCRIPTION_TLV_TYPE 0x04 >-#define SYSTEM_NAME_TLV_TYPE 0x05 >-#define SYSTEM_DESCRIPTION_TLV_TYPE 0x06 >-#define SYSTEM_CAPABILITIES_TLV_TYPE 0x07 >-#define MANAGEMENT_ADDR_TLV_TYPE 0x08 >-#define ORGANIZATION_SPECIFIC_TLV_TYPE 0x7F >+/* Sub Dissector Tables */ >+static dissector_table_t oui_unique_code_table; > >-/* Masks */ >-#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) >- > /* Initialize the protocol and registered fields */ > static int proto_lldp = -1; > static int hf_lldp_tlv_type = -1; >@@ -106,6 +91,7 @@ > static int hf_profinet_green_period_begin_offset = -1; > static int hf_cisco_subtype = -1; > static int hf_unknown_subtype = -1; >+static int hf_unknown_subtype_content = -1; > > /* Initialize the subtree pointers */ > static gint ett_lldp = -1; >@@ -176,16 +162,6 @@ > { 0, NULL} > }; > >-static const value_string tlv_oui_subtype_vals[] = { >- { OUI_IEEE_802_1, "IEEE 802.1" }, >- { OUI_IEEE_802_3, "IEEE 802.3" }, >- { OUI_MEDIA_ENDPOINT, "TIA" }, >- { OUI_PROFINET, "PROFINET" }, >- { OUI_CISCO_2, "Cisco" }, >- { OUI_IEEE_802_1QBG, "IEEE 802.1Qbg" }, >- { 0, NULL } >-}; >- > /* IEEE 802.1 Subtypes */ > static const value_string ieee_802_1_subtypes[] = { > { 0x01, "Port VLAN ID" }, >@@ -220,14 +196,6 @@ > { 0, NULL } > }; > >-/* IEEE 802.1Qbg Subtypes */ >-static const value_string ieee_802_1qbg_subtypes[] = { >- { 0x00, "EVB" }, >- { 0x01, "CDCP" }, >- { 0, NULL } >-}; >- >- > /* Media Class Values */ > static const value_string media_class_values[] = { > { 0, "Type Not Defined" }, >@@ -607,7 +575,7 @@ > { > tf = proto_tree_add_text(tree, tvb, offset, 2, "Invalid Chassis ID Length (%u)", tempLen); > chassis_tree = proto_item_add_subtree(tf, ett_chassis_id); >- proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >+ proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); > proto_tree_add_text(chassis_tree, tvb, offset, 2, "%s Invalid Length: %u", > decode_boolean_bitfield(tempLen, TLV_INFO_LEN_MASK, 16, "", ""), tempLen); > } >@@ -706,11 +674,11 @@ > { > tf = proto_tree_add_text(tree, tvb, offset, 2, "Invalid Chassis ID Length (%u)", tempLen); > chassis_tree = proto_item_add_subtree(tf, ett_chassis_id); >- proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >+ proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); > proto_tree_add_text(chassis_tree, tvb, offset, 2, "%s Invalid Length: %u", > decode_boolean_bitfield(tempLen, TLV_INFO_LEN_MASK, 16, "", ""), tempLen); > /* Get chassis id subtype */ >- proto_tree_add_item(chassis_tree, hf_chassis_id_subtype, tvb, (offset+2), 1, FALSE); >+ proto_tree_add_item(chassis_tree, hf_chassis_id_subtype, tvb, (offset+2), 1, ENC_BIG_ENDIAN); > > } > >@@ -727,11 +695,11 @@ > val_to_str(tempType, chassis_id_subtypes, "Reserved" )); > chassis_tree = proto_item_add_subtree(tf, ett_chassis_id); > >- proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(chassis_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(chassis_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(chassis_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Get chassis id subtype */ >- proto_tree_add_item(chassis_tree, hf_chassis_id_subtype, tvb, (offset+2), 1, FALSE); >+ proto_tree_add_item(chassis_tree, hf_chassis_id_subtype, tvb, (offset+2), 1, ENC_BIG_ENDIAN); > > /* Get chassis id */ > switch (tempType) >@@ -741,7 +709,7 @@ > proto_item_append_text(tf, ", Id: %s", strPtr); > break; > case 5: /* Network address */ >- proto_tree_add_item(chassis_tree, hf_lldp_network_address_family, tvb, offset+3, 1, FALSE); >+ proto_tree_add_item(chassis_tree, hf_lldp_network_address_family, tvb, offset+3, 1, ENC_BIG_ENDIAN); > switch(addr_family){ > case AFNUM_INET: > proto_tree_add_ipv4(chassis_tree, hf_chassis_id_ip4, tvb, (offset+4), 4, ip_addr); >@@ -762,7 +730,7 @@ > break; > case 1: /* Chassis component */ > case 3: /* Port component */ >- proto_tree_add_item(chassis_tree, hf_chassis_id, tvb, (offset+3), (tempLen-1), FALSE); >+ proto_tree_add_item(chassis_tree, hf_chassis_id, tvb, (offset+3), (tempLen-1), ENC_NA); > break; > } > } >@@ -853,11 +821,11 @@ > val_to_str(tempType, port_id_subtypes, "Unknown" )); > port_tree = proto_item_add_subtree(tf, ett_port_id); > >- proto_tree_add_item(port_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(port_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(port_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(port_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Get port id subtype */ >- proto_tree_add_item(port_tree, hf_port_id_subtype, tvb, (offset+2), 1, FALSE); >+ proto_tree_add_item(port_tree, hf_port_id_subtype, tvb, (offset+2), 1, ENC_BIG_ENDIAN); > > /* Get port id */ > /*proto_tree_add_text(port_tree, tvb, (offset+3), (tempLen-1), "Port Id: %s", strPtr);*/ >@@ -872,7 +840,7 @@ > * and an associated network address that are encoded in network octet order. > */ > /* Network address family */ >- proto_tree_add_item(port_tree, hf_lldp_network_address_family, tvb, offset+3, 1, FALSE); >+ proto_tree_add_item(port_tree, hf_lldp_network_address_family, tvb, offset+3, 1, ENC_BIG_ENDIAN); > switch(addr_family){ > case AFNUM_INET: > proto_tree_add_ipv4(port_tree, hf_port_id_ip4, tvb, (offset+4), 4, ip_addr); >@@ -926,18 +894,18 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "Time To Live = %u sec", tempShort); > time_to_live_tree = proto_item_add_subtree(tf, ett_time_to_live); > >- proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(time_to_live_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Display time to live information */ >- proto_tree_add_item(time_to_live_tree, hf_time_to_live, tvb, (offset+2), 2, FALSE); >+ proto_tree_add_item(time_to_live_tree, hf_time_to_live, tvb, (offset+2), 2, ENC_BIG_ENDIAN); > } > > return (tempLen + 2); > } > > /* Dissect End of LLDPDU TLV (Mandatory) */ >-static gint32 >+gint32 > dissect_lldp_end_of_lldpdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) > { > guint16 tempLen; >@@ -958,8 +926,8 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "End of LLDPDU"); > end_of_lldpdu_tree = proto_item_add_subtree(tf, ett_end_of_lldpdu); > >- proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(end_of_lldpdu_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > } > > return -1; /* Force the lldp dissector to terminate */ >@@ -990,8 +958,8 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "Port Description = %s", strPtr); > port_desc_tree = proto_item_add_subtree(tf, ett_port_description); > >- proto_tree_add_item(port_desc_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(port_desc_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(port_desc_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(port_desc_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Display port description information */ > proto_tree_add_text(port_desc_tree, tvb, (offset+2), tempLen, "Port Description: %s", >@@ -1033,8 +1001,8 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "System Description = %s", strPtr); > system_name_tree = proto_item_add_subtree(tf, ett_system_name); > >- proto_tree_add_item(system_name_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(system_name_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(system_name_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(system_name_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Display system name information */ > proto_tree_add_text(system_name_tree, tvb, (offset+2), tempLen, "%s = %s", >@@ -1073,8 +1041,8 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "Capabilities"); > system_capabilities_tree = proto_item_add_subtree(tf, ett_system_cap); > >- proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(system_capabilities_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Display system capability information */ > tf = proto_tree_add_text(system_capabilities_tree, tvb, (offset+2), 2, "Capabilities: 0x%04x", tempCapability); >@@ -1183,8 +1151,8 @@ > tf = proto_tree_add_text(tree, tvb, tempOffset, (tempLen + 2), "Management Address"); > system_mgm_addr = proto_item_add_subtree(tf, ett_management_address); > >- proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_type, tvb, tempOffset, 2, FALSE); >- proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_len, tvb, tempOffset, 2, FALSE); >+ proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_type, tvb, tempOffset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(system_mgm_addr, hf_lldp_tlv_len, tvb, tempOffset, 2, ENC_BIG_ENDIAN); > > tempOffset += 2; > >@@ -1207,13 +1175,13 @@ > { > /* XXX - Should we throw an exception if stringLen doesn't match our address length? */ > case 1: /* IPv4 */ >- proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv4, tvb, tempOffset, 4, FALSE); >+ proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv4, tvb, tempOffset, 4, ENC_BIG_ENDIAN); > break; > case 2: /* IPv6 */ >- proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv6, tvb, tempOffset, 16, FALSE); >+ proto_tree_add_item(system_mgm_addr, hf_mgn_addr_ipv6, tvb, tempOffset, 16, ENC_NA); > break; > default: >- proto_tree_add_item(system_mgm_addr, hf_mgn_addr_hex, tvb, tempOffset, (stringLen-1), FALSE); >+ proto_tree_add_item(system_mgm_addr, hf_mgn_addr_hex, tvb, tempOffset, (stringLen-1), ENC_NA); > break; > } > >@@ -1242,7 +1210,7 @@ > tempOffset++; > > /* Get OID identifier */ >- proto_tree_add_item(system_mgm_addr, hf_mgn_obj_id, tvb, tempOffset, stringLen, FALSE); >+ proto_tree_add_item(system_mgm_addr, hf_mgn_obj_id, tvb, tempOffset, stringLen, ENC_NA); > } > } > >@@ -1265,7 +1233,7 @@ > subType = tvb_get_guint8(tvb, tempOffset); > > if (tree) >- proto_tree_add_item(tree, hf_ieee_802_1_subtype, tvb, tempOffset, 1, FALSE); >+ proto_tree_add_item(tree, hf_ieee_802_1_subtype, tvb, tempOffset, 1, ENC_BIG_ENDIAN); > > tempOffset++; > >@@ -1359,6 +1327,15 @@ > > /* Dissect IEEE 802.1Qbg TLVs */ > static void >+dissect_oui_default_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) >+{ >+ guint8 subType; >+ subType = tvb_get_guint8(tvb, offset); >+ proto_tree_add_uint(tree, hf_unknown_subtype, tvb, offset, 1, subType); >+ proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, (offset+1), -1, ENC_NA); >+} >+ >+static void > dissect_ieee_802_1qbg_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) > { > guint8 subType; >@@ -1369,11 +1346,10 @@ > proto_tree *evb_capabilities_subtree = NULL; > > proto_item *tf = NULL; >- > subType = tvb_get_guint8(tvb, tempOffset); > > if (tree) >- proto_tree_add_item(tree, hf_ieee_802_1qbg_subtype, tvb, tempOffset, 1, FALSE); >+ proto_tree_add_item(tree, hf_ieee_802_1qbg_subtype, tvb, tempOffset, 1, ENC_BIG_ENDIAN); > > tempOffset++; > >@@ -1474,24 +1450,25 @@ > > /* Dissect IEEE 802.3 TLVs */ > static void >-dissect_ieee_802_3_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint16 tlvLen) >+dissect_ieee_802_3_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) > { > guint8 subType; > guint8 tempByte; > guint16 tempShort; > guint32 tempLong; > guint32 tempOffset = offset; >+ guint16 tlvLen = tvb_length(tvb)-offset; > > proto_tree *mac_phy_flags = NULL; > proto_tree *autoneg_advertised_subtree = NULL; > > proto_item *tf = NULL; >- >+ return; > /* Get subtype */ > subType = tvb_get_guint8(tvb, tempOffset); > > if (tree) >- proto_tree_add_item(tree, hf_ieee_802_3_subtype, tvb, tempOffset, 1, FALSE); >+ proto_tree_add_item(tree, hf_ieee_802_3_subtype, tvb, tempOffset, 1, ENC_BIG_ENDIAN); > > tempOffset++; > >@@ -1870,9 +1847,10 @@ > > /* Dissect Media TLVs */ > static void >-dissect_media_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint16 tlvLen) >+dissect_media_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) > { > guint32 tempOffset = offset; >+ guint16 tlvLen = tvb_length(tvb)-offset; > guint8 subType; > guint16 tempShort; > guint16 tempVLAN; >@@ -1884,11 +1862,10 @@ > > proto_tree *media_flags = NULL; > proto_item *tf = NULL; >- > /* Get subtype */ > subType = tvb_get_guint8(tvb, tempOffset); > if (tree) >- proto_tree_add_item(tree, hf_media_tlv_subtype, tvb, tempOffset, 1, FALSE); >+ proto_tree_add_item(tree, hf_media_tlv_subtype, tvb, tempOffset, 1, ENC_BIG_ENDIAN); > tempOffset++; > tlvLen--; > >@@ -2414,7 +2391,7 @@ > > /* Dissect PROFINET TLVs */ > static void >-dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint16 tlvLen2) >+dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset) > { > guint8 subType; > proto_item *tf = NULL; >@@ -2539,7 +2516,7 @@ > break; > } > default: >- proto_tree_add_item(tree, hf_unknown_subtype, tvb, offset, tlvLen2-1, FALSE); >+ proto_tree_add_item(tree, hf_unknown_subtype, tvb, offset, -1, ENC_NA); > } > } > >@@ -2557,7 +2534,7 @@ > /* Get subtype */ > subType = tvb_get_guint8(tvb, tempOffset); > >- proto_tree_add_item(tree, hf_cisco_subtype, tvb, tempOffset, 1, FALSE); >+ proto_tree_add_item(tree, hf_cisco_subtype, tvb, tempOffset, 1, ENC_BIG_ENDIAN); > > tempOffset++; > >@@ -2591,7 +2568,7 @@ > } > break; > default: >- proto_tree_add_item(tree, hf_unknown_subtype, tvb, offset, 1, FALSE); >+ proto_tree_add_item(tree, hf_unknown_subtype, tvb, offset, 1, ENC_NA); > break; > } > } >@@ -2602,25 +2579,32 @@ > { > guint16 tempLen; > guint16 tempShort; >- guint32 oui; >+ guint32 oui, tLength = tvb_length(tvb); > guint8 subType; > const char *ouiStr; > const char *subTypeStr; > > proto_tree *org_tlv_tree = NULL; > proto_item *tf = NULL; >- > /* Get tlv type and length */ > tempShort = tvb_get_ntohs(tvb, offset); > > /* Get tlv length */ > tempLen = TLV_INFO_LEN(tempShort); >- > /* Get OUI value */ > oui = tvb_get_ntoh24(tvb, (offset+2)); > subType = tvb_get_guint8(tvb, (offset+5)); > >+ /* check for registered dissectors for the OUI If none found continue, else call dissector */ >+ if( dissector_try_uint(oui_unique_code_table, oui, tvb, pinfo, tree) ) { >+ return tLength; >+ } >+ /* maintain previous OUI names. If not included, look in manuf database for OUI */ > ouiStr = val_to_str(oui, tlv_oui_subtype_vals, "Unknown"); >+ if (strcmp(ouiStr, "Unknown")==0) { >+ ouiStr = get_manuf_name_if_known(tvb_get_ptr(tvb, (offset+2), 6)); >+ if(ouiStr==NULL) ouiStr="Unknown"; >+ } > switch(oui) > { > case OUI_IEEE_802_1: >@@ -2642,59 +2626,55 @@ > subTypeStr = val_to_str(subType, ieee_802_1qbg_subtypes, "Unknown subtype 0x%x"); > break; > default: >- subTypeStr = "Unknown"; >+ subTypeStr = ep_strdup_printf("Unknown (%d)",subType); > break; > } >- > if (tree) > { >- tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "%s - %s", >- ouiStr, subTypeStr); >+ tf = proto_tree_add_text(tree, tvb, offset, tLength, "%s - %s", ouiStr, subTypeStr); > org_tlv_tree = proto_item_add_subtree(tf, ett_org_spc_tlv); >- >- proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >+ proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); > } > if (tempLen < 4) > { > if (tree) > proto_tree_add_uint_format(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, > tempShort, "TLV Length: %u (too short, must be >= 4)", tempLen); >- >- return (tempLen + 2); >+ return tLength; > } > if (tree) > { >- proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > > /* Display organizational unique id */ >- proto_tree_add_uint(org_tlv_tree, hf_org_spc_oui, tvb, (offset+2), 3, oui); >+ proto_tree_add_uint(org_tlv_tree, hf_org_spc_oui, tvb, (offset + 2), 3, oui); > } > > switch (oui) > { > case OUI_IEEE_802_1: >- dissect_ieee_802_1_tlv(tvb, pinfo, org_tlv_tree, (offset+5)); >+ dissect_ieee_802_1_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > case OUI_IEEE_802_3: >- dissect_ieee_802_3_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3)); >+ dissect_ieee_802_3_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > case OUI_MEDIA_ENDPOINT: >- dissect_media_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3)); >+ dissect_media_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > case OUI_PROFINET: >- dissect_profinet_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3)); >+ dissect_profinet_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > case OUI_CISCO_2: >- dissect_cisco_tlv(tvb, pinfo, org_tlv_tree, (offset+5)); >+ dissect_cisco_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > case OUI_IEEE_802_1QBG: >- dissect_ieee_802_1qbg_tlv(tvb, pinfo, org_tlv_tree, (offset+5)); >+ dissect_ieee_802_1qbg_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > break; > default: >- proto_tree_add_item(org_tlv_tree, hf_unknown_subtype, tvb, (offset+5), (guint16) (tempLen-3), FALSE); >+ dissect_oui_default_tlv(tvb, pinfo, org_tlv_tree, (offset + 5)); > } > >- return (tempLen + 2); >+ return offset + tvb_length(tvb); > } > > /* Dissect Unknown TLV */ >@@ -2718,8 +2698,8 @@ > tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "Unknown TLV"); > unknown_tlv_tree = proto_item_add_subtree(tf, ett_unknown_tlv); > >- proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); >- proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); >+ proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); >+ proto_tree_add_item(unknown_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN); > } > > return (tempLen + 2); >@@ -2732,7 +2712,7 @@ > { > proto_item *ti; > proto_tree *lldp_tree = NULL; >- >+ tvbuff_t *new_tvb = NULL; > guint32 offset = 0; > gint32 rtnValue = 0; > guint16 tempShort; >@@ -2746,7 +2726,7 @@ > > if (tree) > { >- ti = proto_tree_add_item(tree, proto_lldp, tvb, offset, -1, FALSE); >+ ti = proto_tree_add_item(tree, proto_lldp, tvb, offset, -1, ENC_NA); > lldp_tree = proto_item_add_subtree(ti, ett_lldp); > } > >@@ -2788,45 +2768,46 @@ > { > tempShort = tvb_get_ntohs(tvb, offset); > tempType = TLV_TYPE(tempShort); >- >+ /* pass only TLV to dissectors, Zero offset (point to front of tlv) */ >+ new_tvb = tvb_new_subset(tvb, offset, TLV_INFO_LEN(tempShort)+2, TLV_INFO_LEN(tempShort)+2); > switch (tempType) > { > case CHASSIS_ID_TLV_TYPE: >- rtnValue = dissect_lldp_chassis_id(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_chassis_id(new_tvb, pinfo, lldp_tree, 0); > rtnValue = -1; /* Duplicate chassis id tlv */ > col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Chassis ID TLV"); > break; > case PORT_ID_TLV_TYPE: >- rtnValue = dissect_lldp_port_id(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_port_id(new_tvb, pinfo, lldp_tree, 0); > rtnValue = -1; /* Duplicate port id tlv */ > col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Port ID TLV"); > break; > case TIME_TO_LIVE_TLV_TYPE: >- rtnValue = dissect_lldp_time_to_live(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_time_to_live(new_tvb, pinfo, lldp_tree, 0); > rtnValue = -1; /* Duplicate time-to-live tlv */ > col_set_str(pinfo->cinfo, COL_INFO, "Duplicate Time-To-Live TLV"); > break; > case END_OF_LLDPDU_TLV_TYPE: >- rtnValue = dissect_lldp_end_of_lldpdu(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_end_of_lldpdu(new_tvb, pinfo, lldp_tree, 0); > break; > case PORT_DESCRIPTION_TLV_TYPE: >- rtnValue = dissect_lldp_port_desc(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_port_desc(new_tvb, pinfo, lldp_tree, 0); > break; > case SYSTEM_NAME_TLV_TYPE: > case SYSTEM_DESCRIPTION_TLV_TYPE: >- rtnValue = dissect_lldp_system_name(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_system_name(new_tvb, pinfo, lldp_tree, 0); > break; > case SYSTEM_CAPABILITIES_TLV_TYPE: >- rtnValue = dissect_lldp_system_capabilities(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_system_capabilities(new_tvb, pinfo, lldp_tree, 0); > break; > case MANAGEMENT_ADDR_TLV_TYPE: >- rtnValue = dissect_lldp_management_address(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_management_address(new_tvb, pinfo, lldp_tree, 0); > break; > case ORGANIZATION_SPECIFIC_TLV_TYPE: >- rtnValue = dissect_organizational_specific_tlv(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_organizational_specific_tlv(new_tvb, pinfo, lldp_tree, 0); > break; > default: >- rtnValue = dissect_lldp_unknown_tlv(tvb, pinfo, lldp_tree, offset); >+ rtnValue = dissect_lldp_unknown_tlv(new_tvb, pinfo, lldp_tree, 0); > break; > } > >@@ -2909,12 +2890,12 @@ > NULL, 0, NULL, HFILL } > }, > { &hf_mgn_obj_id, >- { "Object Identifier", "lldp.mgn.obj.id", FT_BYTES, BASE_NONE, >+ { "Object Identifier", "lldp.mgn.obj.id", FT_OID, BASE_NONE, > NULL, 0, NULL, HFILL } > }, > { &hf_org_spc_oui, > { "Organization Unique Code", "lldp.orgtlv.oui", FT_UINT24, BASE_HEX, >- VALS(tlv_oui_subtype_vals), 0x0, NULL, HFILL } >+ NULL, 0x0, NULL, HFILL } > }, > { &hf_ieee_802_1_subtype, > { "IEEE 802.1 Subtype", "lldp.ieee.802_1.subtype", FT_UINT8, BASE_HEX, >@@ -3025,9 +3006,13 @@ > VALS(cisco_subtypes), 0x0, NULL, HFILL } > }, > { &hf_unknown_subtype, >- { "Unknown Subtype Content","lldp.unknown_subtype", FT_BYTES, BASE_NONE, >+ { "Unknown Subtype","lldp.unknown_subtype", FT_UINT8, BASE_DEC, > NULL, 0x0, NULL, HFILL } > }, >+ { &hf_unknown_subtype_content, >+ { "Unknown Subtype Content","lldp.unknown_subtype.content", FT_BYTES, BASE_NONE, >+ NULL, 0x0, NULL, HFILL } >+ }, > }; > > /* Setup protocol subtree array */ >@@ -3062,6 +3047,7 @@ > /* Required function calls to register the header fields and subtrees used */ > proto_register_field_array(proto_lldp, hf, array_length(hf)); > proto_register_subtree_array(ett, array_length(ett)); >+ oui_unique_code_table = register_dissector_table("lldp.orgtlv.oui", "LLDP OUI", FT_UINT24, BASE_HEX ); > } > > void -- Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
- References:
- Prev by Date: [Wireshark-bugs] [Bug 7113] Update LLDP dissector to display registered OIDs from manuf and allow custom dissectors for Organizationally Specific TLVs
- Next by Date: [Wireshark-bugs] [Bug 7115] New: 802.11s Decoding Bug (Mesh Control Field)
- Previous by thread: [Wireshark-bugs] [Bug 7113] Update LLDP dissector to display registered OIDs from manuf and allow custom dissectors for Organizationally Specific TLVs
- Next by thread: [Wireshark-bugs] [Bug 7113] Update LLDP dissector to display registered OIDs from manuf and allow custom dissectors for Organizationally Specific TLVs
- Index(es):