aboutsummaryrefslogtreecommitdiffstats
path: root/packet-cdp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-01-05 19:14:05 +0000
committerGuy Harris <guy@alum.mit.edu>2001-01-05 19:14:05 +0000
commitb97efe8d42237f11726ff4a46f476b394c58122b (patch)
tree8f4c40a6c4479bd78abdb911eb6075aa89975d00 /packet-cdp.c
parentbde0b86cafedde7f055dae4122667a986107c980 (diff)
IP Prefix field support in CDP, from Paul Ionescu.
svn path=/trunk/; revision=2830
Diffstat (limited to 'packet-cdp.c')
-rw-r--r--packet-cdp.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/packet-cdp.c b/packet-cdp.c
index 4a6475014c..899513d903 100644
--- a/packet-cdp.c
+++ b/packet-cdp.c
@@ -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",