tcpdump mailing list archives

Re: Obtaining interface IP address and MAC address


From: Darren Reed <darren.reed () oracle com>
Date: Mon, 24 Jan 2011 17:56:27 -0800

roy hills wrote:
I maintain an application that uses libpcap to receive frames, and uses its own link-specific functions to obtain 
interface details and send frames.  I currently support packet socket (Linux), BPF (BSD) and DLPI (Solaris).

I'd like to use libpcap to send as well as receive frames, and notice that libpcap supports pcap_sendpacket() and 
pcap_inject() to do this.  But I can't find any portable way to obtain the interface IP address and MAC address.

Does libpcap allow me to get the interface IP address and MAC address?

Why should it need to?

The interfaces used to do both of the above are almost universal now: SIOCGIFADDR and SIOCGIFHWADDR.

Darren

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


Current thread: