Read user defined network interface names

Hi,

I have a C++ application on OSX that normally works on systems with multiple network interfaces and I'd like to offer a dialog to the users to select the appropriate NIC for the different tasks. It would be fine to show the users the name they assigned to the NIC inside the system settings but I don't know how to read these names. I tried to use SCNetworkInterfaceGetLocalizedDisplayName() but that only gives me the name before I entered my own user defined name (something like "USB 10/100/1000 LAN"). Is there a way to read the user defined name of each NIC?

Thanks and best regards, Johannes

OK, I think I found it - you can read it from:

/Library/Preferences/SystemConfiguration/preferences.plist

you can read it from

Oi vey!, don’t do that.

Unless otherwise documented, Apple’s preferences files are not considered API. If you rely on their presence or format you can run into binary compatibility problems down the line.

Fortunately, in this case there’s a better way. Check out SCNetworkInterfaceGetLocalizedDisplayName.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn,

posting my finding I already thought this will result in an answer like yours. But as already written in my first post I actually checked out SCNetworkInterfaceGetLocalizedDisplayName() before searching deeper as this function doesn't return the name I've given the NIC.

Best regards, Johannes

Read user defined network interface names
 
 
Q