cdpr - Cisco Discovery Protocol Reporter
Copyright (c) 2002-2003 MonkeyMental.com

*Version 2.1.0

This version provides the ability to include a timeout so that you can put cdpr
into startup scripts and not have it hang if for some reason a CDP packet is never
received (i.e. CDP is disabled, machine is plugged into a hub, etc.) The following
command line option has been added:

-t timeout: Specify a timeout (in seconds) to wait for a CDP packet.

Please note that the default time between CDP packets is 60 seconds so you should
set your timeout to something greater than 60. There is a default timeout of 5 minutes
so that should you not provide a timeout, cdpr will still exit if there is no CDP
packet received within 5 minutes.

This version also allows you to specify the server and URL to send CDP updates to on
the command line. The following command line options have been added:

-s server: Server to send information to requires -p (overridden by -u)
-p path: Path of server script to send data to requires -s (overridden by -u)

As you can see if you specify -s, -p and -u on the command line, the config file is actually
used, and the -s and -p options are ignored. Both the -s and -p options must be specified and
cdpr will exit if only one of them is given. An example as to how to use the -s and -p flags:

	cdpr -d eth0 -s localhost -p /cgi-bin/cdprs.cgi -t 120

This will listen for a CDP announcement on device eth0 for up to 2 minutes (120 seconds) and
send the results to the webserver running on the local machine by calling the /cgi-bin/cdprs.cgi
page.

*Versions 2.0.1 - 2.0.5
These version were never officially released, they were code cleanups and timeout implementation.

*Version 2.0.0

This version provides the functionallity to report CDP data back to a centralized server.
Please see the file README.cdprs for details, but in general, the following command line
options have been added:

-u conf.file: Send updates to the host listed in the config file.
-l location: Send a location string to help identify the port.
-n hostname: Override the hostname sent to the server.

Platform Update: Some of the newer HP Switch firmware will broadcast CDP packets. cdpr
will decode these packets just the same as they would if they came from a Cisco product.
It was tested on a HP ProCurve 4000M running revision C.09.16.

*Version 1.0.8

Support for ARM processor. Tested on the Sharp Zaurus SL-5500.

*Version 1.0.7

Support for Win32 clients please read README.Win32.
To support the Win32 clients, modified so that if a network device is not specified
on the command line with -d, then to find all devices that are capable of being used
by the pcap libary and provide a selection list.

*Version 1.0.6

Fixed up some more bus errors/segmentation faults.

*Version 1.0.5

Copy packet data to local variable to resolve alignment issues that caused Bus Errors
on some architectures. cdpr has now been compiled and tested on the following
Operating Systems:
 - Linux 2.4.18 (x86)
 - FreeBSD 4.6 (x86)
 - Sun Solaris 8 (SPARC)
 - HP HP-UX 11.11 (PA-Risc)
 - IBM AIX 4.3.3 (PowerPC)

On some operating systems (like Solaris) the u_int* typedefs are not defined, to resolve
this issue, include u_ints.h in cdp.h.

On AIX you must load the dlpi kernel module using the following command:

 strload -f /etc/dlpi.conf

On AIX you may recieve some warnings about "Primitive issued in improper state", 
these can be safely ignored.

On HP-UX you may recieve a warning about "any missing unit number", this can be
safely ignored

*Version 1.0.4

Added 1 ms timeout to pcap_open_live to fix BSD hang issues.

*Version 1.0.3

Loop on pcap_next until a valid packet is received, some implementations of pcap will
return a null. Patch provided by Martin Buck <martin.buck@ascom.ch>.

*Version 1.0.2

Use a new filter to better identify CDP packets. Solves the majority of the segfaults
due to trying to decode a non-CDP packet (i.e. a VTP packet)

*Version 1.0.1

Add preprocessor macros to only include the Link Type defines provided by the pcap and
bpf headers. 

*Version 1.0.0

I originally wrote this program to report which switch, and port a machine
is connected to. In a large environment sometimes it is difficult to determine
which port on which switch a machine is connected to.

By default (with no command line options) cdpr will determine a network interface
to open, put into promiscuous mode and wait for a single CDP packet to be received.

On multi-homed machines, you can specify which interface to use with the -d option.

Example (to determine which switch/port eth1 is connected to):
	cdpr -d eth1

You can dump the whole cdp packet using -v (more v's = more output).

Sample Output:
cdpr - Cisco Discovery Protocol Reporter Version 1.0.0
Copyright (c) 2002 - MonkeyMental.com

Using Device: eth0
Waiting for CDP advertisement, default config is to transmit CDP packets every 60 seconds
Device ID
  value:  mtview-3548-access-1.i2.com
Addresses
  value:  10.100.230.14
Port ID
  value:  FastEthernet0/4

As you can see above, by default CDP packets are broadcast every 60 seconds, cdpr will wait
until a CDP packet is received. 

I hope you find this utility useful. Thanks to Manfred Siemsen for helping to decode the 
packet data.

Regards,
Lance O'Connor
lance@monkeymental.com
