[Winpcap-users] How to get local MAC address ?

Guy Harris guy at alum.mit.edu
Mon Sep 12 09:24:15 PDT 2011


On Sep 12, 2011, at 7:24 AM, Mark Pizzolato - WinPCap-Users wrote:

> There once was some discussion about adding this functionality to WinPcap's implementation of pcap_findalldevs().  It never came to anything since it fell off the radar of the developers, and it wasn't a significantly pressing requirement.  

Another problem with using pcap_findalldevs() is that it supplies addresses in the form of "struct sockaddr"s, and that means there would need to be an AF_ value for the MAC address. Both Linux (according to your mail) and *BSD/Mac OS X have AF_ values for that, but the values are different and, I suspect, the format of the addresses are different.

What should probably be provided are a call to get pcap-ng Interface Description Block-style properties:

	http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionidb

for an interface and to get a list of interfaces with those properties, which makes it independent of how the particular OS happens to supply MAC addresses, as well as allowing other properties such as link speed to be provided and to add new properties without breaking source or binary compatibility.  That's on my long list of things to do in libpcap/WinPcap.


More information about the Winpcap-users mailing list