tcpdump mailing list archives

Re: pcap_compile_nopcap() not in man pages


From: Guy Harris via tcpdump-workers <tcpdump-workers () lists tcpdump org>
Date: Wed, 12 Aug 2020 12:59:35 -0700

--- Begin Message --- From: Guy Harris <gharris () sonic net>
Date: Wed, 12 Aug 2020 12:59:35 -0700
(Your first attempt seems to have worked - finally.  Perhaps Michael cleared the backlog?)

On Aug 10, 2020, at 4:24 AM, Denis Ovsienko via tcpdump-workers <tcpdump-workers () lists tcpdump org> wrote:

It turns out, pcap_compile_nopcap() has been a part of the libpcap API
since version 0.5 (June 2000), but it is not even mentioned anywhere in
the man pages. The existing pcap_compile.3pcap man page seems to be the
best place to add this information, since the two functions are
similar. Would it be the right thing to do?

The problem with pcap_compile_nopcap() is that it provides no way to return an error message if it fails, unlike 
pcap_open_dead() combined with pcap_compile(), where you can use pcap_geterr() before closing the pcap_t.

An additional problem is that NetBSD fixed this by adding an error-buffer pointer argument, but that meant that 
NetBSD's pcap_compile_nopcap() was unfixably incompatible with the one in other OSes.  They've shifted to the 
compatible API, at the cost of not being able to get an error string.

So, for now, my inclination is to 1) deprecate pcap_compile_nopcap() (complete with marking it as deprecated, so code 
that uses it gets a compile-time warning on compilers where the deprecation macro is supported) and 2) not document it.

--- End Message ---
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: