Getting MAC address?

Dmitry Morozovsky marck at rinet.ru
Fri Jun 25 23:52:48 PDT 2004


On Sat, 26 Jun 2004, Ivan Voras wrote:

IV> How to get the MAC address for an (ethernet) interface? The linux code
IV> does this:
IV> 	retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr);
IV>
IV> After some searching, I found SIOCSIFLLADDR ioctl, but it appears there
IV> isn't a "GET" counterpart.
IV>
IV> (I've got interface name & index available...)

Take a look at ifconfig(8) source.

getifaddrs(3), case when sa_family == AF_LINK

Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------


More information about the freebsd-hackers mailing list