I had to make a couple of changes to get this to compile and link. The first change (to pcap_pkthdr.cc) looks like it's probably a genuine bug, but the changes I made to setup.py might be hacks more or less specific to OpenBSD. Somebody should make an official port to OpenBSD. I'm surprised there isn't one.
Pcapy is a dependency for pcapdiff, a nice basic tool for comparing packet dumps. I find pcapdiff to be very useful for such mundane tasks as diagnosing faulty NICs, switches, or network wiring on a LAN, quite apart from its original purpose of detecting ISP meddling. In fact, somebody offered to do the pcapy port on the mailing list a couple of years ago, http://openbsd.monkey.org/ports/200603/msg00027.html but apparently nobody ever responded. It looks like there's still something to go on here: http://www.subspacefield.org/~travis/OpenBSD/4.1/subspacefield.org/pcapy/ Anyways, here are my patches for pcapy-0.10.5 on OpenBSD 4.3/i386: --- pcap_pkthdr.cc.orig Sat Aug 9 10:12:43 2008 +++ pcap_pkthdr.cc Sat Aug 9 08:14:42 2008 @@ -24,7 +24,7 @@ // internal pcapobject typedef struct { PyObject_HEAD - struct timeval ts; + struct bpf_timeval ts; bpf_u_int32 caplen; bpf_u_int32 len; } pkthdr; --- setup.py.orig Sat Aug 9 10:13:03 2008 +++ setup.py Sat Aug 9 08:56:58 2008 @@ -3,6 +3,9 @@ from distutils.core import setup, Extension import sys, os +os.environ['CC'] = 'g++'; os.environ['CXX'] = 'g++'; +os.environ['CPP'] = 'g++'; os.environ['LDSHARED'] = 'g++ -shared'; + PACKAGE_NAME = 'pcapy' # You might want to change these to reflect your specific configuration @@ -17,7 +20,8 @@ library_dirs.append(r'c:\devel\wpdpack\Lib') libraries = ['wpcap', 'packet', 'ws2_32'] else: - libraries = ['pcap'] + library_dirs.append(r'/usr/local/lib') + libraries = ['pcap', 'python2.5', 'util', 'pthread'] # end of user configurable parameters
