Detecting the Loopback Adapter
- by BlueSkies
What is the best way for detecting whether a network interface is a loopback adapter?
The windows API's GetAdaptersInfo and GetAdaptersAddresses state in the documentation that they will return whether an interface is a loopback through the Type (MIB_IF_TYPE_LOOPBACK) but neither of these do for the Microsoft Loopback Adapter at least, it is reported as a standard ethernet interface.
I could try checking for the default MAC of the Loopback adapter but this can be easily spoofed.
I could check for the name "Microsoft Loopback Adapter" in the description but this may have translation issues and may lead to other issues.
IP addresses can also be changed.
What is the most robust method for doing this?