[Winpcap-users] Adapters MAC-address

Ioan Popescu ipopescu at dataq.com
Fri Sep 14 17:35:46 GMT 2007


Roger wrote:
> Hi
> I just started programming with WinPcap.
> I want to build a packet with destination and source addresses
> and send it using pcap_sendpacket. But how do I get the source
> address which in this case is the selected adapters MAC-address?
> I have looked through the documentation but have not been able
> to find it. I can of course get it using a windows function,
> but then I have to match it to the pcap adapter. There must
> be a smarter way to get it. Please help.

WinAPI: GetAdaptersInfo()
You can match by adapter name, not too hard.

WinPcap:
It would be nice if WinPcap added support for this at the driver level (it
already may) and wrap it with an API. The driver would need to support OIDs
(one IOCTL that uses an OID to communicate with the underlying miniport
driver). This is what I understand from working with NDISUIO in CE and
poking through WinPcap/NDIS. As far as I know, WinPcap doesn't really have
to do anything, just act as a middle-man between user-space and the miniport.

Relevant IOCTL: IOCTL_NDIS_QUERY_ALL_STATS
Relevant OID: OID_802_3_CURRENT_ADDRESS


More information about the Winpcap-users mailing list