Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Laurent Yuric" <Laurent.Yuric@ed.nce.sita.int>
Subject: Re: how to obtain ethernet address
Date: 1997/06/05	[thread overview]
Message-ID: <01bc7193$abe9d1d0$66190439@bordeaux> (raw)
In-Reply-To: slrn5pai7p.54n.mvergall@alpha.double-barrel.be


I was looking for a similar program on HP-UX. I think it may work as well
on an Alpha machine (please let me know).

-----------begin-------------
| #include <stdio.h>
| #include <fcntl.h>
| #include <sys/ioctl.h>
| #include <netio.h>
| 
| int main()
| {
|     int lan;
|     struct fis f;
| 
|     if ((lan = open("/dev/lan0", O_RDONLY)) == -1) {
|         printf("Can't open /dev/lan0\n");
|         exit(1);
|     }
|     f.reqtype = LOCAL_ADDRESS;
|     if (ioctl(lan, NETSTAT, &f) == -1) {
|         printf("ioctl failed\n");
|         exit(1);
|     }
|     printf("LAN Address = 0x%02x%02x%02x%02x%02x%02x\n",
|       f.value.s[0],
|       f.value.s[1],
|       f.value.s[2],
|       f.value.s[3],
|       f.value.s[4],
|       f.value.s[5]);
|     exit(0);
| }
------------end--------------

You may have to be root to run this program.

Laurent

---------------------------------------------------------------------------
 Laurent YURIC, <Laurent.Yuric@ed.nce.sita.int>
 SITA - Research and Development
 Sophia Antipolis (FRANCE)
---------------------------------------------------------------------------


Michael C. Vergallen <mvergall@alpha.double-barrel.be> wrote in article
<slrn5pai7p.54n.mvergall@alpha.double-barrel.be>...
> On 3 Jun 1997 20:02:36 GMT, Eric LaPresto <lapresto@surgery.ccf.org>
wrote:
> >Does anyone know of a way to read the Ethernet (MAC) address
> >of an Alpha running Digital Unix 4.0 through a C
> call?  
> Okey, let me make a sugestion you could try to find the source of 'route'
> and have a look at the source. I don't have it on line now so I can't 
> really help you at the moment but their is a version of route available
in 
> source and it does such a call to read the Ethernet address. Have a look
for 
> 'net-tools*.tar.gz' where * stands for the version number.
> 
> Michael 
> -- 
> Michael C. Vergallen A.k.A. Mad Mike, 
> Sportstraat 28			http://www.double-barrel.be/mvergall/
> B 9000 Gent			ftp://ftp.double-barrel.be/pub/linux/
> Belgium				tel : 32-9-2227764 Fax : 32-9-2224976
> 			
> 



  reply	other threads:[~1997-06-05  4:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-03  4:00 how to obtain ethernet address Eric LaPresto
1997-06-04  4:00 ` Michael C. Vergallen
1997-06-05  4:00   ` Laurent Yuric [this message]
1997-06-05  4:00 ` Stephen Hoff Hoffman
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox