> From: "Yevmenkin, Maksim N, CSCIO" <[EMAIL PROTECTED]>
> Date: 1999-12-03 10:11:49 -0800
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: How to get Ethernet MAC address
> Delivered-to: [EMAIL PROTECTED]
> X-Mailer: Internet Mail Service (5.5.2448.0)
> X-Loop: FreeBSD.ORG
>
> Hello All,
>
> Is there any ioctl command to get Ethernet MAC address from specific 
> interface?
>
> I've checked netstat and ifconfig source code and mail archive.
> It seems to me all use different methods to do the same thing.
>
> I'm using FreeBSD 3.3-Release. May be SIOGHWADDR (as in Linux)
> is a good idea?

Try SIOCGIFCONF, and search through the list of returned structures  
for one with address family AF_LINK.  The sockaddr for this one will  
be a sockaddr_dl, with the MAC address enclosed.  See the code, e.g.,  
for netstat, or for ifconfig.  There's also a sysctl() request that  
works.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics       |
Manager, CoreOS Networking            |   Men are from Earth.
Apple Computer, Inc.                  |   Women are from Earth.
2 Infinite Loop                       |       Deal with it.
Cupertino, CA 95014                   |
*-------------------------------------*-------------------------------*


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to