Kemp@dockmaster.ncsc.mil (05/03/89)
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>