Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Need the Ethernet Adress on Alpha250/OSF1
@ 1995-05-30  4:00 francois CARTIER
  1995-06-06  4:00 ` Mike Schilling
  0 siblings, 1 reply; 2+ messages in thread
From: francois CARTIER @ 1995-05-30  4:00 UTC (permalink / raw)


For porting reasons, i need to get programaticaly the Ethernet
adress of lan card of my alphastation 250 under OSF1.
Whith my HP machines, it is done by un undocumented call to
    ioctl(fd, NETSTAT, &arg).
I suppose that some equivalent stuff exist whith OSF1.
thanks for helping me..

Francois Cartier
CEA- CE Saclay ** CEREM-STA-LCUS
91191 Gif sur Yvette  FRANCE

email: cartier@lcus15.saclay.cea.fr
 




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

* Re: Need the Ethernet Adress on Alpha250/OSF1
  1995-05-30  4:00 Need the Ethernet Adress on Alpha250/OSF1 francois CARTIER
@ 1995-06-06  4:00 ` Mike Schilling
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Schilling @ 1995-06-06  4:00 UTC (permalink / raw)


francois CARTIER (cartier@lcus15.saclay.cea.fr) wrote:
: For porting reasons, i need to get programaticaly the Ethernet
: adress of lan card of my alphastation 250 under OSF1.
: Whith my HP machines, it is done by un undocumented call to
:     ioctl(fd, NETSTAT, &arg).
: I suppose that some equivalent stuff exist whith OSF1.
: thanks for helping me..
: 
: Francois Cartier
: CEA- CE Saclay ** CEREM-STA-LCUS
: 91191 Gif sur Yvette  FRANCE
: 
: email: cartier@lcus15.saclay.cea.fr
:  
: 

Here's a program I wrote when I was looking into this.  The ioctl calls are
actually documented in the man pages.

# include <stdio.h>
# include <errno.h>
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/ioctl.h>
# include <net/if.h>

main()
{
	int sa, i;
	struct ifdevea devea;

	sa = socket(AF_INET, SOCK_DGRAM, 0);
	if (sa < 0)
	{
		perror("socket");
		exit(1);
	}
	strcpy(devea.ifr_name, "ln0");
	if (ioctl(sa, SIOCRPHYSADDR,&devea) < 0)
	{
		perror(&devea.ifr_name[0]);
		exit(1);
	}
	printf("Address is ");
	for (i = 0; i < 6; i++)
	{
		printf("%X", (devea.default_pa[i]>>4) & 0xF);
		printf("%X", devea.default_pa[i] & 0xF);
		if (i<5) 
			printf("-");
	}
	printf("\n");
	close(sa);
}



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

end of thread, other threads:[~1995-06-06  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-05-30  4:00 Need the Ethernet Adress on Alpha250/OSF1 francois CARTIER
1995-06-06  4:00 ` Mike Schilling

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