Date: Fri, 3 Dec 1999 13:49:35 -0800 From: "Justin C. Walker" <justin@apple.com> To: "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com> Cc: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org> Subject: Re: How to get Ethernet MAC address Message-ID: <199912032149.NAA00781@rhapture.apple.com>
next in thread | raw e-mail | index | archive | help
> From: "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com> > Date: 1999-12-03 10:11:49 -0800 > To: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG> > Subject: How to get Ethernet MAC address > Delivered-to: freebsd-hackers@freebsd.org > 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912032149.NAA00781>