Date: Tue, 04 May 1999 08:46:41 +0100 From: Brian Somers <brian@Awfulhak.org> To: "David E. Cross" <crossd@cs.rpi.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: getting the MAC address of an interface Message-ID: <199905040746.IAA00704@keep.lan.Awfulhak.org> In-Reply-To: Your message of "Tue, 04 May 1999 00:13:19 EDT." <199905040413.AAA25615@cs.rpi.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <brian@Awfulhak.org> <brian@FreeBSD.org> <http://www.Awfulhak.org> <brian@OpenBSD.org> Don't _EVER_ lose your sense of humour ! <brian@uk.FreeBSD.org> 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?199905040746.IAA00704>