The latest version of Net::CDP appears to be b0rked in FreeBSD 6 - can anyone confirm?
Yes, I know it's not in ports - installed via the evil magic of CPAN.
There was an unresolved symbol in CDP.so (program_name, referenced by libcdp's error.h), so I uh..resolved it. Heh.
I wrote a short test script to listen for incoming CDP requests and print the packet data to screen, but it's acting fairly odd. The system I'm running it on has two ethernet interfaces, re0 (192.168.1.0/24) and fxp0 (to intardweb). If I request a list of available interfaces using Net::CDP::Ports, it only returns re0. That's weird in itself, but it also brings the interface down for 3 seconds when going into promiscuous mode. Perhaps I'm doing something funky here, but I doubt it as even the example perl script included with the Net::CDP distribution doesn't work as expected.
I thought it might be libpcap, but cdpr works as it should. Maybe it's libnet?
Here's the test script:
#!/usr/local/bin/perl -w
use strict;
use Net::CDP;
use Net::CDP::Packet qw(:caps);
my @ports = Net::CDP::ports;
print "Available Interfaces: @ports\n";
my $cdp = Net::CDP->new(port => "re0", promiscuous => 1);
my $p = $cdp->recv(nonblock => 0); # Even in nonblocking mode, the same behaviour exists.
die "Packet is undefined.\n" unless $p;
print "Device: " . $p->device . "\nPlatform: " . $p->platform . "\n";
These messages are produced in /var/log/messages when the script is run:
Feb 24 01:37:16 smut kernel: re0: promiscuous mode enabled
Feb 24 01:37:16 smut kernel: re0: link state changed to DOWN
Feb 24 01:37:20 smut kernel: re0: link state changed to UP
