From owner-freebsd-hackers Mon May 3 21:13:23 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cs.rpi.edu (mumble.cs.rpi.edu [128.213.8.16]) by hub.freebsd.org (Postfix) with ESMTP id 522E41520C for ; Mon, 3 May 1999 21:13:21 -0700 (PDT) (envelope-from crossd@cs.rpi.edu) Received: from cs.rpi.edu (monica.cs.rpi.edu [128.213.7.2]) by cs.rpi.edu (8.9.1/8.9.1) with ESMTP id AAA25615 for ; Tue, 4 May 1999 00:13:20 -0400 (EDT) Message-Id: <199905040413.AAA25615@cs.rpi.edu> To: freebsd-hackers@freebsd.org Subject: getting the MAC address of an interface Date: Tue, 04 May 1999 00:13:19 -0400 From: "David E. Cross" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I have looked at the source for ifconfig as well as dhclient, but I still a bit confused as to how one obtains the MAC address of an interface (there seem to be mutliple ways). I am interested in the following, I am given the symbolic name (ie 'xl0') of an interface, from that get the IP, netmask, broadcast, and MAC for the card. For the first 3, I just create a unbound UDP socket, ioctl(fd, SIOCG[IFADDR|IFBRDADDR],...). How do I get the netmask? How do I get the MAC (looking arround it seems I could get the MAC with AF_LINK, is that correct?) How do I get the hardware type? It would be no god to get the MAC without being on an ETHER or FDDI network connection. -- David Cross | email: crossd@cs.rpi.edu Systems Administrator/Research Programmer | Web: http://www.cs.rpi.edu/~crossd Rensselaer Polytechnic Institute, | Ph: 518.276.2860 Department of Computer Science | Fax: 518.276.4033 I speak only for myself. | WinNT:Linux::Linux:FreeBSD To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message