From owner-freebsd-hackers Tue May 4 1:48:52 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (Postfix) with ESMTP id 2D004154DF for ; Tue, 4 May 1999 01:48:48 -0700 (PDT) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (brian@keep.lan.Awfulhak.org [172.16.0.8]) by awfulhak.org (8.9.2/8.9.2) with ESMTP id JAA18521; Tue, 4 May 1999 09:48:42 +0100 (BST) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by keep.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id IAA00704; Tue, 4 May 1999 08:46:41 +0100 (BST) (envelope-from brian@keep.lan.Awfulhak.org) Message-Id: <199905040746.IAA00704@keep.lan.Awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: "David E. Cross" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: getting the MAC address of an interface In-reply-to: Your message of "Tue, 04 May 1999 00:13:19 EDT." <199905040413.AAA25615@cs.rpi.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 04 May 1999 08:46:41 +0100 From: Brian Somers Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Have a look at src/usr.sbin/ppp/iface.c. It's probably a bit less abstract than the ifconfig code. > 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 -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message