• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cdprs/H16-Feb-2010-25097

COPYINGH A D06-Dec-200317.9 KiB341281

Cdpr.dspH A D06-Dec-20034.3 KiB135112

Cdpr.dswH A D06-Dec-2003533 3019

INSTALLH A D15-Feb-2010316 158

MakefileH A D15-Feb-2010712 266

READMEH A D15-Feb-20106.3 KiB174117

README.Win32H A D06-Dec-2003753 2819

README.cdprsH A D19-Sep-20082.3 KiB5438

XGetopt.cH A D03-May-20225.6 KiB19760

XGetopt.hH A D03-May-2022596 246

cdp.hH A D03-May-20222.2 KiB7342

cdpr.cH A D03-May-202218.3 KiB782605

cdpr.confH A D29-Jul-200632 21

cdpr.hH A D03-May-20221.6 KiB6826

cdprs.cH A D03-May-20224.8 KiB260199

conffile.cH A D03-May-20223.7 KiB201125

u_ints.hH A D03-May-20221.1 KiB284

README

1cdpr - Cisco Discovery Protocol Reporter
2Copyright (c) 2002-2008 MonkeyMental.com
3
4*Version 2.4
5
6Work around OSX buffering issue that prevented the bpf interface from passing the packets up to the decoder
7
8Allow reading from a pcap file using -r for debugging purposes.
9
10*Version 2.3
11
12Decode IPv6 responses in the CDP packet and send them in the http response if
13using cdpr server updates.
14
15Sample of GET request:
16?switch_ip=6x.3x.2xx.2xx&switch_ip6=fxxx::2xx:cxxx:fxxx:2xxx&switch_ip6=2xxx:1xxx:2xx::1&port=GigabitEthernet1%2F45&host=monkeymental.com
17
18*Version 2.2.1
19
20Fixed the logic that will select a default port of 80 if no port is specified.
21Updated copyrights and license details on all source files with the exception
22of the MS Visual Studio project files. I'm unsure if I can add license and
23copyright info to these files and still have them work. However, these are
24not source files, so think of them as nothing more than Makefiles for Visual
25Studio.
26
27*Version 2.2.0
28
29Added the ability to specify what port to send the updates to.
30
31*Version 2.1.0
32
33This version provides the ability to include a timeout so that you can put cdpr
34into startup scripts and not have it hang if for some reason a CDP packet is never
35received (i.e. CDP is disabled, machine is plugged into a hub, etc.) The following
36command line option has been added:
37
38-t timeout: Specify a timeout (in seconds) to wait for a CDP packet.
39
40Please note that the default time between CDP packets is 60 seconds so you should
41set your timeout to something greater than 60. There is a default timeout of 5 minutes
42so that should you not provide a timeout, cdpr will still exit if there is no CDP
43packet received within 5 minutes.
44
45This version also allows you to specify the server and URL to send CDP updates to on
46the command line. The following command line options have been added:
47
48-s server: Server to send information to requires -p (overridden by -u)
49-p path: Path of server script to send data to requires -s (overridden by -u)
50
51As you can see if you specify -s, -p and -u on the command line, the config file is actually
52used, and the -s and -p options are ignored. Both the -s and -p options must be specified and
53cdpr will exit if only one of them is given. An example as to how to use the -s and -p flags:
54
55	cdpr -d eth0 -s localhost -p /cgi-bin/cdprs.cgi -t 120
56
57This will listen for a CDP announcement on device eth0 for up to 2 minutes (120 seconds) and
58send the results to the webserver running on the local machine by calling the /cgi-bin/cdprs.cgi
59page.
60
61*Versions 2.0.1 - 2.0.5
62These version were never officially released, they were code cleanups and timeout implementation.
63
64*Version 2.0.0
65
66This version provides the functionallity to report CDP data back to a centralized server.
67Please see the file README.cdprs for details, but in general, the following command line
68options have been added:
69
70-u conf.file: Send updates to the host listed in the config file.
71-l location: Send a location string to help identify the port.
72-n hostname: Override the hostname sent to the server.
73
74Platform Update: Some of the newer HP Switch firmware will broadcast CDP packets. cdpr
75will decode these packets just the same as they would if they came from a Cisco product.
76It was tested on a HP ProCurve 4000M running revision C.09.16.
77
78*Version 1.0.8
79
80Support for ARM processor. Tested on the Sharp Zaurus SL-5500.
81
82*Version 1.0.7
83
84Support for Win32 clients please read README.Win32.
85To support the Win32 clients, modified so that if a network device is not specified
86on the command line with -d, then to find all devices that are capable of being used
87by the pcap libary and provide a selection list.
88
89*Version 1.0.6
90
91Fixed up some more bus errors/segmentation faults.
92
93*Version 1.0.5
94
95Copy packet data to local variable to resolve alignment issues that caused Bus Errors
96on some architectures. cdpr has now been compiled and tested on the following
97Operating Systems:
98 - Linux 2.4.18 (x86)
99 - FreeBSD 4.6 (x86)
100 - Sun Solaris 8 (SPARC)
101 - HP HP-UX 11.11 (PA-Risc)
102 - IBM AIX 4.3.3 (PowerPC)
103
104On some operating systems (like Solaris) the u_int* typedefs are not defined, to resolve
105this issue, include u_ints.h in cdp.h.
106
107On AIX you must load the dlpi kernel module using the following command:
108
109 strload -f /etc/dlpi.conf
110
111On AIX you may recieve some warnings about "Primitive issued in improper state",
112these can be safely ignored.
113
114On HP-UX you may recieve a warning about "any missing unit number", this can be
115safely ignored
116
117*Version 1.0.4
118
119Added 1 ms timeout to pcap_open_live to fix BSD hang issues.
120
121*Version 1.0.3
122
123Loop on pcap_next until a valid packet is received, some implementations of pcap will
124return a null. Patch provided by Martin Buck <martin.buck@ascom.ch>.
125
126*Version 1.0.2
127
128Use a new filter to better identify CDP packets. Solves the majority of the segfaults
129due to trying to decode a non-CDP packet (i.e. a VTP packet)
130
131*Version 1.0.1
132
133Add preprocessor macros to only include the Link Type defines provided by the pcap and
134bpf headers.
135
136*Version 1.0.0
137
138I originally wrote this program to report which switch, and port a machine
139is connected to. In a large environment sometimes it is difficult to determine
140which port on which switch a machine is connected to.
141
142By default (with no command line options) cdpr will determine a network interface
143to open, put into promiscuous mode and wait for a single CDP packet to be received.
144
145On multi-homed machines, you can specify which interface to use with the -d option.
146
147Example (to determine which switch/port eth1 is connected to):
148	cdpr -d eth1
149
150You can dump the whole cdp packet using -v (more v's = more output).
151
152Sample Output:
153cdpr - Cisco Discovery Protocol Reporter Version 1.0.0
154Copyright (c) 2002 - MonkeyMental.com
155
156Using Device: eth0
157Waiting for CDP advertisement, default config is to transmit CDP packets every 60 seconds
158Device ID
159  value:  mtview-3548-access-1.i2.com
160Addresses
161  value:  10.100.230.14
162Port ID
163  value:  FastEthernet0/4
164
165As you can see above, by default CDP packets are broadcast every 60 seconds, cdpr will wait
166until a CDP packet is received.
167
168I hope you find this utility useful. Thanks to Manfred Siemsen for helping to decode the
169packet data.
170
171Regards,
172Lance O'Connor
173lance@monkeymental.com
174

README.Win32

1Version 1.0.8+ update: Supports the WinPcap Version 3.0 release
2
3cdpr version 1.0.7 supports Win32 clients, it has been tested against
4WinPcap version 3.0 alpha 4 (http://winpcap.polito.it/install/default.htm).
5
6I have compiled it with Microsoft Visual C++ 6.0.
7
8To build it from source download the WinPcap Developers Pack version
93.0 alpha 4 and unzip it into the cdpr source tree.
10
11Your directory structure should looks something like this:
12
13\cdpr
14 +-wpdpack
15  +-docs
16  +-Examples
17  +-Include
18  +-Lib
19
20I have included the Workspace files so that you should be able to just
21open cdpr.dsw
22
23When you build it it will create a directory called Release and Debug and
24put the appropriate binaries in each (cdpr.exe)
25
26Lance O'Connor
27lance@monkeymental.com
28

README.cdprs

1Version 2.0.0 of cdpr now supports transmiting the data decoded to a server.
2
3In lieu of writing my own cdpr server, I decided that I would send the data to
4a web server using a GET request. This has several advantages:
5
6 - I didn't have to write a server
7 - You can have your webserver do whatever you want with the data
8 	- Put it in a database
9 	- Log it to a text file
10 	- etc.
11 - You can write your server piece in the language of your choice (PHP, ASP, Perl, C, etc.)
12   as it's just a standard HTTP GET request.
13
14*Details on the config file
15
16The config file should contain one line that has the host to connect to and the relative URL
17to request. For example:
18
19	[cdpr.conf]
20	cdpr_svr.monkeymental.com	/cdprs.php
21	<EOF>
22
23This will instruct cdpr to connect to the machine cdpr_svr.monkeymental.com and request the URL
24/cdprs/cpdrs.php. This would be the same as http://cdpr_svr.monkeymental.com/cdprs/cdprs.php in
25a web browser. The server and the URL should be seperated by a whitespace character (i.e. a [Tab])
26
27*Details on the GET request:
28
29cdpr will execute the following query to port 80 of the server in the config file:
30
31GET /cdprs.php??switch_ip=6x.3x.2xx.2xx&switch_ip6=fxxx::2xx:cxxx:fxxx:2xxx&switch_ip6=2xxx:1xxx:2xx::1&port=GigabitEthernet1%2F45&host=monkeymental.com HTTP/1.0
32
33The request will have the following variables assosciated with it:
34
35switch_ip:	The IP address of the switch the machine running cdpr is connected to.
36switch_ip6: The IPv6 address of the switch the machine running cdpr is connected to (may be more than one.)
37port:		The port that the machine running cdpr is connected to.
38loc:		The optional location identifier passed on the command line using -l
39host:		The hostname of the machine running cdpr (or whatever is passed on the command
40			line if using the hostname override option -n)
41
42How you access this data depends on what language you are writing your scripts in. If you were
43using PHP, you could access them with $_GET["variable"] (i.e. $_GET["switch_ip"]) Once you have
44the data in your web page/cgi script, you can do with it as you wish, such as store it in a text
45file, Populate a SQL database, etc.
46
47*Notes:
48
49A few things to note about the CDPR Server functionallity:
50
51	- Any output from the webserver is ignored
52	- Only one attempt is made to send the data
53	- Port and location are urlencoded to handle any "odd" characters (like a /)
54