Name
pcap_lookupdev — Prototype: char *pcap_lookupdev(char *errbuf)
Synopsis
Purpose: pcap_lookupdev finds the first usable
interface (active and supported by libpcap) for
use with pcap_open_live and
pcap_lookup_net returned by the operating system.
The function returns a string containing the
device’s name if successful. If not successful, the
function returns NULL and
errbuf contains a human-readable error message.
pcap_lookupdev is not recommended in situations
where multiple network interfaces are in use. Note that if the
calling user does not have appropriate privileges, this function
might not return a device even though usable devices are present. You
can find an example of using pcap_lookupdev in the
Section 10.2.2
section earlier in this chapter.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access