Which file to request SIOCGIFMAC on?

Chuck Swiger cswiger at mac.com
Tue Feb 20 21:24:45 UTC 2007


On Feb 20, 2007, at 1:10 PM, nocturnal wrote:
> I'm trying to get the ethernet address and from the manuals i  
> understand that i need the ifreq structure for this. So i'm trying  
> to request SIOCGIFMAC with ioctl on a socket of type SOCK_DGRAM.

If you're just targetting FreeBSD >= 5.x platforms, your current  
approach is reasonable (assuming you can fix whatever the problem  
is); if you're targetting other platforms such FreeBSD 4, Dfly, OS X,  
or SysV things like Solaris, try installing the libnet port and  
invoke libnet_get_hwaddr().

-- 
-Chuck



More information about the freebsd-questions mailing list