Changing Virtual miniport mac address

Hi all,

I am new to windows drivers. My company has VMPort which randomly generates mac address when the driver is being installed.

Is there any way to change VMport mac address after the driver was installed?
I am asking this because I need application running in user space to change the mac address of VMport driver.
There is more than one instance of VMport drivers running in my PC.

Is there any way to set in while the driver is installed?

Thanks.

wrote in message news:xxxxx@ntdev…
> Hi all,
>
> I am new to windows drivers. My company has VMPort which randomly
> generates mac address when the driver is being installed.
>
> Is there any way to change VMport mac address after the driver was
> installed?
> I am asking this because I need application running in user space to
> change the mac address of VMport driver.
> There is more than one instance of VMport drivers running in my PC.
>
> Is there any way to set in while the driver is installed?
>

If you tell us what is VMPort, someone could come with ideas. Is this thing
related to KVM hypervisor?
– pa

Hi,

AMPort = Virtual miniport. :slight_smile:

Are you trying to change the PermanentMacAddress or the
CurrentMacAddress? I think the CurrentMacAddress can be changed
through the registry
(http://msdn.microsoft.com/en-us/library/windows/hardware/ff564512(v=vs.85).aspx)
and restarting the device. For the PermanentMacAddress, perhaps you
can expose an IOCTL through your miniport driver that takes as
parameters: the MAC address value to assign and some internal
identifier to locate the adapter?

Thanks

On Fri, Nov 30, 2012 at 12:51 PM, wrote:
> Hi,
>
> AMPort = Virtual miniport. :slight_smile:
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

IIRC the PermanentMacAddress is one of those values that ‘cannot change’
across the lifetime of the FDO (after MiniportInitialize) - thus the word
Permanent. Indeed, I don’t think that CurrentMacAddress changes either but
on that point I am not entirely confident and it is too late for me to go
looking up on a Friday night the veracity of any such claim.

So IOCTL is probably out of the question since by the time a Miniport
instance could be ready to deal with such a thing, it is too late. A
registry value read at MiniportInitialize time could surely serve, however.
And why not the common value MacAddress? There is nothing terribly
‘permanent’ about the MAC address of a virtual adapter.

Cheers,
Dave Cattley

Since I am talking about virtual miniport driver, there isn’t any real HW it interacts with.
The driver sends/receives data from user space application.

If i change the MAC address using IOCL (Proprietary OID), are there any special APIs I need to call from the driver? How do I update NDIS on the new MAC?

If changing CurrentMacAddress does the IP packets contains CurrentMacAddress or PermanentMacAddress?

If changing MAC throw registry, I guess i need to disable the driver, change its registry and enable it?

Thanks.

You must stop and restart your miniport if you want to change its MAC address. (Protocols don’t expect to see a MAC address change randomly; they have to be unbound and rebound to notice the change. Theoretically we could add a status indication for this, then demand protocols all implement it, but it’s such a rare situation that it’s not worth the effort.) So you don’t really need an ioctl; just disable the device, write a new address to your deivce’s configuration, then re-enable the device. The device will notice the new MAC address as part of its reinitialization.

Note that you should be changing the Current address, not the Permanent address. The Permanent address is meant to be… well… permanent, and applications might get confused if it changes.

You can choose to expose the current address as an optional Advanced Property named “NetworkAddress” with type “edit”, and it’ll show up in the Advanced Property GUI. On Windows 8, it will also be available in PowerShell’s Set-NetAdapterAdvancedProperty. Add this to your INF:

HKR,Ndi\params\NetworkAddress,ParamDesc,0,%NetworkAddress%
HKR,Ndi\params\NetworkAddress,Type,0,“edit”
HKR,Ndi\params\NetworkAddress,Default,0, “”
HKR,Ndi\params\NetworkAddress,LimitText,0,“12”
HKR,Ndi\params\NetworkAddress,UpperCase,0,“1”
HKR,Ndi\params\NetworkAddress,Optional,0,“1”

Hi Jeffrey,

Thank you very much for the response (and others also).