tcpdump mailing list archives

Re: Setting BPF_SPECIAL_VLAN_HANDLING on a "dead" handle


From: Denis Ovsienko <denis () ovsienko info>
Date: Tue, 8 Jul 2025 15:36:15 +0100

On Mon, 7 Jul 2025 12:47:18 -0700
Guy Harris <gharris () sonic net> wrote:

On Jul 7, 2025, at 3:29 AM, Denis Ovsienko <denis () ovsienko info>
wrote:

Yes, and that version could be the same old pcap_compile() if the
pcap_t contained the compilation style requests, as it already
contains the link-layer type and the snapshot.  

But that still requires pcap_open_dead(), which is somewhat of a
greasy hack, as far as I'm concerned. If all you're using libpcap for
is to generate cBPF code, a pcap_t seems to be extra baggage.

The need to have a pcap_t at all times is very similar to using file
descriptors or sockets: first you obtain a descriptor, then you
initialise it in various ways as necessary, then you have a very small
number of methods to read and to write, and by that time the only
things you need to specify are the descriptor and details of this
particular read/write (how many bytes, location, blocking/non-blocking).

libcurl and other libraries implement a very similar approach using
contexts and options, and quite often a new option is a much better
solution than a new API function.

-- 
    Denis Ovsienko
_______________________________________________
tcpdump-workers mailing list -- tcpdump-workers () lists tcpdump org
To unsubscribe send an email to tcpdump-workers-leave () lists tcpdump org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s


Current thread: