tcpdump mailing list archives

Re: pcap_lookupdev() function


From: Guy Harris <guy () alum mit edu>
Date: Thu, 7 Feb 2008 17:38:38 -0800


On Feb 8, 2008, at 11:38 AM, Guillermo Hurtado wrote:

This is the first time I write to this list. I just read a post about the
behavior of function pcap_lookupdev().
Now I wonder: what if I have two or more (2...N) Ethernet NICs installed in my computer and I want to retrieve the name of the second NIC to associate
to a socket and start reading from it?
Is there a way to achieve this using this function?

No.

In newer versions of libpcap, however, there is, however, a way to find all the devices on which you can capture; you use pcap_findalldevs().

Choosing the appropriate adapter from the list pcap_findalldevs() returns is the job of the application using pcap_findalldevs() (because pcap_findalldevs() has no idea which adapter would be appropriate, as it doesn't know what criteria to use).
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: