aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhannes <hannes@localhost>1999-01-04 20:07:29 +0000
committerhannes <hannes@localhost>1999-01-04 20:07:29 +0000
commit5fdf1b9532827f38cd9585d3d051cd2d50ab480e (patch)
tree39373f5e9ca2551bcb71221baf2a17ab3b0a2fb1
parent229245043dc72969f3efe45850f921523ad7af61 (diff)
I've dicovered, that the existing CDP code does not work with Cisco
switches -> dissect_cdp stops a bit earlier... (preventing errors) I have added the line "under development" to the CDP tree svn path=/trunk/; revision=154
-rw-r--r--AUTHORS2
-rw-r--r--packet-cdp.c50
2 files changed, 49 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index bf738c3800..6516df7cc6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,7 +22,7 @@ Hannes R. Boehm <hannes@boehm.org> {
OSPFv2
RIPv1, RIPv2
- started IPv6 support
+ started IPv6 support (help needed - I don't have IPv6)
}
Mike Hall <mlh@io.com>{
diff --git a/packet-cdp.c b/packet-cdp.c
index e72ffeb265..a8c28a5070 100644
--- a/packet-cdp.c
+++ b/packet-cdp.c
@@ -1,8 +1,8 @@
/* packet-cdp.c
- * Routines for
+ * Routines for the disassembly of the "Cisco Discovery Protocoll"
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-cdp.c,v 1.1 1998/12/19 00:12:21 hannes Exp $
+ * $Id: packet-cdp.c,v 1.2 1999/01/04 20:07:28 hannes Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,9 +41,22 @@
#include "ethereal.h"
#include "packet.h"
+
void
dissect_cdp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
GtkWidget *cdp_tree = NULL, *ti;
+ char *version;
+ char *hostname;
+ char *interface;
+
+ typedef struct _e_tlv_struct{
+ short type;
+ short length;
+ } e_tlv_struct;
+
+ e_tlv_struct *tlv;
+ int i,j;
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "CDP");
@@ -55,6 +68,39 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) {
"Cisco Discovery Protocoll");
cdp_tree = gtk_tree_new();
add_subtree(ti, cdp_tree, ETT_CDP);
+
+ version=(char *) &pd[offset];
+ hostname=(char *) &pd[offset+8];
+ interface=(char *) &pd[offset+34];
+
+ add_item_to_tree(cdp_tree, offset, 0, "under development (hannes@boehm.org)");
+ add_item_to_tree(cdp_tree, offset, 1, "Version: %d", *version);
+ add_item_to_tree(cdp_tree, offset+8, 1, "Chassis ID: %s", hostname);
+ add_item_to_tree(cdp_tree, offset+34, 1, "Interface: %s", interface);
+
+ /* CVS -> exit here
+ dissect_data(pd, offset, fd, (GtkTree *) cdp_tree);
+ return;
+ */
+
+ i=4;
+ j=0;
+ while(i < 1500 ){
+ tlv = (e_tlv_struct *) &pd[offset+i];
+ add_item_to_tree(cdp_tree, offset+i, 2, "Type: %d", ntohs(tlv->type));
+ add_item_to_tree(cdp_tree, offset+i+2, 2, "Length: %d", ntohs(tlv->length));
+ if( (ntohs(tlv->type) == 0) && j==0) {
+ j=1;
+ i+= ntohs(tlv->length) + 4;
+ } else if( (ntohs(tlv->type) == 0) && j==1) {
+ j=0;
+ i+= 4;
+ } else {
+ i+= ntohs(tlv->length) + 4;
+ }
+
+ }
+
dissect_data(pd, offset, fd, (GtkTree *) cdp_tree);
}
}