Closed brifordwylie closed 8 years ago
I checked and it seems like libpcap 1.7.4 does indeed have the pcap_file
function.
From the looks of the output of the setup.py it is finding the pcap.h
header inside of include/pcap.h
as opposed to include/pcap/pcap.h
.
The former header is only a wrapper around the inclusion of the actual pcap.h
header located in pcap/pcap.h
, which means that when we look inside of it for the pcap_file
function we don't find it and end up not defining HAVE_PCAP_FILE
.
How are you running the setup.py script? In theory it shouldn't be looking inside of /usr/local/Cellar
unless you have it inside of your sys.prefix.
If we want to support looking for the headers in there too some reworking of the setup.py
is needed to give priority to the header in pcap/pcap.h
.
I checked and it seems like libpcap 1.7.4 does indeed have the
pcap_file
function.
pcap_file
dates back at least as far as libpcap 0.4, so you probably don't even need to check for it, unless you want to be able to support versions of libpcap prior to a version released in July 1998.
The former header is only a wrapper around the inclusion of the actual
pcap.h
header located inpcap/pcap.h
, which means that when we look inside of it for thepcap_file
function we don't find it and end up not definingHAVE_PCAP_FILE
.
Yes - do not rely on pcap.h
in the top-level include directory being the include file declaring the functions. We created the pcap
directory to hold additional libpcap header files, and put pcap.h
there, with a top-level pcap.h
file left for source compatibility (unlike, for example, some versions of Red Hat, which moved it and didn't leave behind anything for source compatibility).
@hellais so I finally got a chance to revisit this. So it's been a while but I think I was running into issue #20, and then installed libpcap 1.7.4 (installed with brew) so the setup.py found that version. After fully removing the brew installed libpcap, and fixing the issue with #20 (see that ticket for more info). Everything is working once again.
Now having said that @guyharris does seem to have some good observations about the possibly outdated logic in setup.py. @guyharris would you mind posting a PR with changes? I'd like to keep this ticket open until we address his comments.
I've created a pull request #22 for changes to remove the test for pcap_file().
As for finding pcap.h, it appears that the current code searches recursively for them (pcap_h = recursive_search_dirs(search_dirs, ['pcap.h'])
), and, at least in my test on OS X, it found it in pcap/pcap.h ("Found pcap headers in /usr/include/pcap/pcap.h"), so that problem appears to be fixed.