From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,2a1223fcc64367d7 X-Google-Attributes: gidfee84,public From: mikes@forte.com (Mike Schilling) Subject: Re: Need the Ethernet Adress on Alpha250/OSF1 Date: 1995/06/06 Message-ID: <1995Jun6.205249.19776@forte.com>#1/1 X-Deja-AN: 103909360 references: <3qejto$79i@anemone.saclay.cea.fr> organization: Forte Software Inc. newsgroups: comp.unix.osf.osf1 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 # include # include # include # include # include 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); }