Hi All,

I am new to Solaris, recently switching from Linux to Solaris. 

On linux I used following code to retrive the Mac address 
struct ifreq ifr;
     
 fd = socket(AF_INET, SOCK_DGRAM, 0);
 ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name, "eth0", IFNAMSIZ-1);
ioctl(fd, SIOCGIFHWADDR, &ifr);

    close(fd);
 printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
(unsigned char)ifr.ifr_hwaddr.sa_data[0],
(unsigned char)ifr.ifr_hwaddr.sa_data[1],
(unsigned char)ifr.ifr_hwaddr.sa_data[2],
(unsigned char)ifr.ifr_hwaddr.sa_data[3],
(unsigned char)ifr.ifr_hwaddr.sa_data[4],
(unsigned char)ifr.ifr_hwaddr.sa_data[5]);

return 0;
} 


it seems there is no request code like SIOCGIFHWADDR and member variable 
ifr_hwaddr on solaris10/9/8, but I guess there should be some thing equivalent 
to them in Solaris too.
Is there is any equivalent request code on Solaris to get the hardware address 
of NIC's?

Do i need to look some other way to do the same ? if yes please suggest.
any help will be usefull

Thanks in adavence
Manish
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to