Problem getting NIC info for WiFi with getifaddrs()
Hi.
I'm using the getifaddrs() to get the IP and MAC address of all the NICs (if available).
While this works fine for the en0 (cable) NIC, it does not work for the en1 (wireless) NIC.
If I loop through the linked list from getifaddrs() with some debug output, I can see that the three instances of en0 is of the the following sa_family:
AF_LINK
AF_INET6
AF_INET
While the en1 is only of these:
AF_LINK
AF_INET6
So no "AF_INET"
"ifconfig en1" or "ipconfig getifaddrs en1" from the console, shows that the interface is up and it's current DHCP IP.
I don't have the code at hand to post it, but can do so if needed. But generally the code just loops through the linked list and matches if the ifaddrs struct's: ifa addr->safamily is of AF_INET or of AF_LINK.
Tried searching, but can't seem to find anyone with a similar problem / solution.
Again, any hints would be greatly appreciated.
Best regards,
Chris
Using Xcode 3.1.2
I'm using the getifaddrs() to get the IP and MAC address of all the NICs (if available).
While this works fine for the en0 (cable) NIC, it does not work for the en1 (wireless) NIC.
If I loop through the linked list from getifaddrs() with some debug output, I can see that the three instances of en0 is of the the following sa_family:
AF_LINK
AF_INET6
AF_INET
While the en1 is only of these:
AF_LINK
AF_INET6
So no "AF_INET"
"ifconfig en1" or "ipconfig getifaddrs en1" from the console, shows that the interface is up and it's current DHCP IP.
I don't have the code at hand to post it, but can do so if needed. But generally the code just loops through the linked list and matches if the ifaddrs struct's: ifa addr->safamily is of AF_INET or of AF_LINK.
Tried searching, but can't seem to find anyone with a similar problem / solution.
Again, any hints would be greatly appreciated.
Best regards,
Chris
Using Xcode 3.1.2
MacBook Pro, Mac OS X (10.5.7)