Ethereal-dev: [Ethereal-dev] packet-cdp.c: added types 0x000a (Native VLAN), 0x000b (Duplex)
kent@xxxxxxxxxxx (Kent Engström) writes:
> The type is guessed in tcpdump's print-cdp.c, and it appears to be
> correct on our network. I won't add the other types which I can't
> verify.
I've now checked the remaining two types from tcpdump against captures
and submit the following patch, which also changes an
add_multi_line_string_to_tree to a proto_tree_add_text in my last
patch:
Index: packet-cdp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-cdp.c,v
retrieving revision 1.33
diff -u -r1.33 packet-cdp.c
--- packet-cdp.c 2001/01/13 02:40:55 1.33
+++ packet-cdp.c 2001/01/15 17:42:01
@@ -79,6 +79,8 @@
#define TYPE_IP_PREFIX 0x0007
#define TYPE_VTP_MGMT_DOMAIN 0x0009 /* Guessed, from tcpdump */
+#define TYPE_NATIVE_VLAN 0x000a /* Guessed, from tcpdump */
+#define TYPE_DUPLEX 0x000b /* Guessed, from tcpdump */
static const value_string type_vals[] = {
{ TYPE_DEVICE_ID, "Device ID" },
@@ -89,6 +91,8 @@
{ TYPE_PLATFORM, "Platform" },
{ TYPE_IP_PREFIX, "IP Prefix (used for ODR)" },
{ TYPE_VTP_MGMT_DOMAIN, "VTP Management Domain" },
+ { TYPE_NATIVE_VLAN, "Native VLAN" },
+ { TYPE_DUPLEX, "Duplex" },
{ 0, NULL },
};
@@ -290,8 +294,40 @@
offset + TLV_TYPE, 2, type);
proto_tree_add_uint(tlv_tree, hf_cdp_tlvlength, tvb,
offset + TLV_LENGTH, 2, length);
- add_multi_line_string_to_tree(tlv_tree, tvb, offset + 4,
- length - 4, "VTP Management Domain: ");
+ proto_tree_add_text(tlv_tree, tvb, offset + 4,
+ length - 4, "VTP Management Domain: %.*s",
+ length - 4,
+ tvb_get_ptr(tvb, offset + 4, length - 4));
+ offset += length;
+ break;
+ case TYPE_NATIVE_VLAN:
+ tlvi = proto_tree_add_text(cdp_tree, tvb,
+ offset, length, "Native VLAN: %u",
+ tvb_get_ntohs(tvb, offset + 4));
+ tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ proto_tree_add_uint(tlv_tree, hf_cdp_tlvtype, tvb,
+ offset + TLV_TYPE, 2, type);
+ proto_tree_add_uint(tlv_tree, hf_cdp_tlvlength, tvb,
+ offset + TLV_LENGTH, 2, length);
+ proto_tree_add_text(tlv_tree, tvb, offset + 4,
+ length - 4, "Native VLAN: %u",
+ tvb_get_ntohs(tvb, offset + 4));
+ offset += length;
+ break;
+ case TYPE_DUPLEX:
+ tlvi = proto_tree_add_text(cdp_tree, tvb,
+ offset, length, "Duplex: %s",
+ tvb_get_guint8(tvb, offset + 4) ?
+ "Full" : "Half" );
+ tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
+ proto_tree_add_uint(tlv_tree, hf_cdp_tlvtype, tvb,
+ offset + TLV_TYPE, 2, type);
+ proto_tree_add_uint(tlv_tree, hf_cdp_tlvlength, tvb,
+ offset + TLV_LENGTH, 2, length);
+ proto_tree_add_text(tlv_tree, tvb, offset + 4,
+ length - 4, "Duplex: %s",
+ tvb_get_guint8(tvb, offset + 4) ?
+ "Full" : "Half" );
offset += length;
break;
default:
--
Kent Engström, Linköping University Incident Response Team
kent@xxxxxxxxxxx abuse@xxxxxx
+46 13 28 1744
UNIT, Linköping University; SE-581 83 LINKÖPING; SWEDEN