Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 May 1999 00:13:19 -0400
From:      "David E. Cross" <crossd@cs.rpi.edu>
To:        freebsd-hackers@freebsd.org
Subject:   getting the MAC address of an interface
Message-ID:  <199905040413.AAA25615@cs.rpi.edu>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905040413.AAA25615>