🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #12426

Finding ethernet addresses

#12426
From: Kemp
Date: Wed, 03 May 1989 09:14
22 lines
1380 bytes
Dan Ehrlich <ehrlich@shire.cs.psu.edu> writes:  Does anyone know how to
determine the ethernet address of the second ethernet interface on a Sun?

There is a program in the Sun Software Technical Bulletin (November 1988,
page 2202) that does exactly that, using /dev/nit.  The code is 1 1/2
pages, but the relevant lines are (omitting error checking):

 #include <net/if.h>
 #include <net/nit_if.h>
 struct ifreq if_data;

 sfd = open("/dev/nit", O_RDONLY);
 if_data.ifr_addr.sa_family = AF_NIT;
 strcpy(if_data.ifr_name, argv[1]);l      /* the interface name */
 ioctl(sfd, NIOCBIND, &if_data);
 ioctl(sfd, SIOCGIFADDR, &if_data);      /* Get the ethernet addr */
    /*   print if_data.ifr_addr.sa_data[0:5]  */

I typed the program in and it works.  If you don't get the STB, the
above should be enough to get you pointed in the right direction.

   Dave Kemp <Kemp@dockmaster.ncsc.mil>
Technical Details
Message-ID: <890414021852.004708@DOCKMASTER.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!husc6!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!husc6!rice!sun-spots-request
From: Kemp@dockmaster.ncsc.mil
Newsgroups: comp.sys.sun
Subject: Finding ethernet addresses
Keywords: SunOS
Message-ID: <890414021852.004708@DOCKMASTER.ARPA>
Date: 3 May 89 09:14:25 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 22
Approved: Sun-Spots@rice.edu
Original-Date: Thu, 13 Apr 89 22:18 EDT
X-Sun-Spots-Digest: Volume 7, Issue 263, message 2 of 9