From owner-freebsd-hackers Fri Dec 3 13:57:55 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail-out2.apple.com (mail-out2.apple.com [17.254.0.51]) by hub.freebsd.org (Postfix) with ESMTP id 9EF9014BEF for ; Fri, 3 Dec 1999 13:57:51 -0800 (PST) (envelope-from justin@rhapture.apple.com) Received: from mailgate2.apple.com ([17.129.100.225]) by mail-out2.apple.com (8.9.3/8.9.3) with ESMTP id NAA25999 for ; Fri, 3 Dec 1999 13:56:53 -0800 (PST) Received: from scv1.apple.com (scv1.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 2.0.15) with ESMTP id ; Fri, 03 Dec 1999 13:49:37 -0800 Received: from rhapture.apple.com (rhapture.apple.com [17.202.40.59]) by scv1.apple.com (8.9.3/8.9.3) with ESMTP id NAA12722; Fri, 3 Dec 1999 13:49:36 -0800 (PST) Received: (from justin@localhost) by rhapture.apple.com (8.9.1/8.9.1) id NAA00781; Fri, 3 Dec 1999 13:49:36 -0800 (PST) Message-Id: <199912032149.NAA00781@rhapture.apple.com> To: "Yevmenkin, Maksim N, CSCIO" Subject: Re: How to get Ethernet MAC address Cc: "'freebsd-hackers@freebsd.org'" Date: Fri, 3 Dec 1999 13:49:35 -0800 From: "Justin C. Walker" Reply-To: justin@apple.com X-Mailer: by Apple MailViewer (2.105.dev) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > From: "Yevmenkin, Maksim N, CSCIO" > Date: 1999-12-03 10:11:49 -0800 > To: "'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