Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Getting Ethernet (MAC) address on DU 4.0
@ 1998-09-07  4:00 Niel Markwick
  1998-09-08  4:00 ` Joe Spanicek
  1998-09-08  4:00 ` John Kohl
  0 siblings, 2 replies; 3+ messages in thread
From: Niel Markwick @ 1998-09-07  4:00 UTC (permalink / raw)


I know this is a question that has been asked before, but I am looking
for some different answers!

I am looking for a generic way of getting the MAC address from the
ethernet card from within a C program... 

On the VMS and Solaris platforms, I am sucessfully using the SIOCGARP
ioctl to get ther ARP entry for the host, but on DEC Unix, this fails...
It seems that VMS and SOLARIS store an entry in the ARP tables for the
local host, but Dec Unix doesn't.

The answer found in Deja News
	(http://www.dejanews.com/getdoc.xp?AN=333909507)
was to use the SIOCRPHYSADDR ioctl, but this requires knowledge of the
name of the network interface that you are interrogating (ie tu#, ln#,
le#)


So, is there another way to get the MAC address (I suspect not).
Alternatively, is there a way to get the names of the network interfaces
on a system, so that I can then use these with the SIOCRPHYSADDR ioctl
to get the addresses.


I currently have a workaround which is to popen the command:
	/usr/sbin/netstat -i \
	   | awk ' {print $4} ' \
	   | grep '[0-9a-f:]\{17\}'
and read the output back into my program, but this feels sooooo messy,
and is subject to the whims of Digital changing the output format of
netstat!

All help gratefully recieved.

Niel.


-- 
Niel Markwick                  
Consultant Software Engineer   
Alcatel Bell Telecom, Kontich, Belgium.              
Work Email: markwicn@sebb.bel.alcatel.be



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-09-08  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-07  4:00 Getting Ethernet (MAC) address on DU 4.0 Niel Markwick
1998-09-08  4:00 ` Joe Spanicek
1998-09-08  4:00 ` John Kohl

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