tcpdump mailing list archives

Re: Obtaining interface IP address and MAC address


From: Guy Harris <guy () alum mit edu>
Date: Mon, 24 Jan 2011 18:17:22 -0800


On Jan 24, 2011, at 5:56 PM, Darren Reed wrote:

Why should it need to?

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

So I can do those ioctls on Windows?  Google says, for what it's worth:

        Your search - SIOCGIFADDR site:msdn.microsoft.com - did not match any documents.

and Bing says

        We did not find any results for SIOCGIFADDR site:msdn.microsoft.com.

so I guess Microsoft says you can't. :-)  (There's a search box at msdn.microsoft.com, but it appears to just do a Bing 
search - without even restricting the site, as most of the hits for SIOCGIFADDR on the first page are stackoverflow.com 
hits for SIOCGIFADDR on *Linux*!  Of course, the home page of msdn.microsoft.com also says "developers developers 
developers code with Microsoft.", so Uncle Fester probably designed the home page, and it's probably his fault. :-))

(And, yes, that matters, given WinPcap.  People keep asking "how can I get the MAC address?" in the WinPcap mailing 
lists, and if there's a WinPcap API to get it, it might as well be a *pcap API.  And, given that the IP and MAC 
addresses can be supplied in a pcap-ng Interface Description Block, we might as well have an API that supplies an IDB 
with as many of the "doing this is platform-dependent" bits as possible filled in (supplying it as an IDB also means 
it's extensible, so we don't need to rev the APIs if we add a new interface attribute).)-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: