Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: mikes@forte.com (Mike Schilling)
Subject: Re: Need the Ethernet Adress on Alpha250/OSF1
Date: 1995/06/06	[thread overview]
Message-ID: <1995Jun6.205249.19776@forte.com> (raw)
In-Reply-To: 3qejto$79i@anemone.saclay.cea.fr

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);
}



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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-05-30  4:00 Need the Ethernet Adress on Alpha250/OSF1 francois CARTIER
1995-06-06  4:00 ` Mike Schilling [this message]
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