Detecting the Loopback Adapter

Posted by BlueSkies on Stack Overflow See other posts from Stack Overflow or by BlueSkies
Published on 2009-10-07T02:04:13Z Indexed on 2010/06/16 14:02 UTC
Read the original article Hit count: 202

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?

© Stack Overflow or respective owner

Related posts about Windows

Related posts about winapi