ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] [Patch] CDP dissector

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Fri, 23 Jun 2006 12:15:59 -0700
I have attached a patch for the CDP (Cisco Discovery Protocol) dissector 
for consideration.  Almost every time that I am looking at CDP frames, 
it is to determine two things: the device name and the port number.  I 
suspect that this is the case for others also.  You have to open the 
tree for CDP, and then open the right two branches.  This patch adds 
these two values to the Info column.

Old info column:

  Cisco Discovery Protocol

New info column:

  Cisco Discovery Protocol  Device ID: switch.domain.com  Port ID: 3/5


Thanks,
  Steve

Index: epan/dissectors/packet-cdp.c
===================================================================
--- epan/dissectors/packet-cdp.c	(revision 18563)
+++ epan/dissectors/packet-cdp.c	(working copy)
@@ -199,6 +199,10 @@
 		proto_tree_add_text(tlv_tree, tvb, offset + 4,
 			    length - 4, "Device ID: %s",
 			    tvb_format_stringzpad(tvb, offset + 4, length - 4));
+		if (check_col(pinfo->cinfo, COL_INFO))
+		    col_append_fstr(pinfo->cinfo, COL_INFO, "  Device ID: %s",
+				    tvb_format_stringzpad(tvb, offset + 4,
+							  length - 4));
 		offset += length;
 		break;
 
@@ -254,6 +258,10 @@
 			    real_length - 4,
 			    "Sent through Interface: %s",
 			    tvb_format_text(tvb, offset + 4, real_length - 4));
+		if (check_col(pinfo->cinfo, COL_INFO))
+		    col_append_fstr(pinfo->cinfo, COL_INFO, "  Port ID: %s",
+				    tvb_format_text(tvb, offset + 4,
+						    real_length - 4));
 		offset += real_length;
 		break;