tags:

views:

260

answers:

4

We are using MAC addresses to identify PCs as licensed to run software. (Don't care about MAC spoofing; licenses are hard to get :) PCs may have multiple Ethernet controllers (we also don't worry about the case where there isn't one; we haven't met such a machine in 5 years), and so there's a problem with reliably choosing a stable one.

I thought we had this nailed but apparantly not. We use GetAdaptersInfo from the Microsoft SDK iphlpapi module, and walk down the list. We use the last adapter in the as presumably it is the motherboard Ethernet controller. Alas, we've run into a Thinkpad that appears to change which controller is last depending on whether it is docked or not.

Is there a way to reliably find the MAC address for the motherboard Ethernet controller on a system, if it exists? And for those motherboards that have 2 or more, choose one of them that is stable? [If I knew that a set were motherboard-based, I can easily pick the lowest address MAC].

+2  A: 

No - there is no reliable way to do this. USB dongles are cheap and easy - use them.

I have had the "pleasure" of using MAC locked software before and all I can say is don't do it.

teambob
Agree. If we evalauted this software (adn several virtual environments), we'd reject this because of an inane MAC licensing system...
gbn
I've had the pleasure myself. In my case, the software chose a "virtual" MAC address created by a VPN software. Guess what happened when I uninstalled the VPN software?
Matthew Talbert
Dongles aren't practical for $100 products (of which we have a variety). They work for $1000.00 products (of which we have a few).
Ira Baxter
+3  A: 

It's a muddy issue. How do you deal with virtualization? On my machine I have several Ethernet adapters, only one of which is actually hardware-based. And my virtual machines all have software-generated MAC addresses. And, if I really want to, I can set up multiple VMs on different computers with the same MAC address (not on the same network, of course).

Vinay Sajip
Agreed, it's not a wise licensing method. The OP should implement another system.
Noon Silk
And you would suggest what, that is machine unique?
Ira Baxter
+1  A: 

I do not have a solution, but there might be another issue:

There exists VPN software that creates a virtual network card and randomly assigns a new mac address to this card every time the VPN connection is established.

Wolfgang
What I want is the MAC address for the ethernet controller on the motherboard. That presumably isn't fiddled by VPNs or anything else.
Ira Baxter
A: 

I don't think that there is any reliable way to determine which interface is "stable". Certainly not without digging down into the hardware details.

But what if you approached this a different way. You could have the user pick the interface from a list on install, which is probably not very user friendly. Or just record all the MAC addresses in the system and authenticate as long as one is still active.

Also for reference the order that GetAdaptersInfo returns can be changed by the user from the Advanced Settings menu in Network Connections.

shf301
The bit about users shuffling them around isn't making me happy. But probably not a big problem; almost nobody will do it.
Ira Baxter