I would like to retrieve the MAC address for a given NIC by using the 
SIOCGENADDR ioctl, but keep getting errno 2 (ENOENT).  Do I miss something or 
this ioctl is broken?  My next question is, how can I retrieve the MAC address 
of different kinds of NIC cards?

Thanks,
Shao.

Here is the code fragment I use:

#ifdef  SIOCGENADDR             /* Solaris: ethernet MAC addr */
        if (ioctl(sockfd, SIOCGENADDR, &ifr) == 0) {
                memcpy(nic->m_haddr, ifr.ifr_enaddr, 6);
                nic->m_hlen = 6;
        }
#endif  /* SIOCGNADDR */
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to