Operating System - HP-UX
1834137 Members
2278 Online
110064 Solutions
New Discussion

Re: How to read the MAC address under HPUX 11

 
SOLVED
Go to solution
TILLY
New Member

How to read the MAC address under HPUX 11

The following code works under HPUX 10.20 and 9.0x
and produce an error: No such device on HPUX11
int main(argc,argv)
int argc;
char *argv[];
{ int fd;
struct fis fis;
if((fd=open("/dev/lan0",O_RDONLY))<0)
{ printf("Unable to open /dev/lan0 for reading [%s].\n",strerror(errno));
return(-1);
}
fis.reqtype=LOCAL_ADDRESS;
if (ioctl(fd,NETSTAT,&fis) < 0)
{ close(fd); printf("Error ioctl.\n"); return(-1); }
close(fd);
printf("0x%02x%02x",(unsigned char)fis.value.s[0], (unsigned char)fis.value.s[1]);
printf("%02x%02x",(unsigned char)fis.value.s[2], (unsigned char)fis.value.s[3]);
printf("%02x%02x",(unsigned char)fis.value.s[4], (unsigned char)fis.value.s[5]);
printf("\n");
return(0);
}
3 REPLIES 3
James A. Donovan
Honored Contributor

Re: How to read the MAC address under HPUX 11

Take a look through chapter 8 of the HP-UX 11.00 Driver Development Guide. It covers the new DLPI implementation. You probably need to make some modifications to your code.

http://docs.hp.com/hpux/pdf/B2355-90669.pdf

Remember, wherever you go, there you are...
Jdamian
Respected Contributor

Re: How to read the MAC address under HPUX 11

I'm in agreement with Jim. The LAN device files dissapeared when DLPI was introduced.

The manual pages in section 7 about "lan" explains:

--> WARNING
--> The Link Level Access (LLA) interface is obsolete.

Those same manual pages reports a doc list. The firs doc listed is:

"DLPI Programmer's Guide", 1995, Hewlett-Packard


I hope this be useful
Craig Gilmore
Trusted Contributor
Solution

Re: How to read the MAC address under HPUX 11

Here is a program that uses DLPI to get the Physical MAC address.

I presume you are attempting to use this for licensing. LLA was obsoleted in 9.04. You might want to check for a "Logical" MAC address rather than the physical, if the software is going to be used in a switchover environment.

Regards