Re: [Qemu-devel] [Bug 1119281] [NEW] The virtio network device breaks UuidCreateSequential()

2013-02-11 Thread Stefan Hajnoczi
On Fri, Feb 08, 2013 at 10:45:03AM -, Francois Gouget wrote:
 Public bug reported:
 
 UuidCreateSequential() usually creates version 1 UUIDs (1) which means
 they contain the main network card's MAC address. However when using a
 virtio network card and driver the UUIDs contain random data instead of
 the guest's MAC address. Changing the network card to either the default
 rtl8139 one or the e1000 one fixes the issue.

CCing Yan and Vadim, who work on the virtio-win drivers.

 
 Here is the software I have tested this with:
  * qemu 1.1.2+dfsg-5 and 1.4.0~rc0+dfsg-1exp (from Debian Testing and 
 Experimental respectively)
  * The 0.1-49 and 0.1-52 Windows virtio drivers from 
 https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/
  * Both a 32-bit Windows XP guest and a 64-bit Windows 7 one.
 
 
 Here is how to test for this issue:
 * Set up a Windows guest with a single network card(2), a virtio one and 
 install the corresponding driver.
 
 * Boot the guest and copy the uuidtest.exe file (see attachement) to it
 
 * On the command line, type 'ipconfig /all'. Give you the correct
 network card's MAC address on a line like the one below:
 
 Physical Address. . . . . . . . . : 52-54-00-C7-0E-97
 
 * Run uuidtest.exe. It will show the VM returning a UUID with the wrong
 MAC address, and quite possibly even a multicast MAC address! (3). In
 the example below 'f75292c62787' should have been the MAC address. Note
 that on Windows XP UuidCreateSequential() returns RPC_S_UUID_LOCAL_ONLY
 for virtio cards but that on Windows 7 it returns 0.
 
 UuidCreateSequential() returned 0
 uuid={56e1ffe4-71d8-11e2-b1cc-f75292c62787}
 Got a version 1 UUID
 The UUID does not contain a non-multicast MAC address
 
 * Reboot and notice uuidtest.exe now reports a different value where the
 MAC address should be.
 
 * Shut down the VM and switch the network card to rtl8139, install the
 drivers, run uuidtest.exe and notice that the last group of digits
 finally contains the correct MAC address.
 
 
 (1) https://en.wikipedia.org/wiki/Globally_unique_identifier#Algorithm
 (2) Best do it with a single card to avoid confusion over which is the 
 primary one.
 (3) If the first byte of the address is odd then this is a multicast address.
 https://en.wikipedia.org/wiki/MAC_address#Address_details
 
 ** Affects: qemu
  Importance: Undecided
  Status: New
 
 ** Attachment added: Test executable and source

 https://bugs.launchpad.net/bugs/1119281/+attachment/3520477/+files/uuidtest.tar.bz2



Re: [Qemu-devel] [Bug 1119281] [NEW] The virtio network device breaks UuidCreateSequential()

2013-02-11 Thread Yan Vugenfirer
On Mon, Feb 11, 2013 at 11:13 AM, Stefan Hajnoczi stefa...@gmail.comwrote:

 On Fri, Feb 08, 2013 at 10:45:03AM -, Francois Gouget wrote:
  Public bug reported:
 
  UuidCreateSequential() usually creates version 1 UUIDs (1) which means
  they contain the main network card's MAC address. However when using a
  virtio network card and driver the UUIDs contain random data instead of
  the guest's MAC address. Changing the network card to either the default
  rtl8139 one or the e1000 one fixes the issue.

 CCing Yan and Vadim, who work on the virtio-win drivers.

 
  Here is the software I have tested this with:
   * qemu 1.1.2+dfsg-5 and 1.4.0~rc0+dfsg-1exp (from Debian Testing and
 Experimental respectively)
   * The 0.1-49 and 0.1-52 Windows virtio drivers from
 https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/
   * Both a 32-bit Windows XP guest and a 64-bit Windows 7 one.
 
 
  Here is how to test for this issue:
  * Set up a Windows guest with a single network card(2), a virtio one and
 install the corresponding driver.
 
  * Boot the guest and copy the uuidtest.exe file (see attachement) to it
 
  * On the command line, type 'ipconfig /all'. Give you the correct
  network card's MAC address on a line like the one below:
 
  Physical Address. . . . . . . . . : 52-54-00-C7-0E-97
 
  * Run uuidtest.exe. It will show the VM returning a UUID with the wrong
  MAC address, and quite possibly even a multicast MAC address! (3). In
  the example below 'f75292c62787' should have been the MAC address. Note
  that on Windows XP UuidCreateSequential() returns RPC_S_UUID_LOCAL_ONLY
  for virtio cards but that on Windows 7 it returns 0.
 
  UuidCreateSequential() returned 0
  uuid={56e1ffe4-71d8-11e2-b1cc-f75292c62787}
  Got a version 1 UUID
  The UUID does not contain a non-multicast MAC address
 
  * Reboot and notice uuidtest.exe now reports a different value where the
  MAC address should be.
 
  * Shut down the VM and switch the network card to rtl8139, install the
  drivers, run uuidtest.exe and notice that the last group of digits
  finally contains the correct MAC address.
 
 
  (1) https://en.wikipedia.org/wiki/Globally_unique_identifier#Algorithm
  (2) Best do it with a single card to avoid confusion over which is the
 primary one.
  (3) If the first byte of the address is odd then this is a multicast
 address.
  https://en.wikipedia.org/wiki/MAC_address#Address_details
 
  ** Affects: qemu
   Importance: Undecided
   Status: New
 
  ** Attachment added: Test executable and source
 
 https://bugs.launchpad.net/bugs/1119281/+attachment/3520477/+files/uuidtest.tar.bz2



I did a quick check for this issue. First off all
while UuidCreateSequential should use mac address, there is no indication
that it must do it. And as we don't have source code for Rpcrt4.lib it is
hard to estimated what should be the exact behavior of this function (I can
use reactos source code - but we cannot count on it).
What I see from our debug trace that there are no OID calls to NIC while
using this function to get our current or permanent MAC address. And we
know that those OIDs work well: a. because you see correct MAC using
ipconfig of getmac (also is verified by Red Hat QE during manual functional
tests). b. We pass WHQL tests that set valid and invalid mac addresses
automatically and tests for correct behavior. So UuidCreateSequential
either takes this value from somewhere in registry or generates it by some
other mean.

I can try and assume how it should work using ReactOS code.
From reactos UuidCreateSequential:
http://doxygen.reactos.org/df/def/rpcdce_8h_a884acec185f2f0a999a8375cd04f61c9.html
It will use GetAdaptersInfo. I ran the code in the MS documentation
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365917(v=vs.85).aspx-
and once again the mac address of virtio adapter is correct.


Might be related:
http://support.microsoft.com/kb/981080?wa=wsignin1.0
http://support.microsoft.com/kb/2569646


Best regards,
Yan.


[Qemu-devel] [Bug 1119281] [NEW] The virtio network device breaks UuidCreateSequential()

2013-02-08 Thread Francois Gouget
Public bug reported:

UuidCreateSequential() usually creates version 1 UUIDs (1) which means
they contain the main network card's MAC address. However when using a
virtio network card and driver the UUIDs contain random data instead of
the guest's MAC address. Changing the network card to either the default
rtl8139 one or the e1000 one fixes the issue.

Here is the software I have tested this with:
 * qemu 1.1.2+dfsg-5 and 1.4.0~rc0+dfsg-1exp (from Debian Testing and 
Experimental respectively)
 * The 0.1-49 and 0.1-52 Windows virtio drivers from 
https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/
 * Both a 32-bit Windows XP guest and a 64-bit Windows 7 one.


Here is how to test for this issue:
* Set up a Windows guest with a single network card(2), a virtio one and 
install the corresponding driver.

* Boot the guest and copy the uuidtest.exe file (see attachement) to it

* On the command line, type 'ipconfig /all'. Give you the correct
network card's MAC address on a line like the one below:

Physical Address. . . . . . . . . : 52-54-00-C7-0E-97

* Run uuidtest.exe. It will show the VM returning a UUID with the wrong
MAC address, and quite possibly even a multicast MAC address! (3). In
the example below 'f75292c62787' should have been the MAC address. Note
that on Windows XP UuidCreateSequential() returns RPC_S_UUID_LOCAL_ONLY
for virtio cards but that on Windows 7 it returns 0.

UuidCreateSequential() returned 0
uuid={56e1ffe4-71d8-11e2-b1cc-f75292c62787}
Got a version 1 UUID
The UUID does not contain a non-multicast MAC address

* Reboot and notice uuidtest.exe now reports a different value where the
MAC address should be.

* Shut down the VM and switch the network card to rtl8139, install the
drivers, run uuidtest.exe and notice that the last group of digits
finally contains the correct MAC address.


(1) https://en.wikipedia.org/wiki/Globally_unique_identifier#Algorithm
(2) Best do it with a single card to avoid confusion over which is the primary 
one.
(3) If the first byte of the address is odd then this is a multicast address.
https://en.wikipedia.org/wiki/MAC_address#Address_details

** Affects: qemu
 Importance: Undecided
 Status: New

** Attachment added: Test executable and source
   
https://bugs.launchpad.net/bugs/1119281/+attachment/3520477/+files/uuidtest.tar.bz2

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1119281

Title:
  The virtio network device breaks UuidCreateSequential()

Status in QEMU:
  New

Bug description:
  UuidCreateSequential() usually creates version 1 UUIDs (1) which means
  they contain the main network card's MAC address. However when using a
  virtio network card and driver the UUIDs contain random data instead
  of the guest's MAC address. Changing the network card to either the
  default rtl8139 one or the e1000 one fixes the issue.

  Here is the software I have tested this with:
   * qemu 1.1.2+dfsg-5 and 1.4.0~rc0+dfsg-1exp (from Debian Testing and 
Experimental respectively)
   * The 0.1-49 and 0.1-52 Windows virtio drivers from 
https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/
   * Both a 32-bit Windows XP guest and a 64-bit Windows 7 one.

  
  Here is how to test for this issue:
  * Set up a Windows guest with a single network card(2), a virtio one and 
install the corresponding driver.

  * Boot the guest and copy the uuidtest.exe file (see attachement) to
  it

  * On the command line, type 'ipconfig /all'. Give you the correct
  network card's MAC address on a line like the one below:

  Physical Address. . . . . . . . . : 52-54-00-C7-0E-97

  * Run uuidtest.exe. It will show the VM returning a UUID with the
  wrong MAC address, and quite possibly even a multicast MAC address!
  (3). In the example below 'f75292c62787' should have been the MAC
  address. Note that on Windows XP UuidCreateSequential() returns
  RPC_S_UUID_LOCAL_ONLY for virtio cards but that on Windows 7 it
  returns 0.

  UuidCreateSequential() returned 0
  uuid={56e1ffe4-71d8-11e2-b1cc-f75292c62787}
  Got a version 1 UUID
  The UUID does not contain a non-multicast MAC address

  * Reboot and notice uuidtest.exe now reports a different value where
  the MAC address should be.

  * Shut down the VM and switch the network card to rtl8139, install the
  drivers, run uuidtest.exe and notice that the last group of digits
  finally contains the correct MAC address.

  
  (1) https://en.wikipedia.org/wiki/Globally_unique_identifier#Algorithm
  (2) Best do it with a single card to avoid confusion over which is the 
primary one.
  (3) If the first byte of the address is odd then this is a multicast address.
  https://en.wikipedia.org/wiki/MAC_address#Address_details

To manage notifications about this bug go to: