tcpdump mailing list archives

Re: Devices and adresses in libpcap


From: "David Rosal" <drosalri () gmail com>
Date: Sun, 13 Apr 2008 12:59:35 +0200

Thanks Guy.

By the way: Have you had a look at libpcap++?

The web page is:   http://libpcappp.sourceforge.net/

Your opinion would be specially appreciated.

Anyway, thanks for the help.

Cheers,

   ~David

2008/4/12, Guy Harris <guy () alum mit edu>:

David Rosal wrote:

 As far as I know, each network interface (for example eth0), can have
different adresses, because in pcap_findalldevs(), a pcap_if_t does not
hold
a single pcap_addr_t but a linked list of all  addresses for each
interface/device.


Yes, it can have multiple addresses, and, yes, pcap_findalldevs() returns
all of the ones it can get.

 But pcap_lookupnet() only returns one address for a given
device.


Yes, it returns only one address.

 So the question is: If pcap_lookupnet() only returns one address
(and its netmask), does it mean that it discards all the other addresses
for that device?


Yes, it discards any other addresses for the interface.  On UN*X, it
returns the IP address and mask you get from an SIOCGIFADDR and
SIOCGIFNETMASK ioctl, which is probably the first of the IP addresses; on
Windows, it gets the entire set of address/mask pairs and returns only the
first one.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: