IP Prefix field support in CDP, from Paul Ionescu.

svn path=/trunk/; revision=2830
This commit is contained in:
Guy Harris 2001-01-05 19:14:05 +00:00
parent bde0b86caf
commit b97efe8d42
2 changed files with 27 additions and 1 deletions

View File

@ -335,6 +335,7 @@ Paul Ionescu <paul@acorp.ro> {
X.25-over-TCP support
DEC LANBridge Spanning Tree Protocol support
X.25-over-LLC support
IP Prefix field support in CDP
}
Mark Burton <markb@ordern.com> {

View File

@ -2,7 +2,7 @@
* Routines for the disassembly of the "Cisco Discovery Protocol"
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
* $Id: packet-cdp.c,v 1.29 2001/01/03 06:55:27 guy Exp $
* $Id: packet-cdp.c,v 1.30 2001/01/05 19:14:05 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -76,6 +76,7 @@ add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
#define TYPE_CAPABILITIES 0x0004
#define TYPE_IOS_VERSION 0x0005
#define TYPE_PLATFORM 0x0006
#define TYPE_IP_PREFIX 0x0007
static const value_string type_vals[] = {
{ TYPE_DEVICE_ID, "Device ID" },
@ -84,6 +85,7 @@ static const value_string type_vals[] = {
{ TYPE_CAPABILITIES, "Capabilities" },
{ TYPE_IOS_VERSION, "Software version" },
{ TYPE_PLATFORM, "Platform" },
{ TYPE_IP_PREFIX, "IP Prefix (used for ODR)" },
{ 0, NULL },
};
@ -251,7 +253,30 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_get_ptr(tvb, offset + 4, length - 4));
offset += length;
break;
case TYPE_IP_PREFIX:
tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
length, "IP Prefixes: %d",length/5);
/* the actual number of prefixes is (length-4)/5
but if the variable is not a "float" but "integer"
then length/5=(length-4)/5 :) */
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);
offset += 4;
length -= 4;
while (length > 0) {
proto_tree_add_text(tlv_tree, tvb, offset, 5,
"IP Prefix = %s/%u",
ip_to_str(tvb_get_ptr(tvb, offset, 4)),
tvb_get_guint8(tvb,offset+4));
offset += 5;
length -= 5;
}
break;
default:
tlvi = proto_tree_add_text(cdp_tree, tvb, offset,
length, "Type: %s, length: %u",