tcpdump mailing list archives

Re: capture and inject device capabilities in libpcap


From: Guy Harris <gharris () sonic net>
Date: Mon, 18 Nov 2024 12:30:22 -0800

On Nov 18, 2024, at 11:54 AM, Denis Ovsienko <denis () ovsienko info> wrote:

The current approach in libpcap is such that an application at some
point tries to activate a device, and if the device does not support
capturing packets, pcap_activate() fails with the
PCAP_ERROR_CAPTURE_NOTSUP error code.  One drawback of this is that the
application has no means to tell a capture-capable device without
trying to activate it, another is that telling an inject-capable device
takes trying to use the device after pcap_activate() succeeds.  It would
be useful to have a shorter feedback loop for these capabilities.

So "even neither" devices could either not be shown in pcap_findalldevs() or be shown with both of the "not supported" 
flags set.  One argument for showing it might be that, if the device isn't shown, a user might have reason to expect it 
to be there, and report this as "why isn't device XXX not showing up?", which doesn't indicate what the problem is, and 
turns into a question-and-answer session, whereas if the device is present, the user will see the device, attempt to 
capture or inject on it, and get a "{capturing,injecting} traffic isn't supported on this device" error, and if they 
report *that*, at least it's known what the problem is, shortening the Q&A session and getting an answer more quickly.

Does it make sense?

Sounds good to me.
_______________________________________________
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: