• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting the MAC address via ioctl calls
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the MAC address via ioctl calls


  • Subject: Getting the MAC address via ioctl calls
  • From: Aaron Ballman <email@hidden>
  • Date: Fri, 9 Jan 2004 14:50:16 -0600

Hello all!

I am using ioctl and OSIOCGIFCONF to obtain a list of all the interfaces installed on the system. I'm able to obtain information like the local address, subnet mask, broadcast address, etc. But I'm having a hard time with the MAC address. The reason I am using ioctl to do this is because I'm cross-compiling to Linux and would like to keep the code-base the same (just use a bridge to make sure the function pointers are all correct, hence the reason you'll see v_foobar in any of my code samples).

On Linux, you can use:

retVal = v_ioctl( sock, SIOCGIFHWADDR, ifr );

This will get you the MAC address in the ifr->ifr_hwaddr memeber of a struct ifreq. I notice that Apple deviates from the Linux version of ifreq and furthermore (more importantly!) there's no SIOCGIFHWADDR defined anywhere.

Am I just missing something, or is there really just no way to get the MAC address using ioctl?

Thanks for your help!

~Aaron
--
Handy UNIX Commands:

sudo grep -e "My mind" -H -r /
mv /mnt/fuji /mnt/everest
mv "Ignorance" /dev/null
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Getting the MAC address via ioctl calls
      • From: Justin Walker <email@hidden>
    • Re: Getting the MAC address via ioctl calls
      • From: Justin Walker <email@hidden>
  • Prev by Date: OTAsyncOpenInternetServicesInContext question
  • Next by Date: Re: Network Stats
  • Previous by thread: Re: OTAsyncOpenInternetServicesInContext question
  • Next by thread: Re: Getting the MAC address via ioctl calls
  • Index(es):
    • Date
    • Thread