[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    tcpdump/print-cdp.c
From:       Steffen Wendzel <cdp_xe () gmx ! net>
Date:       2006-06-29 18:15:07
Message-ID: 20060629200841.5e60ddec.cdp_xe () gmx ! net
[Download RAW message or body]

hi,

I currently play with cisco discovery protocol using tcpdump for finding bugs
in my packets. I just improved the capability output for tcpdump. I am sorry,
but I was not able to test the code: I just was able to compile print.cdp using
gcc -c -Wall print-cdp.c because I still run 3.6 i386 and the only current thing
here is the tcpdump cvs checkout. I was not able to update the whole system
using my damn 56k modem connection.

Here is my very small patch. I don't think, that there should be a bug in this
simple pice of code.

Index: print-cdp.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/print-cdp.c,v
retrieving revision 1.2
diff -u -p -r1.2 print-cdp.c
--- print-cdp.c	30 May 2001 23:22:46 -0000	1.2
+++ print-cdp.c	29 Jun 2006 18:01:06 -0000
@@ -99,6 +99,34 @@ cdp_print(const u_char *p, u_int length,
 			break;
 		case 0x04:
 			printf(" CAP 0x%02x", (unsigned) p[i+7]);
+			if (!vflag)
+				break;
+			switch (p[i+7]) {
+			case 0x01:
+				printf("(Router)");
+				break;
+			case 0x02:
+				printf("(Transparent Bridge)");
+				break;
+			case 0x04:
+				printf("(Source Route Bridge)");
+				break;
+			case 0x08:
+				printf("(Switch)");
+				break;
+			case 0x10:
+				printf("(Host)");
+				break;
+			case 0x20:
+				printf("(IGMP Capable)");
+				break;
+			case 0x40:
+				printf("(Repeater)");
+				break;
+			default:
+				/* unknown */
+				break;
+			}
 			break;
 		case 0x05:
 			if (vflag)







-- 

http://cdp.doomed-reality.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic